object types, mutable or not?
Mike McClain
mike.junk.46 at att.net
Tue May 15 10:29:39 EDT 2018
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?
Thanks,
Mike
--
Men occasionally stumble over the truth, but most of them pick
themselves up and hurry off as if nothing ever happened.
- Churchill
More information about the Python-list
mailing list