Kiss my member variables
Student Login

Kiss my member variables

I was thinking about member variables in Python. Lots of weirdness.

Like, for access control. Public versus private versus protected... Compared to other languages, this works completely differently in Python.

And then you have properties.

These are methods defined "around" member variables, to regulate access to them, for validation, and so on. Important pattern, important idiom. Every oh-oh language needs them.

But NO language does them ANYTHING like Python. Python properties are from Mars... Way out there on the weirdness scale.

And then you have scope. Do they belong to the class? To the instance?

Somehow, Python managed to find a location off the map here too. Weird scope rules.

So that's the theme of Python member variables... weirdness. But that's a good thing.

Because that weirdness turns into POWER. It lets you do amazing things with the classes you define in Python. Super useful things.

Newsletter Bootcamp

Book Courses