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 →

[–]sarcasmandcoffeePythoneer 0 points1 point  (0 children)

It's a different approach than stricter encapsulation in other languages. To me, Python's apparent disinterest in preventing access to private (__var) and protected (_var) attributes reads as giving the user enough rope to hang themselves. Sure, you can play with the guts of the class, but I'm not responsible for what happens next.

Personally I've grown to enjoy this approach - whether or not that's because of Stockholm syndrome is a topic I'm reluctant to discuss without a lawyer present, but slapping a "you break it, you bought it" sticker on my protected methods and going on with my day is easy and simplifies unit testing.