That is not all.
Say:
a = lambda: sum(1)
How do you know what sum it is calling?
So either:
a) namespace needs to be constructed by analysing code and picking up needed variables (complex and requires maintenance)
b) sourcing whole globals() / locals() (heavy on memory)
c) manually constructing one
Some libraries do that, but I doubt it will be decided to go this way in CPython any time soon.
Neither I think it would be a very good idea.
It doesn’t completely make sense conceptually.
E.g. Imagine this was done:
var = 1
a = lambda: var
# Route 1
b = pickle.loads(pickle.dumps(a))
var = 2
print(a()) # 2
print(b()) # 1
So it does not preserve intended behaviour.
Thus, ad-hoc lambda/def is simply incompatible concept.
And IMO, things like this should be best left alone.
Thus, I use partial for that, which obviously needs serialisable callable (same issue if callable was ad-hoc lambda), but that makes sense.