[Bf-python] PySequence_Fast() usage

Ken Hughes khughes at pacific.edu
Wed Jan 11 04:50:50 CET 2006


Was looking at converting Mesh to accept sequences instead of only 
tuples and looked at PySequence_Fast() and its relatives like 
PySequence_Fast_GET_ITEM().  As I read the 2.4 C API, it seems like I 
should be able to use PySequence_Fast_GET_ITEM() on a list or tuple 
since calling PySequence_Fast() with a list or tuple will just return 
the original object with its refcount incremented.  (I've verified that 
this is in fact the case some simple test code).

PySequence_Fast_GET_ITEM() seems better than PySequence_GetItem() or 
PySequence_ITEM() since the latter two return new references.  But am I 
overlooking some possible non-list and non-tuple sequence that could be 
passed to Mesh, and would this be relying on an undocumented side-effect 
which might bite me later?

Ken




More information about the Bf-python mailing list