dicts + amb

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Oct 11 23:10:17 CEST 2006

I have implemented yet another Odict class:
It's very slow, but it is O(1) for get, set and del too.

I have added ritervalues(), rkeys(), etc methods because I presume I
can't use the reversed(). So can an __riter__ hook be generally useful?
(I have seen few comments about it in the discussion regarding PEP

What's the meaning of .updated() called without arguments? Can it
become an error in Python 3.0?

In practice I don't have problems using dict get() and pop() methods,
but their calling behaviour seem a bit incoherent. Both accept a second
value, that can be None too, that they return if the key is absent, but
the get() returns the None even if you don't specify it, while pop()
return a TypeError if you don't give explicitely something (like None)
as second argument. (Maybe in practice they are more useful if kept
with such different calling behaviour.)


Something unrelated that I don't know where to put.
Recently I have seen the amb operator, it's not a simple operator. I
have seen a (very simple) Ruby implementation:
I think a good amb implementation is a very complex thing. Can such
operator be useful for Python too?


More information about the Python-list mailing list