tuple creation in C extensions

Jeremy Hylton jeremy at beopen.com
Wed Jun 14 09:13:52 EDT 2000


>>>>> "JvR" == Just van Rossum <just at letterror.com> writes:

  JvR> At 6:10 PM -0400 13-06-2000, Jeremy Hylton wrote:
  [two ways to build a tuple omitted]
  >> This is a shorter-to-write, slower-to-run version.  If you use
  >> Py_BuildValue, the code has to parse the format string in order
  >> to build the object.  If you are coding in C because you're
  >> trying to speed up a speed-critical part of your program, the
  >> code you posted is the better way.

  JvR> On the other hand, creating tuples is probably not often
  JvR> something one does inside an inner loop...

Yes, in which case Py_BuildValue is fine.

Jeremy






More information about the Python-list mailing list