[EMAIL PROTECTED] wrote:
> What I'd like to see here is that b gets a copy of A so that the
> original A won't be modified as we play with b. However, as we assign a
> constant value A to b, I wouldn't want to restrict myself from playing
> with b. 

If A is a list you can take a copy-slice liek this:
>>> b = A[:]

and changes to b won't affect A.  For the general case where A isn't a list,
you can use the copy module to make shallow or deep copies of A.

http://docs.python.org/lib/module-copy.html

It's not quite as simple or as strict as declaring A constant, but it works. 
Or you could look at properties, there's a thread in this group within the
last couple weeks about making constants with properties.

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

Reply via email to