Arithmetic sequences in Python
Antoon Pardon
apardon at forel.vub.ac.be
Thu Jan 19 02:50:26 EST 2006
Op 2006-01-19, Alex Martelli schreef <aleax at mail.comcast.net>:
>> What should list(list(1,2,3)) be? Should "list" really work
>> completely differently depending on whether it has a single arg or
>> multiple args?
>
> It works just fine for max and min, why should list be different?
Well IMO it works fine for max and min because people rarely want
the minimum or maximum over a sequence of tuples or lists.
But how would you make the following list: [(1,3)]
As far as I understand that would have to become:
list(((1,3),))
And [[3]] would have to become:
list((list((3,)),))
In my opinion the bracket notation wins the clarity contest
handsdown in this case and IMO these cases occure frequently
enough.
--
Antoon Pardon
More information about the Python-list
mailing list