How to isolate a constant?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Oct 23 01:32:56 EDT 2011


On Sat, 22 Oct 2011 18:01:52 -0700, Gnarlodious wrote:

> On Oct 22, 6:41 pm, Chris Rebert <c... at rebertia.com> wrote:
> 
>> The line `someList = self._someList` does NOT copy the list. It make
>> `someList` point to the same existing list object.
> Thanks for all those explanations, I've already fixed it with a tuple.
> Which is more reliable anyway.

No, tuples are not "more reliable" than lists. Don't make the mistake of 
confusing your inexperience and lack of understanding about Python's 
object model for "lists are unreliable". They are completely reliable. 
You just have to learn how they work, and not make invalid assumptions 
about how they work.

You wouldn't say "Nails are more reliable than screws, because I hammered 
a screw into a plaster wall and it just fell out." Of course it fell out: 
you used it incorrectly for what you needed.


-- 
Steven



More information about the Python-list mailing list