Message65753
-----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----- |
|
Date |
User |
Action |
Args |
2008-04-24 21:39:39 | jameinel | set | spambayes_score: 0.00036181 -> 0.00036180986 recipients:
+ jameinel, rhettinger, belopolsky |
2008-04-24 21:39:35 | jameinel | link | issue2672 messages |
2008-04-24 21:39:34 | jameinel | create | |
|