[Python-ideas] Default arguments in Python - the return

Georg Brandl g.brandl at gmx.net
Sat May 9 17:38:12 CEST 2009

Pascal Chambon schrieb:

> Still, an explicit way of targetting "the function I'm in" would be
> sweet imo, but retrieving it that way is not far from being as handy.

You could use e.g.

def selffunc(func):
    def newfunc(*args, **kwds):
        return func(func, *args, **kwds)
    return newfunc

def foo(func, a):
    func.cache = a

to avoid the "ugly" lookup of the function in the global namespace.


Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

More information about the Python-ideas mailing list