On 11/22/06, Walter Dörwald <[EMAIL PROTECTED]> wrote: > Another effect of __special__ methods is that they divide the class > namespace into two parts: The __special__ names are those that have to > be implemented to support core Python interfaces, and the methods > without underscores are those that implement the "main aspect" of the > class.
Well, there are plenty of examples of __special__ methods for other purposes than core Python interfaces, and plenty of core Python interfaces that don't use __special__ (dict.get(), list.append(), iter.next(), str.lower(), you get the idea.) The *original* idea was for __special__ names to apply to anything that wasn't invoked using regular method notation: x+y, a[i], o.foobar, f(args), len(a), that sort of thing. By extension or expedience it also became used for meta-data (e.g. Zope's __implements__) and for generic functions like pickling (__reduce__). They do have the downside that there's only one __special__ namespace. But that can be mitigated by using naming conventions. IMO it remains to be seen whether there will be too many generic functions to make this work sensibly. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
