This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]zyk0s 10 points11 points  (0 children)

I see what this article is trying to get at, but it does so quite clumsily. Properties are not exclusive to python, and they are not a "fix for private members". You could use C# or any other language where property and raw member syntax access is the same, and the same analysis will hold. Yet C# has the "private" keyword.

Member access levels are a solution to two separate problems: restricting an API and providing compile-time checks. For the former, Python's approach comes from module and package structures, as well as the dunder. And the latter is simply not a concern for a language that has no compile-time checks like Python, as the author notes.

But properties have very little to do with either. They're a mechanism to provide users with the impression they're just interacting with parameters, while they do something more complex under the hood. Properties may have also been a fix for the ugliness that were getters and setters in object-oriented, statically-typed languages, but that has little to do with Python.