Arithmetic sequences in Python
Paul Rubin
http
Sat Jan 21 15:08:24 EST 2006
Tom Anderson <twic at urchin.earth.li> writes:
> > listx/dictx/setx would be the display forms as well as the constructor forms.
>
> Could these even replace the current forms? If you want the equivalent
> of list(sometuple), write list(*sometuple).
The current list function is supposed to be something like a typecast:
list() = []
xlist() = [] # ok
list(list()) = [] # casting a list to a list does nothing
xlist(xlist()) = [[]] # make a new list, not the same
list(xrange(4)) = [0,1,2,3]
xlist(xrange(4)) = [xrange(4)] # not the same
list((1,2)) = [1,2]
xlist((1,2)) = [(1,2)]
etc.
More information about the Python-list
mailing list