Python variables are bound to types when used?

Robert Kern robert.kern at gmail.com
Wed Oct 19 19:47:26 EDT 2005


Steven D'Aprano wrote:
> On Wed, 19 Oct 2005 20:06:53 +0000, Grant Edwards wrote:
> 
>>>Now, in Python variables are bound to types when used, right?
>>
>>Python doesn't have variables.
>>
>>Python has objects of various types.  You can bind 0 or more
>>names an object.
> 
> I frequently use "variable" as a synonym for "name" when talking about
> Python code. Do people think I am wrong to do so?

It depends on context and audience. If you're talking about Python code
with other relatively experienced Pythonistas, no I don't think it's
wrong. When you're talking about Python versus other languages where
"variable" corresponds with "a possibly typed memory location", or
you're talking with someone who is coming from such a language, then
it's probably best to talk about names and objects. Such pedantry is
useful in the latter cases but not so much in the former.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Python-list mailing list