Case insensitive dict

J

Joseph L. Casale

I was doing some work with the ldap module and required a ci dict that was case
insensitive but case preserving. It turned out the cidict class they implemented was
broken with respect to pop, it is inherited and not re implemented to work.Before
I set about re-inventing the wheel, anyone know of a working implementation?

I noticed twisted has one but it seems to omit pop.

Thanks!
jlc
 
S

Steven D'Aprano

I was doing some work with the ldap module and required a ci dict that
was case insensitive but case preserving. It turned out the cidict class
they implemented was broken with respect to pop, it is inherited and not
re implemented to work. Before I set about re-inventing the wheel,
anyone know of a working implementation?

class my_cidict(ldap.cidict):
"""Fix problems with pop."""
def pop(self):
# insert code here


You don't have to re-invent the entire wheel just to fix one broken
spoke :)

Other than that, no, I don't know of any case-insensitive but preserving
dicts. If you do decide to write one from scratch, please consider
releasing it as Open Source (I recommend GPL or MIT licences), either as
a module on PyPI or as a recipe on ActiveState.

https://pypi.python.org/pypi
http://code.activestate.com/recipes/langs/python/



Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top