Metaclass conundrum - binding value from an outer scope

Lele Gaifax lele at metapensiero.it
Thu Apr 20 16:55:19 EDT 2017


Skip Montanaro <skip.montanaro at gmail.com> writes:

>             underlying = getattr(SomeOtherClass, a)
>             def _meth(self, *args):
>                 return underlying(self._instance, *args)

Does

    underlying = getattr(SomeOtherClass, a)
    def _meth(self, *args, _underlying=underlying):
        return _underlying(self._instance, *args)

help?

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.



More information about the Python-list mailing list