Comparison with Ruby ?
aleaxit at yahoo.com
Fri Feb 23 12:13:07 CET 2001
"Moshe Zadka" <moshez at zadka.site.co.il> writes:
> > > Ruby converts small integers and long integers automatically.
> > > JB> Okay, nice for you
> > No way. Explicit is better than implicit. I'd rather NOT
> > have such 'automatic' (automagick) conversions anywhere!
> Err....I don't agree. See PEP 0228
> I think it could be done in a very Pythonic way (of course, for full
> I am the author of said PEP...)
Guess I should have mentioned I _do_ like PEP 228 -- reworking the
entire conceptual model of Python numbers in such a simplifying
way seems a very worthy goal. Automatic conversions behind my
back are a different thing...
> Numbers are numbers: I shouldn't care about how to store numbers in
> machine-level integers more then I should care how to reallocate lists.
But I _do_ care about how list are allocated -- somebody mentioned
recently that a simple 'optimization' I and others had suggested,
where a (huge) list of known length N is "pre-allocated" as N*[None],
then the various items set, gave them a factor-of-2 boost in time
to run their program over the N-times-append alternative. Speed is
not the crucial thing when one uses Python, but factors of 2 or more
are still of some interest, in many cases.
> This PEP is a bit backwards incompatible, but in my not so humble opinion,
> I think it does have a good chance of being in Py3K.
> There is a related session in IPC9 given by Tim Peters, by the way.
Alas, I won't be there, but I hope I'll be able to read some report
about it on the net later...
More information about the Python-list