Confessions of a Python fanboy

Iain King iainking at gmail.com
Fri Jul 31 11:35:45 EDT 2009


On Jul 31, 4:08 pm, Ethan Furman <et... at stoneleaf.us> wrote:
> Steven D'Aprano wrote:
> > On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote:
>
> >>That and the fact that I couldn't stop laughing for long enough to learn
> >>any more when I read in the Pragmatic Programmer's Guide that "Ruby,
> >>unlike less flexible languages, lets you alter the value of a constant."
> >>Yep, as they say "Bug" = "Undocumented feature"!
>
> > That's no different from Python's "constant by convention". We don't even
> > get a compiler warning!
>
> That's quite different, actually.  Python doesn't claim to have
> constants!  Can't misinterpret what you can't have, can you?
>
> [Holds breath while awaiting counter-example... :]
>
> ~Ethan~

The convention being detailed in PEP8: http://www.python.org/dev/peps/pep-0008/
basically, anything in ALL_CAPS is a constant, assuming you follow
those style guidelines.

Iain



More information about the Python-list mailing list