Antoon Pardon <[EMAIL PROTECTED]> wrote:

> Op 2005-02-06, Alex Martelli schreef <[EMAIL PROTECTED]>:
> >  
> >> Isn't that inconsistent?
> >
> > That Python has many callable types, not all of which are descriptors?
> > I don't see any inconsistency there.  Sure, a more generalized currying
> > (argument-prebinding) capability would be more powerful, but not more
> > consistent (there's a PEP about that, I believe).
> 
> I think python is a bit inconsistent here, by using 'def' for
> two different things.

It doesn't.

> I think it would have been more consistent
> if def always produces a function

It does.

def g(self): pass
class A(object):
  f = g

class B(object):
  def f(self): pass

class C(object): pass
C.f = g

class D(object):
  f = B.f

These four classes are essentially equivalent.  def always produces a
function object and binds it to the name coming after keyword 'def'.
Any such function object, no matter how produced and how bound hither
and thither, always behaves in exactly the same way.

You're free to like or dislike this arrangement, but calling it
"inconsistent" is a madman's folly, as it is TOTALLY consistent.


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

Reply via email to