## Some commonly used variable naming styles
# 1. camel casing names (preferred for variable names)
# myVar, myString42, rawData
# 2. capital camel casing names (preferred for class names)
# MyVar, MyString30, FileData
# 3. snake casing names (preferred for variable/function names)
# my_var, my_string12, some_data3
# Note: I use 'my_<data_type>' names throughout the book just
# for simplicity, don't use such names in real world projects.
## Dynamically typed: Type checking.
# the type is checked only at run-time
if False:
30 + "some string"
# Above statement should raise a 'TypeError' but it will not,
# because that condition is never executed, if it did it will
# raise the exception, try with 'if True'
## Dynamically typed: Assigning a name (variable) to the object.
my_var = 34
my_var = "I am string"
my_var = [1, 2, 3, 4]
my_var = 4.0
# here we are assigning a name 'my_var' to 34,
# now changing it to point to another type is simple as assigning
# it is a new value, so we change it to string next, then a list.
# All of them are valid, as variables don't have types
# Note: Python is garbage collected (auto memory management),
# so any object that doesn't have a reference is automatically
# removed from the memory by the Python Interpreter
# For example, 34 is collected as after 'my_var' is assigned to 'I am string'
## Variables are just references/pointers
a = 34
b = a
a = "ss"
print(a, b) # 'ss', 34
# Here, 'a' was pointing to 34, we assigned 'a' to 'b',
# which means now 'b' also refers to 34 (and not 'a')
# so changing 'a' to 'ss' doesn't affect 'b', it still points to 34