Try... except....Try again?

Xavier Ho contact at xavierho.com
Fri Jul 17 22:48:28 EDT 2009


Darn it.

On Sat, Jul 18, 2009 at 8:55 AM, Dave Angel <davea at ieee.org> wrote:

>
> You don't need a counter.  len() will tell you the size of the list of
> primes.


Does len() go through and count by itself, or does it actually keep track of
the size and just return the memory? I always thought it would go through
and count, which may take some time. I could be wrong.

>
> And, just in case you're still interested, that
>     for i in range()
>
> earlier in the thread has the overhead of building a (possibly) large list
> of integers, just in case we might need to loop.


Right, so for i in xrange() would be a better choice?

Best regards,

Ching-Yun "Xavier" Ho, Technical Artist

Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: contact at xavierho.com
Website: http://xavierho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090718/64fe6804/attachment-0001.html>


More information about the Python-list mailing list