On Mon, Dec 20, 2010 at 6:44 AM, spir
On Sun, 19 Dec 2010 19:52:28 +0100 Eike Welk
wrote: My positive attitude towards this syntax comes from the only weakness that Python IMHO has: You can't easily see which data attributes an instance has. This information is hidden in __init__, and sometimes elsewhere.
Agreed. Rather commonly elsewhere, I guess.
I think a mechanism like slots should be the norm, and dynamism the exception.
I wish we could put in front place the set of intended data attributes, including ones w/o defaults and optional ones. Even better, instanciation with the same param names would automagically set those attributes.
These days, a nice solution to that problem is to define a named tuple and inherit from it (see the 3.2 version of urllib.parse for a number of examples). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia