[Bf-python] short term goals

Stephen Swaney sswaney at centurytel.net
Tue Jul 19 07:18:06 CEST 2005


For the next phase of the Bpy Cleanup we would like to do two things:

1) remove the inconsistencies in the interface that Willian talked

Examples are using constants instead of passing strings as args and
making sure getters and setters inter-operate.  We will have a wiki
page and forum thread where we can start listing problems and
solutions *before* any code gets changed.

More on this later.


2) start to migrate our attribute handling code to use the tp_getset
interface.

Right now our attribute access is done thru the tp_getattr and
tp_setattr slots in our PyTypeObjects where we lookup string names for
attributes and call the appropriate method.  Since the programmatic
interface here is similar to method calls we have duplicated all
our attribute access with  x.getStuff() / x.setStuff() methods

The difference between tp_getset style and the x.setStuff() is the way
arguments are passed and the return types.  For tp_getset, the
argument is a PyObject pointer.  For the setStuff() style,
that same pyObject argument is wrapped in a tuple.

Since tp_getset is the wave of the future, what we would like to do
here is have the setStuff() methods parse out the pyobject and then
call the appropriate method from the PyGetSetDef table ( the one for
the tp_getset slot ).  Both getStuff() and setStuff() wrappers will
also need to fix up the return type.

This is mostly grunt work, but happily we have a willing victim, errr,
I mean volunteer.  Thanks, Ken!

Right now, for backward compatibility, we will keep the getStuff() 
setStuff() methods unchanged.

When this step is done, the interface will appear unchanged to the
users since all changes are internal.

Later, we will merge the design changes from part #1 into our tp_getset
methods and go forward from there.

-- 
Stephen Swaney			
sswaney at centurytel.net




More information about the Bf-python mailing list