[Python-Dev] PySet API
Raymond Hettinger
raymond.hettinger at verizon.net
Thu Mar 30 06:09:45 CEST 2006
[Raymond Hettinger]
> > Barry, go ahead with PySet_Clear().
[Barry]
Cool thanks. I think we've also compromised on _PySet_Next(), correct?
Yes, _PySet_Next() is a good compromise for you and me -- it saves you from
writing a hack and saves my API from including a bug factory. The only issue is
that Martin thinks it to be a crummy idea. Personally, I have no problem with
putting-in an undocumented hook for daring people who aspire to swim in
quicksand ;-)
[Raymond Hettinger]
> > The story is different for PySet_Update(). Defining it now could get in the
> > way
> > of possible future development for the module (the function may end-up
> > taking a
> > variable length argument list instead of a single argument).
>
> So why not just go ahead and do that now? If you know that's what you
> want eventually, why wait? From my perspective, adding a NULL at the
> end of the argument list wouldn't be that big of a deal.
[Barry]
> BTW, I'm willing to do the work on this. I'm already going to update my
> patch anyway to reflect our current decisions, so I'm happy to do this
> while I'm at it. I'll try to get a new patch posted in a day or so.
The idea is not yet ready for prime-time. If I do it for one of the named
operations, I will do it for all (to keep the interface uniform). I haven't yet
had the time to work-out the math on whether it would be worthwhile and provide
some differential advantage over simply repeating the same operation several
times over. My research question is whether work can be saved by controlling
the order of operations -- the concept is somewhat like optimizing multi-term
matrix multiplication where the total work effort can vary dramatically
depending on which matrices are multiplied together first, A((BC)D) vs (AB)(CD)
vs (A(BC))D etc. Put in business terms, the question is whether I'm able to
leverage the associative and commutative properties of some chained set
operations. FWIW, the module already has optimizations to take advantage of
the commutative property of binary AND, OR, and SYMMETRIC_DIFFERENCE operations.
However, the multi-term optimization probably wait until Py2.6 -- it is too
experimental for now.
Raymond
More information about the Python-Dev
mailing list