An alternative approach to bound methods

Alex Martelli aleaxit at
Thu Feb 22 05:14:05 EST 2001

"Marcin 'Qrczak' Kowalczyk" <qrczak at> wrote in message
news:slrn998h48.1te.qrczak at qrnik.zagroda...
> I would definitely change that and let all scopes nest, classes too.
> A recursive function should be able to refer to itself in the same
> way no matter if it's defined at the top level, in another function,
> or in a class. The first two cases were unified in 2.1b2, but the
> third has not been unified.

I *STRONGLY* disagree, because in the third case, AND IN IT ONLY,
inheritance and overriding come into play!!!

class X:
    def foo(self, N):
        if N>23: return 1+2*
        else: return N/7

_This_ recursively-defined function IS subject to overriding -- I
know this, and I see it very clearly, because of the "".

It would be just as clear and explicit that overring is NOT
supported if I used in the recursive call.  _Normally_
the potential for polymorphism and overriding IS desired, of
course, but it's important to be able to explicitly express
"...and here, strangely enough, NO overriding predicted".

But what should it mean if just "1+foo(N/2-4)" was coded, in
your "all scopes nest" ideal?  Would you thus facilitate the
EXCEPTIONAL case, in which is wanted, to the detriment
of the NORMAL case, in which is wanted?  Or have
some C++-like black magick, to have foo mean!

Thanks, but, NO thanks.

Nesting is for the birds!-)


More information about the Python-list mailing list