[PyQt] Python or Qt/C++ property style

Georg Altmann george at george-net.de
Fri Nov 7 11:24:42 GMT 2008


Hello,

I am thinking about wether I should use python properties in my code. As 
PyQt is currently following Qt style (getter: property(), setter: 
getProperty()), I am a bit undecided.

Benefits of python properties from my point of view:

1. Code is more expressive (readability).

Drawbacks:

1. Classes derived from Qt classes mix python and Qt property style 
(inconsistent).
		
2. One more design decision to worry about: Is this a methos or is it a 
(readonly) property? You also have to remember this in the client code.

3. Python properties do not natively support getter/setter overriding in 
subclasses.
(I know there are ways around this, but I'd rather stick with what 
standard python provides.)

4. Bloats class definition (extra line for property()).

What do you think?

Regards
Georg



More information about the PyQt mailing list