3 ms·
Even without going to the trouble of importing types, every Python callable has an __call__ method. Including the __call__ method: >>> def f(): ... pr
by earthboundkid 17y ago
Even without going to the trouble of importing types, every Python callable has an __call__ method. Including the __call__ method:
>>> def f():
... print("Helllo __call__")
...
>>> f.__call__.__call__.__call__.__call__()
Helllo __call__
Don't use this in real life though, there's a performance penalty.
- ubernostrum 17y agoOf course, there's also the singleton that always returns itself: >>> recursive = lambda: recursive