No Thoughts about Everything

Richie Hindle richie at entrian.com
Thu Feb 26 04:35:53 EST 2004


[Bernhard]
> I found a solution for the simulation of access modifier "static final " 
> in python:
> 
> class Mytest:
>     LOGE_10=(2.302585092994046,)
>     #Klassenkonstante (static final) use a tuple :-)
>     #def __init__(self):
>         
>     def log10(self,x):
>         return(log(x)/LOGE_10[0])

*Please* don't start teaching that to Python beginners! <0.5 wink>

Apart from the horrible confusion it would cause, it doesn't even work:

>>> Mytest.LOGE_10=(2.0,)  # Near enough for engineers

Next you'll be asking for a preprocessor so that you can say:

#define LOGE_10 Mytest.LOGE_10[0]

8-)

-- 
Richie Hindle
richie at entrian.com





More information about the Python-list mailing list