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

in #dtube7 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)

Coin Marketplace

STEEM 0.21
TRX 0.25
JST 0.039
BTC 98071.85
ETH 3461.24
USDT 1.00
SBD 3.21