Marko Rauhamaa wrote: > Why can't I have: > > >>> d = {} > >>> d.x = 3 > >>> d > {'x': 3}
Because it's horrible and a bad idea. d = {'this': 23, 'word': 42, 'frog': 2, 'copy': 15, 'lunch': 93} e = d.copy() Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: 'int' object is not callable Conflating keys in a database with object attributes is one of the classic blunders, like getting involved in a land war in Asia. It is, *maybe*, barely acceptable as a quick-and-dirty convenience at the interactive interpreter, in a Bunch or Bag class that has very little in the way of methods or behaviour, but not acceptable for a class as fundamental and important as dict. No matter what Javascript thinks. Consider: d['something else'] = 1 d.something else d.something else ^ SyntaxError: invalid syntax -- Steven -- https://mail.python.org/mailman/listinfo/python-list