kuco23
Aug 5, 2022

--

I think the author's reasoning is way wrong. If you do:

```

class something:

def __init__(self, f):

self.f = f

def f(self):

return 'class_version'

a = something(lambda: 'attribute')

a.f()

```

it's going to be 'attribute'. I'm pretty sure it's because the attribute version of f is assigned at instantiation of the object, while the class version is assigned at class definition. This means the attribute version overrides the class version.

--

--

kuco23
kuco23

Written by kuco23

Math MSc | Smart contract dev @ Flare network | https://kuco23.github.io

No responses yet