I don't think that's sufficient.  See how many methods the author of
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/283455 had to
redefine.

Rob Williscroft wrote:
> John Henry wrote in news:1164494606.514366.124810
> @l39g2000cwd.googlegroups.com in comp.lang.python:
>
> > I believe the standard dictionary should be amened to allow the use of
> > case insensitive keys - as an option.
>
> class idict( dict ):
>
>   class __istr( str ):
>
>     def __eq__( self, other ):
>       return self.lower() == other.lower()
>
>     def __hash__( self ):
>       return self.lower().__hash__()
>
>   def __setitem__( self, k, v ):
>     dict.__setitem__( self, idict.__istr( k ), v )
>
> d = idict( a = 1, b = 2 )
> d['A'] = 3
> 
> print d
> 
> Rob.
> -- 
> http://www.victim-prime.dsl.pipex.com/

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to