Python — Basic Review before diving deeper 06
Want to recall the memory of Python easily?
This is the note taken while I learned Python “again”, hope it helps you too.
There are additional links in the article for you to understand further information.
Quick tip |
Find ⚡for each topic
☘️Directory
- Object Introspection
- Dunder methods
- Multiple inheritance
- M.R.O
- Functional Programming(F.P.)
- Difference between OOP & FP
❤️Good Resources
Bro code | Python full course
ZeroToMastery | Pyhton
Codes in Github
⚡Object Introspection
More in GeeksforGeeks
🔹An ability to determine the type of an object at runtime.
🔹Everything in python is an object. Every object in Python may have attributes and methods.
🔹We can dynamically examine python objects — GeeksforGeeks
Built-in functions
🔸type()
🔸dir()
🔹str()
🔹id()
🔹hasattr()
🔹getattr()
🔹repr()
🔹callable()
🔹issubclass()
🔹isinstance()
🔹sys()
🔹__doc__
🔹__name__
⚡Dunder
🔹Dunder = Double-Underscore
🔹Also called magic method
Get Yen Wang’s stories in your inbox
Join Medium for free to get updates from this writer.
Some Dunder Methods…
__init__()__repr__()__str__()__new__()
🔸__str__
You can change the default setting by this.
Before changed
After Changed.
🔸__len__()
Set Default Value
🔸del
print in __del__ method
🔸__call__
🔸__getitem__
⚡Multiple Inheritance
Inheritance from multiple classes
Syntax
Another Example.
❌Why is that?
Because we inheritate Wizard first, there is no check_HP function in it.
Now it works.
If we need to sign in first…
⚡MRO
MRO(Method Resolution Order)
More in GeeksforGeeks
This order is also called Linearization of a class and set of rules are called MRO(Method Resolution Order). While inheriting from another class. — GeeksforGeeks
⚡Functional Programming
Concepts including 4,
🔸Pure Functions
🔸Recursion
Use function to
GeeksforGeeks | Difference between Recursion & Iteration
🔸Functions are First-Class and can be Higher-Order
Some commonly used Higher-Order Functions.
🔹map()
🔹filter()
🔸Variables are Immutable
⚡Difference
between OOP & Functional Programming
More in GeeksforGeeks
🔸OOP
- Importance is given to data
- uses loops for iteration
- Data used here are mutable
🔸FP
- Importance is given to functions
- uses recursion for iteration
- Data in the functions are immutable








