pep 8 constants
Francesco Bochicchio
bockman at virgilio.it
Sun Jan 18 13:17:38 EST 2009
On Wed, 14 Jan 2009 08:13:30 +0000, Steven D'Aprano wrote:
>
> Absolutely. It's rather sad that I can do this:
>
> import math
> math.pi = 3.0
>
> I like the ability to shoot myself in the foot, thank you very much, but
> I should at least get a warning when I'm about to do so:
>
> math.PI = 3.0 # use God-like powers to change a constant
>
>
Constants would be a nice addition in python, sure enough.
But I'm not sure that this can be done without a run-time check every time
the constant is used, and python is already slow enough. Maybe a check
that is disabled when running with optimizing flags ?
But I'm sure this discussion has been already made and the FINAL WORD has
been already spoken.
Ciao
----
FB
More information about the Python-list
mailing list