On Wed, 14 Dec 2005, Steven D'Aprano wrote: > On Wed, 14 Dec 2005 10:57:05 +0100, Gabriel Zachmann wrote: > >> I was wondering why python doesn't contain a way to make things "const"? >> >> If it were possible to "declare" variables at the time they are bound >> to objects that they should not allow modification of the object, then >> we would have a concept _orthogonal_ to data types themselves and, as a >> by-product, a way to declare tuples as constant lists. > > In an earlier thread, somebody took me to task for saying that Python > doesn't have variables, but names and objects instead.
I'd hardly say it was a taking to task - that phrase implies authoritativeness on my part! :) > This is another example of the mental confusion that occurs when you > think of Python having variables. What? What does this have to do with it? The problem here - as Christopher and Magnus point out - is the conflation in the OP's mind of the idea of a variable, and of the object referenced by that variable. He could have expressed the same confusion using your names-values-and-bindings terminology - just replace 'variable' with 'name'. The expression would be nonsensical, but it's nonsensical in the variables-objects-and-pointers terminology too. > Some languages have variables. Some do not. Well, there is the lambda calculus, i guess ... tom -- The sky above the port was the colour of television, tuned to a dead channel -- http://mail.python.org/mailman/listinfo/python-list