Arithmetic sequences in Python

Tom Anderson twic at urchin.earth.li
Sat Jan 21 21:45:42 CET 2006


On Sat, 21 Jan 2006, it was written:

> 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:

A what?

;-|

> 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)]

True, but so what? Is it that it has to be that way, or is it just that it 
happens to be that way now?

tom

-- 
It's the 21st century, man - we rue _minutes_. -- Benjamin Rosenbaum



More information about the Python-list mailing list