range question, compared to Smalltalk
Frank Buss
fb at frank-buss.de
Wed Aug 28 02:36:11 EDT 2002
Neal Norwitz <neal at metaslash.com> wrote:
> Use xrange. But xrange only works on integer values defined by a C long
> (usually 32 bits, but sometimes 64 bits).
Thanks, that's what I was searching for. Because it is a builtin type it's
faster than a solution with a normal Python class, I assume, and it should
be used for loops ("for i in xrange(123):") every time, shouldn't it? I
have read some of the O'Reilly book "Learning Python", but it wasn't
mention, at least not in the first half, only "range".
> 3.__class__ is parsed as a float:
Why? I'm not an compiler expert, but I think that with a one or two char
lookahead this could be solved, but perhaps this will result in a
performance drawback.
--
Frank Buß, fb at frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
More information about the Python-list
mailing list