How do you create constants?

Steve Holden sholden at holdenweb.com
Mon Nov 6 14:23:09 CET 2000


Andy Heath wrote:
> 
> If you want constants what is wrong with creating functions
> with those values
> 
> eg.
> 
> def pi():
>     return 3.142
> 
> Andy
> ----------------------

Well, actually, functions suffer from just the same problem as variables,
as you will find out by running the following script:

def pi():
    return 3.14159

def pi():
    return 22/7.0

print pi()

regards
 Steve
-- 
Helping people meet their information needs with training and technology.
703 967 0887      sholden at bellatlantic.net      http://www.holdenweb.com/





More information about the Python-list mailing list