[Bf-python] Python 2.2 Type API changes

Yann Vernier yann at algonet.se
Mon Jul 19 05:07:51 CEST 2004


On Sun, Jul 18, 2004 at 09:09:40PM -0400, Joseph Gilbert wrote:
> Looks interesting. My only complaint is that it assumes that you always have
> a function to call for geattr/setattr variables. I guess this would mean
> spliting the getattr and seattr members into a bunch of functions. It looks
> cleaner than the current implementation (although maybe a bit more
> confusing).

Well, with tp_members you can avoid writing those functions, but then
you're limited to fields that are part of the structure the PyObject is
the head of. Wouldn't work for the BPy_Object since it's actually using
indirection through a pointer to Object. Other types, such as NMCol,
might have no such problem. The functions also help in cases we want to
perform checks or react to the values, i.e. ensuring that name is a
string or updating dependent values. The length of a Vector is an
example of where there is no memory position for the value in the first
place and a function is needed.

-- 
PGP fingerprint = 9242 DC15 2502 FEAB E15F  84C6 D538 EC09 5380 5746
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20040719/a8beb395/attachment.sig>


More information about the Bf-python mailing list