Python Class vs Object: Understanding the Difference

Although it may not be a big deal in other object oriented language to know the difference between Class and Object, it is a big deal in Python. This is especially evident and important when using libraries and/or frameworks that expects you to pass a callback function as one of the arguments to its own function or method. Why Python? Cause Python expects an extra "self" parameter to be passed in instance methods that other PLs don't. You'll encounter this unique behavior when you pass a class, instead of an object, along with the callable as this is a function (not a method) that expects "self", thus you get too many arguments, expected "n" arguments but got "n+1"... type of error, because of that extra argument being passed by Python. And this is why I always tell people that I mentor to not ignore or skip the basics or essentials, as this knowledge becomes critically valuable in most edge cases. #python #class #object

Thanks Dennis. This is a wealth of experience that needs to be told.

To view or add a comment, sign in

Explore content categories