DreiJane schrieb:
NB: I wondered about about dict(one=1, two=2) - why not d = {one:1,
two:2} ? Since you do not write L=list((1, 2)) either. These composed
because it's not working.
>>> {one : 1}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'one' is not defined
Yes, that looks nitpicky, but that is exactly the reason one often
prefers the dict(...)-variant. Because it uses python keywords, it
spares you to type quotes around all the keys. Which IMHO is more aesthetic.
objects as basic building blocks make Python code so dense and
beautiful, thus using "{}" means embracing the language's concept.
The collection-literals are a great thing, no doubt. But these
alternatives are not against any concept.
Diez
--
http://mail.python.org/mailman/listinfo/python-list