this post was submitted on 04 Nov 2024
106 points (94.2% liked)
Programmer Humor
41326 readers
127 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I find setters/getters are generally an antipattern because they obfuscate behavior. When you access a field you know what it looks like, but if you pass it through some implicit transformation in a getter then you have to know what that was.
lol yeah that sounds like a nightmare
Aren’t setters and getters discouraged in Python?
I remember reading something like, “This isn’t C++ , and Python doesn’t have private vars. Just set the var directly.”