quantifiedcode / python-anti-patterns

An open collection of Python anti-patterns and worst practices.
https://quantifiedcode.github.io/python-anti-patterns
Other
1.71k stars 249 forks source link

java style getters and setters #94

Closed cg-cnu closed 8 years ago

cg-cnu commented 8 years ago

In this link

shouldn't it be self.length = length instead of self._length = length in the class initialization?

adewes commented 8 years ago

@cg-cnu yeah one could do it like that, probably even makes more sense than assigning this directly because that's why the property is there in the first place (the example is a trivial one though so it doesn't matter there). Feel free to fix it an open A PR :smile: