Python style of accessing bools?

Jonathon McKitrick jcm at FreeBSD-uk.eu.org
Thu Apr 15 09:18:49 EDT 2004


I'm trying to avoid leftover C-style in my new Python programs.

If a class has a boolean property, and I am branching based on that
property, which of these is preferred?

if MyClass.boolProp:
	<continue>

OR

if MyClass.IsTrueProp():
	<continue>

In other words, do you use accessors or just access the variable directly?

jm
-- 
My other computer is your Windows box.




More information about the Python-list mailing list