One of the issues with porting to Py3k is the problem that __getattr__ and __getattribute__ can't reliably provide special methods like __add__ the way __getattr__ could with classic classes. (As first noted by Terry Reedy years ago, and recently seeing some new activity on the bug tracker [1])
The culprit here is the fact that __getattribute__ and its associated machinery is typically never invoked for the methods with dedicated tp_* slots in the C-level type structure. What do people think of the idea of providing an extra method on type objects that goes through all of the C-level special method slots, and for each one that isn't currently set, does a getattr() on the associated special name and stores the result (if any) on the current type object? When converting a proxy class that relies on __getattr__ from classic to new-style, all that would then be needed is to invoke the new method on the class object after defining the class (a class decorator or metaclass could be provided somewhere to make this a bit tidier). This seems a lot cleaner than expecting everyone that implements a proxy object to maintain there own list of all of the relevant special methods, and locates the implementation support in an area of the code that already has plenty of infrastructure dedicated to keeping Python visible attributes in sync with the C visible tp_* slots. Thoughts? Altenative ideas? Howls of protest? Cheers, Nick. [1] http://bugs.python.org/issue643841 -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com