On Tue, Nov 19, 2019 at 6:15 AM Andrew Barnert <[email protected]> wrote: > > On Nov 18, 2019, at 11:07, Chris Angelico <[email protected]> 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 _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/V4GVX227SYKIJVWJ4ENTXTKOICHBQJSZ/ Code of Conduct: http://python.org/psf/codeofconduct/
