[pygccxml-development] Properties vs methods
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <ba...@ir...> - 2006-03-31 16:50:01
|
Hi, I just noticed a disadvantage of using attributes (properties) instead of method calls for things like decorating declarations. The problem is that things like typos in the source code do not get noticed because this will just attach a new attribute to the declaration instead of producing an error. A line like m.callpolicies = return_self() looks as if it would assign a policy to a method m, but it doesn't because the attribute is misspelled. This error is quite hard to find. A method call on the other hand results in an attribute lookup which raises an exception when the attribute doesn't exist (or when it's not callable). - Matthias - |