[Zope] Superfast PageTemplates: correction
Dylan Reinhardt
zope@dylanreinhardt.com
Mon, 17 Feb 2003 16:23:14 -0800
At 03:35 PM 2/17/2003, Jerome Alet wrote:
>On Mon, Feb 17, 2003 at 03:30:26PM -0800, Dylan Reinhardt wrote:
> > At 03:24 PM 2/17/2003, Dylan Reinhardt wrote:
> > >return ''.join(item for item in some_list])
> >
> > Correction... that should be:
> >
> > return ''.join([item for item in some_list])
>
>or :
>
> return ''.join(some_list)
>
>if I don't miss anything.
Ah... true enough. That was too trivial an example to be meaningful.
I should have written:
----------
# least efficient
result = ''
for item in some_list:
result += do_something(item)
return result
# more efficient
result = []
for item in some_list:
result.append(do_something(item))
return ''.join(result)
# most efficient
''.join([do_something(item) for item in some_list])
----------
Dylan