Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Read my second comment on the main post. I come from C++ side, not Java, but I guess they're pretty much the same. I actually have like 15 lines of code in my setter, I just wrote a quick example for the sake of the question. So this again didn't answer my actual question, but I guess I should blame myself for giving a bad example code :P Commented Nov 18, 2012 at 19:33
  • What you have gotten from your simple example is The Conventional Wisdom on using properties in Python: "Don't do it until you need to." If all your getter is doing is return self._name, then just access self._name in your setter, and avoid an unnecessary function call. If you later need to add behavior to the getter as well and if this behavior is significant from within the setter, you are probably close enough to the setter code to track down the offending direct references to self._name. Commented Nov 18, 2012 at 19:42