This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jameinel
Recipients belopolsky, jameinel, rhettinger
Date 2008-04-24.21:39:34
SpamBayes Score 0.00036180986
Marked as misclassified No
Message-id <4810FE04.4070303@arbash-meinel.com>
In-reply-to <1209072289.81.0.669976050802.issue2672@psf.upfronthosting.co.za>
Content
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Raymond Hettinger wrote:
> Raymond Hettinger <rhettinger@users.sourceforge.net> added the comment:
> 
> John, when y=[], the update method has to create a new list iterator on 
> each invocation.  But when y is a genexp, it is self-iterable (iow, iter
> (y) will return self, not a new object).
> 
> Also, when doing timings, it can be helpful to factor-out the attribute 
> lookup:
> 
> python -m timeit -s 'x=set(range(10000)); y=[]; xu=x.update' 'xu(y)'
> 
> __________________________________
> Tracker <report@bugs.python.org>
> <http://bugs.python.org/issue2672>
> __________________________________
> 

Sure, I wasn't surprised at the "set.update(y)" versus "set.update([])"

What I was surprised at is the time for:

"(i for i in [])" being about 4x longer than
"set.update(i for i in [])"

Anyway, the original issue is probably closed, whether we want to track
into the generator stuff or not is probably a different issue.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIEP4EJdeBCYSNAAMRAq+MAKC6tLjEtIBX7YgLNoYEfqjRKB4DzACglXjh
cEVLEP5Hu3vpeVgVYdTbAVc=
=94ja
-----END PGP SIGNATURE-----
History
Date User Action Args
2008-04-24 21:39:39jameinelsetspambayes_score: 0.00036181 -> 0.00036180986
recipients: + jameinel, rhettinger, belopolsky
2008-04-24 21:39:35jameinellinkissue2672 messages
2008-04-24 21:39:34jameinelcreate