Bruno Desthuilliers wrote:
> [EMAIL PROTECTED] a écrit :
> > Hi Pythonians,
> >
> > To begin with I'd like to apologize that I am not very experienced
> > Python programmer so please forgive me if the following text does not
> > make any sense.
> >
> > I have been missing constants in Python language.
>
> Why so ?
>
> I guess you're talking about named (symbolic) constants ? If so, just
> follow the convention : a name in ALL_UPPERCASE is a constant (or at
> least will be treated as such by anyone not wanting to mess with your
> package's implementation). No need to add extra syntax here IMHO.

Hi Bruno,

For example:

>>> A = []  # let's declare a "constant" here
>>> b = A   # and let's assign the constant here
>>> b.append('1') # OOPS!
>>> c = A
>>> print A
['1']
>>> print b
['1']
>>> print c
['1']

As you can see, the "constant" A can be modified this easily. But if
there were an intuitive mechanism to declare a symbol to be immutable,
then there won't be this problem.

Br,

- T.S.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to