[Bf-python] API style clarification

Campbell Barton cbarton at metavr.com
Mon Dec 25 02:00:24 CET 2006


Stephen Swaney wrote:
> On Sun, Dec 24, 2006 at 08:22:29AM -0800, Ken Hughes wrote:
>> Campbell Barton wrote:
>>> campbellbarton (Campbell Barton) 2006/12/24 04:25:53 CET
>>>
>>>  Modified files:
>>>    blender/source/blender/python/api2_2x/doc Camera.py 
>>>  
>>>  Log:
>>>  added camera.dofDist to the python camera module
>> Was looking over this commit and say Cam added a .dofDist attribute and 
>> getDofDist()/setDofDist().  What's the "policy" on attributes vs 
>> methods?  I've only been adding methods when they aren't simple enough 
>> to be getseters (i.e, multiple parameters, etc).
>>
>> I'm not trying to critisize Cam's commit; I was thinking maybe I've been 
>> wrong by not commiting get()/set() methods when I should be.
>>
>> Ken
> 
> No, you are correct, Ken.  We want to migrate away from methods
> for getting and assigning to attributes.  As you point out,
> we will still need methods for doing fancey things, but tp_getset
> tables are the general rule.
> 

Agree, went against the grain to have get/set, but I thought it better 
to be consistent with current API.
Also its not as simple since this has not been moved to getsetattrs yet.
can remove get/set but in that case it would be one of the few (only?) 
functions that is an attribute but not a method.

-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241



More information about the Bf-python mailing list