Python is faster than C
Paul Rubin
http
Sat Apr 3 21:23:11 EST 2004
Armin Rigo <arigo at tunes.org> writes:
> Ideally: If you do x=range(100); x[50]='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.
More information about the Python-list
mailing list