On 15/05/18 15:29, Mike McClain wrote:
On Sun, May 13, 2018 at 07:10:11PM -0400, Richard Damon wrote:
On 5/13/18 4:02 PM, Mike McClain wrote:
I'm new to Python and OOP.
Python  en 2.7.14 Documentation  The Python Language Reference
3. Data model
3.1. Objects, values and types
An object's type is also unchangeable. [1]
[1]     It is possible in some cases to change an object's type,
     under certain controlled conditions.

It appears to me as if an object's type is totally mutable and
solely dependant on assignment.

obj = 'a1b2'
obj
'a1b2'
<snip>
At what level does my understanding break down?
<snip>

The first this is obj is NOT 'the object', but is instead a reference
that 'points' to an object.

Many thanks to those teachers who responded.

I think I got it.
The variable is not the object just as the name is not the thing.

I had gotten the impression that everything in OOP is an object but
you're all saying that variables are not objects.

Does a variable have a type?
If so what is the type of a variable and how is that demonstrated
if 'type()' reports what the variable points to?

Variables don't have types, or indeed anything much. They are just names, that's all. Every time you use the name, you get the object the name references (or "is bound to" as some people prefer to phrase it).

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to