On Thu, May 20, 2010 at 22:54, Steven D'Aprano <st...@pearwood.info> wrote:
> This is misleading, since C().method is a bound method which takes one
> argument, x, not two. I find myself wishing that Python distinguished
> between ArgumentError and other TypeErrors, so that the method wrapper
> of bound methods could simply catch ArgumentError and subtract 1 from
> each argument count.

But how exactly could it distinguish between various levels of call nesting?

    class C:
        def a(self, i): return self.b(i)
        def b(self, j): return self.c(j)
        def c(self, k): return self.a()

What should C.a(), C().a(), and C().a(1) each yield? Does it change if
c(self, k) calls C.a(self)?

-- 
Michael Urman
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to