Vocabulary and notes from the book. Just started it today. It’s awesome.
mutable: object whose state can be changed after its creation.
>>> a=9
>>>print(a)
9
>>> a=11
>>>print(a)
11
immutable: object whose state cannot be changed after it’s creation.
Variables are just names, like a label you put on a drawer if you’re organizing your craft room. They reference the object, but aren’t the object themselves. (mind blown) They don’t hold the object, or store the object, or copy the object, they reference it. (again, mind blown).
class: the definition of an object. i.e. (in Python 3)
>>>type(a)
<class 'int'>
>>>type('abc')
<class 'str'>
in python 2.7, it doesn’t say class, it says:
>>>type(a)
<type 'int>
They’re more or less the same thing.
More to come later.
Fun fact: open a Python shell, and run:
import this
And enjoy your moment of Python Zen :)