On 12/11/2014 09:34 AM, Mateusz Loskot wrote:
> 
> def is_<whatever_you_are_testing_for>():
>  pass
> 
> like 'is_even'.
> 
> Should I define it as a classic method
> 
> def is_even(self):
>     pass
> 
> or as a property
> 
> @property
> def is_even(self):
>     pass
> 
> So, a classic method or a property, which one is the Pythonic 3 way for
> such member predicates?

Generally, attributes (and properties look like attributes) are for items that 
the object already knows the answer to,
and methods are for things that need to be calculated, and may change 
throughout the life of the object.

--
~Ethan~

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to