One Python 2.1 idea
rturpin at my-deja.com
rturpin at my-deja.com
Mon Dec 25 10:45:08 EST 2000
More information about the Python-list mailing list
Mon Dec 25 10:45:08 EST 2000
- Previous message (by thread): Why is Python slow? (was Re: One Python 2.1 idea)
- Next message (by thread): One Python 2.1 idea
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <mailman.977737448.26875.python-list at python.org>, Peter Schneider-Kamp <peter at schneider-kamp.de> wrote: > I see ome good reasons for enhancing the "for" statement: > > - loop counter iteration will give a speedup by avoiding > construction of a list and looping over that list. > - looping a certain amount of times is a frequent construct Yes, this is a good performance optimization. BUT it requires NO CHANGE in how loops are written. The WRONG way to do this is to provide another construct in the language, making it more complex, but giving it no more expressive power. The RIGHT way to do this is for the compiler to recognize the common construct: for i in range(<exp1>: <exp2>): The compiler then generates efficient byte code that does precisely what you describe. It can generate a minimal "ghost" of a list for the iteration, because there is no way that future code can do anything else with that list. Russell Sent via Deja.com http://www.deja.com/
- Previous message (by thread): Why is Python slow? (was Re: One Python 2.1 idea)
- Next message (by thread): One Python 2.1 idea
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list