On Tue, Nov 19, 2019 at 6:15 AM Andrew Barnert
On Nov 18, 2019, at 11:07, Chris Angelico
wrote: If by "constant" you mean that they are immutable, then maybe; there aren't very many mutable callables (by comparison to the huge number of functions).
Functions are mutable. You can edit their __defaults__, or even replace their __code__.
In fact, there aren’t very many _immutable_ callables (by comparison to the huge number of functions).
True, they're technically mutable, though in practice they're normally treated as immutable. Generally a function isn't changed in any significant way once it's been fully prepared - even if "prepared" involves work after construction (such as might be done by a decorator). But that's more a matter of convention than actual enforcement. In any case, my point still stands, that "def foo(): ..." is a very different beast from "foo = 1,2,3,4", where the latter is truly a literal and a constant. ChrisA