How a function refer itself?
    def f():
        f() # fine... really???

consider these situations:
1) decorator
    @xxx
    def f():... # how can I access the wrapped version?

2) replace by other
    def f(): f() # call second!!
    a = T(f)     # to call first
    def f():...

3) refactor: rename function
    # first version
    def f():f()
    -------------------
    # second version, wrap it
    def f():
        log();
        try:            # to avoid indent
            _f_impl()
        except...
    def _f_impl(): _f_impl() # hadnot we rename it!


solution:
    # add __this_func__
    class C:
        @xxxx
        def f(self):
            self.f()
            __class__.f(self)
            __this_func__(self)


_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to