Why: Python Variables, Types, Objects, Mutability & State? (w/ Mnemonics)

in dtube ā€¢Ā  7 years agoĀ 


Get The Full "Learn Python šŸ" Online Course:
http://www.mnemonic.academy/learn-python

The following video is from an online educational course produced by Mnemonic Academy that teaches the basics of Python programming using mnemonics, metaphors and the science of learning titled "Learn Python: Like a Bee Student", taught by instructor Dylan Jorgensen

What's a variable?
For beginners I think it's best to think of them as information tupperware that can scale to fit any object. (Technically reserved memory locations with ID locators)
A variable can contain any characteristic, number, or quantity that can be measured or counted. Like age, room temperature or income are variables because the value may change over time. But not birthday or eye color because they always stay the same.

What are types?
Classifications of variables, grouped by memory usage and structure.
Therefore, by assigning different data types to variables, you can store integers, decimals or characters in these variables.

What does static vs dynamic typing mean?
Static vs dynamic typing is a question about when variable types are checked.
Static typed languages are those in which type checking is done at compile-time, (when you are typing in your code) whereas dynamic typed languages are those in which type checking is done at run-time (When someone uses your program).

What is an object?
Everything is an object: python types, variables, functions, operators, etc...
Python is completely object oriented.

What is an object's identity?
Every object has a unique identifier called its identity.
An object's identity never changes once it has been created, thus it's the object's address in the memory.

What is mutability?
It's a process. I think of it as evolution, but only making partial changes. Some part of the original organism must stay the same. Like the variable name in Python.

What is a variable's state?
State is a term used to refer to this current variable's value.

How do we find its State out if we don't know?
We can wrap the variable in a function or we can use other programmatic methods to ask python what is inside. Then once we run that line of code we can read out the return.


ā–ŗ Watch on DTube
ā–ŗ Watch Source (IPFS)
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!