Arithmetic sequences in Python

Christoph Zwerschke cito at online.de
Sun Jan 22 19:26:54 EST 2006


Alex Martelli wrote:
>>>> print set([1,2,3])
> set([1, 2, 3])
> 
> input and output could be identical.  Do YOU have any good reason why
> sets should print out as set(...) and lists should NOT print out as
> list(...)?  Is 'list' somehow "deeper" than 'set', to deserve a special
> display-form syntax which 'set' doesn't get?  Or are you enshrining a
> historical accident to the level of an erroneously assumed principle?

These are valid points, but they lead me to the opposite conclusion: Why 
not let {a,b,c} stand for set([a,b,c])? That would be very intuitive 
since it is the mathematical notation already and since it resembles the 
notation of dictionaries which are similar to sets.

(This has been probably discussed already. One problem I'm already 
seeing is that {} would be ambiguous.)

Anyway, I think the fact that the notation for a set is clumsy is no 
good reason to make the notation for a list clumsy as well.

-- Christoph



More information about the Python-list mailing list