"Magnus Lycka" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> [EMAIL PROTECTED] wrote:
> Today, Python has a syntactic shortcut. If 'a' is an
> instance of class 'A', a.f(x,y,z) is a shortcut for
> A.f(a,x,y,z). If you don't use the shortcut, there is
> no magic at all, just the unusual occurence of a type
> check in Python!

As was once pointed out to me some years ago, when I wrote something 
similar, a.f() is not just a shortcut for A.f(a) [a.__class__.f(a)].   The 
latter only looks for f in the class A namespace while the former also 
looks in superclass namespaces.  The 'magical' part of accessing functions 
via instances is the implementation of dynamic inheritance.

Terry Jan Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to