python 3 constant
Waldek M.
wm at localhost.localdomain
Thu Jun 23 02:40:29 EDT 2011
Dnia Wed, 22 Jun 2011 22:17:49 +0100, Noah Hall napisaĆ(a):
> On Wed, Jun 22, 2011 at 7:54 PM, sidRo <slacky2005 at gmail.com> wrote:
>> How to declare a constant in python 3?
>
> There aren't true constants in Python, but instead we use a standard
> defined by PEP 8, which states constants are in all caps, for example,
> PI = 3.14, as opposed to pi = 3.14 which could change (according to
> PEP 8, that is)
That said, there are some workarounds for that:
http://code.activestate.com/recipes/65207-constants-in-python/?in=user-97991
Still, I'd reallly like to have constants as a built-in...
Best regards,
Waldek
More information about the Python-list
mailing list