Monday, 9 September 2013

Python properties best practice, a function inside a property

Python properties best practice, a function inside a property

Is it a good practice to have properties that are the result of very basic
operations? For example, let's say we have properties 'a' and 'b' and we
can directly infer property 'c' from 'a' and 'b'. Is this considered bad
coding style?
@property
c(self):
return self.a + self.b
Thanks!

No comments:

Post a Comment