The ICPO rule is what determines how attribute and method lookup work.
More precisely, it is the ICPO rule that tells Python where to look for attributes and methods in your objects.
This is relevant because everything in Python is an object.
More precisely, it is the ICPO rule that tells Python where to look for attributes and methods in your objects.
This is relevant because everything in Python is an object.
Now, the ICPO rule tells you exactly where to look for attributes and methods when you use the dot syntax like in `rodrigo.name`.
The attribute `name` isn't just floating around in the cloud 🤪…
It must be stored somewhere!
The attribute `name` isn't just floating around in the cloud 🤪…
It must be stored somewhere!
The built-in `vars` shows all the instance-specific attributes and methods.
But wait, where did `greet` go?!
`greet` is there…
It just doesn't belong to the instance!
It belongs to the class `Person`! (Spoiler: C in ICPO…)
But wait, where did `greet` go?!
`greet` is there…
It just doesn't belong to the instance!
It belongs to the class `Person`! (Spoiler: C in ICPO…)
(By the way, if you want to learn more about `vars` you can read this short article 👇)
mathspp.com
mathspp.com
By the way, I first wrote about this on my newsletter “Mathspp Insider 🐍🚀”.
You can subscribe here to not miss future issues:
insider.mathspp.com
You can subscribe here to not miss future issues:
insider.mathspp.com
That's it!
I hope you enjoyed learning about the I in the ICPO rule!
If you enjoyed this thread:
👉 follow me @mathsppblog for more Python 🐍 knowledge; and
👉 retweet the tweet below to share this thread with your audience! 🚀
I hope you enjoyed learning about the I in the ICPO rule!
If you enjoyed this thread:
👉 follow me @mathsppblog for more Python 🐍 knowledge; and
👉 retweet the tweet below to share this thread with your audience! 🚀
Loading suggestions...