On 4/30/07, Lino Mastrodomenico <[EMAIL PROTECTED]> wrote: > One more thing: what do people think of modifying super so that when > it doesn't find a method instead of raising AttributeError it returns > something like "lambda *args, **kwargs: None"?
To me, the most important change is correctness -- super(__this_class__, self) over super(Name, self). Anything else is at least debatable. But of all the shortcuts mentioned, this particular shortcut is easily the most valuable to me. At one point, I had even considered giving the super object a special method to upcall in this manner. For What Its Worth, in my own code, when I don't know whether or not the next method exists, I will always be upcalling to the method of the same name, and passing all my arguments. Even changing the value of one argument would be strange enough to count as a special case worth spelling out. Alas, Guido's recent opinion was "Don't do that". He suggested, at a minimum, inheriting from an ABC that provided the Nothing method. > Optionally this can be a constant (e.g. default_method) defined > somewhere so, if necessary, it's still possible to detect if the value > of super.meth is a real method or the "fake" default_method. http://www.python.org/sf/1673203 is a patch for adding an identity method; I suspect a Nothing in the builtins would also make sense. -jJ _______________________________________________ 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
