Python is faster than C
aahz at pythoncraft.com
Mon Apr 5 06:36:38 CEST 2004
In article <mailman.311.1081031736.20120.python-list at python.org>,
Armin Rigo <arigo at tunes.org> wrote:
>You missed my point indeed. There are two levels here: one is the
>language specification (the programmer's experience), and one is the
>CPython implementation. My point is that with some more cleverness in
>the implementation, iterators would be much less needed at the language
>specification level (I'm not saying never, I think generators are
>great, for example).
Yes, exactly. Without generators, I'm not sure iterators would have
taken off to the extent they have.
>Yes, and I'm ranting against the idea that the programmer should be
>bothered about it, when it could be as efficient automatically. From
>the programmer's perspective, iterators are mostly like a sequence that
>you can only access once and in order. A better implementation can
>figure out for itself when you are only accessing this sequence once
>and in order. I mean, it is just like range(1000000) which is a list
>all right, but there is just no reason why this list should consume
>4MB of CPython's memory when the same information can be encoded in
>a couple of ints as long as you don't change the list. The language
>doesn't need xrange() -- it is an implementation issue that shows up in
>the Python language.
While I'm generally in favor of what you're talking about, it seems to a
certain extent that you're simply shifting complexity. Maintaining the
simplicity of the Python VM is an important goal, I think, and some of
your suggestions run counter to that goal.
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"usenet imitates usenet" --Darkhawk
More information about the Python-list