Shoulid constants be introduced to Python?

Karsten Hilbert Karsten.Hilbert at gmx.net
Fri Nov 17 03:29:07 EST 2017


On Thu, Nov 16, 2017 at 05:35:59PM -0500, ROGER GRAYDON CHRISTMAN wrote:

> Well, pi already does have a value:
> 
>>>> import math
>>>> math.pi
> 
> 3.141592653589793
> 
> but it's not a constant in the sense you are looking for:

And, it's not really a constant at all, it's only got a
constant definition :-)

> The only PEP I saw that makes any mention of constants is the PEP 8 Style Guide,
> which recommends all constants be named with all caps, such as "math.PI".
> (Why the math module doesn't do that beats me, unless it is there for
> hyster^H^H^H^H^Historical reasons.)

So,

	import math
	math.PI = math.pi

seems helpful :)

Karsten
-- 



More information about the Python-list mailing list