Case insensitive dict

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed May 22 01:19:52 EDT 2013


On Wed, 22 May 2013 03:59:55 +0000, Joseph L. Casale wrote:

> 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.






-- 
Steven



More information about the Python-list mailing list