[Python-Dev] Complexity documentation request
Dimitrios Apostolou
jimis at gmx.net
Sat Mar 15 12:25:53 CET 2008
Correcting myself:
Dimitrios Apostolou wrote:
> Hi,
>
> I just dug into the source code looking for complexity of set
> operations. In the wiki page I documented an interesting finding, that
> it is different to do s-t and s.difference(t). It is also interesting
it is different to do s-t than s.difference_update(t), as fas as
complexity is involved. The first one is O(len(s)) while the second is
O(len(t)) (I *think so, I may have missed lots of things in the source
code).
> that you can do the first only for sets, but the second for every
> iterable in t.
>
> Are these portable characteristics of the python language or just
> implementation specific details? In addition, can someone explain me the
I just found it documented in the library reference, that s.method() can
accept any iterable while s-t can't. So I guess it is a language
characteristic.
> usefulness of the loop starting with 'if (PyDict_CheckExact(other))' in
> set_difference()? As I understand it set_difference() is always called
> with two sets as arguments (set_sub() does the actual call).
>
> I'm just trying to figure out the complexity of the other set
> operations, but things get more complicated. I'd appreciate your help.
>
>
> Thanks,
> Dimitris
P.S. Who is the wiki admin? I'm desperately trying to improve the looks
of tables (Add border, remove the <p> element from every cell) but I
can't. I think that the page stylesheet needs to be modified, for
starters...
More information about the Python-Dev
mailing list