On Tue, Nov 19, 2019 at 8:04 AM Random832
On Mon, Nov 18, 2019, at 14:04, 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). But you can't assume that a function is as constant as a string literal.
I meant a constant in the sense that the name is never intended to be and never in fact reassigned. The kind of thing that when they're *not* callable, PEP8 says should be named in ALL_CAPS.
Fair enough.
verbose = print if args.quiet: def verbose(*a, **kw): pass
Is 'verbose' now a variable, a function, a constant, a global, or what? How should it be highlighted?
I already conceded that this kind of thing is subjective around the edges, what more do you want?
My opinion would be that it should be highlighted as a function, but I'm not sure how I'd define the criteria for this.
I wasn't aiming that at you, so much as pointing out how incredibly tricky it is to pin down all these definitions. So tricky, in fact, that it's almost completely not worth trying to define at all (in my opinion). ChrisA