Question on difference between LambdaType and FunctionType
Chris Angelico
rosuav at gmail.com
Sun Nov 25 15:49:16 EST 2018
On Mon, Nov 26, 2018 at 7:45 AM Iwo Herka <iwoherka at gmail.com> wrote:
>
> Everything works fine, except that I have to cover the following:
>
> foo = lambda self: None
>
> class Foo:
> __init__ = foo
>
> Since I'm treating FunctionType and LambdaType differently (I don't have
> to instrument lambdas, I can just return them), I have to know which one
> is it.
And this is exactly what I was wondering about - how a lambda function
needs to be treated differently. So is there a difference between:
class Foo:
def __init__(self): ...
and
class Foo:
def setup(self): ...
__init__ = lambda self: self.setup()
? If so, what is the difference? Why are lambda functions not instrumented?
ChrisA
More information about the Python-list
mailing list