Python is faster than C
mwh at python.net
Mon Apr 5 15:03:16 CEST 2004
Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> Armin Rigo <arigo at tunes.org> writes:
> > Ideally: If you do x=range(100); x='hi' then the interpreter first
> > builds this optimized range representation and assigns it to x; and when
> > in the next statement you modify this list x it says 'oops! i cannot do
> > that with this representation', so it reverts to an array-like
> > representation (i.e. it creates all 100 elements) and then changes the
> > 50th. No gain here. If on the other hand you only ever do 'easy'
> > things with your list, like iterate over it or read elements, then it
> > can all be done with the range representation, without falling back to
> > the array representation.
> Maybe there is something to this.
Armin is usually worth listening too :-)
You can find a step towards many of these ideas in PyPy, which should
surprise no one at all...
Indeed, when I design my killer language, the identifiers "foo" and
"bar" will be reserved words, never used, and not even mentioned in
the reference manual. Any program using one will simply dump core
without comment. Multitudes will rejoice. -- Tim Peters, 29 Apr 1998
More information about the Python-list