3 ms·
It can't, because lol dynamic dispatch. Exercise: what does this code do? import collections collections.namedtuple = lambda _0, _1, _2=False, _3=False
by pwdisswordfish 9y ago
It can't, because lol dynamic dispatch. Exercise: what does this code do?
import collections
collections.namedtuple = lambda _0, _1, _2=False, _3=False: "Where is your god now?"
import b
b.py:
import collections
print(collections.namedtuple('Point', ['x', 'y']))
And this is not even particularly 'evil' code, in the sense of relying on internal implementation details; that's just your bread-and-butter Python language semantics. It prevents (or at least complicates) many other potential optimisations as well.