"hanz" <[EMAIL PROTECTED]> writes:
> > But wait if I do that, people will tell me how bad that it is,
> > because it will keep a reference to the value which will prevent
> > the garbage collector from harvesting this memory.
> 
> Nobody will tell you that it's bad. Python was never about super
> performance, but about readability.  Besides, using such temporaries
> won't consume much memory (relatively).

That completely depends on the objects in question.  Compare

   temp = all_posters[:]
   temp.sort()
   top_five_posters = temp[-5:]

to:

   top_five_posters = all_posters.sorted()[-5:]

which became possible only when .sorted() was added to Python 2.4.

This is another reason it would be nice to be able to create very
temporary scopes.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to