quot;Dog"
>
> If you do:
>
> Py> pets['Cat'] = 2
> Py> pets['Dog'] = 3
> Py> pets['DOG'] = 4
> Py> pets['cat'] += 5
> Py> pets.keys()
>
> What should the result be?
>
> "['Cat', 'Dog
John Henry wrote:
> I believe the standard dictionary should be amened to allow the use of
> case insensitive keys - as an option. I found some work done by others
> to do that at:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/283455
>
> but the problem with that approach is that th
sult be?
"['Cat', 'Dog']" or "['cat', 'DOG']"?
That is to say, if you use a new case in redefining the values of your
case insensitive dictionary, does the key take on the new case, or will
it always and forever be the case originally given to it?
Cheers,
Cliff
--
http://mail.python.org/mailman/listinfo/python-list
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 s
John Henry napisal(a):
> I believe the standard dictionary should be amened to allow the use of
> case insensitive keys - as an option. I found some work done by others
> to do that at:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/283455
>
> but the problem with that approach is tha
John Henry wrote:
> I believe the standard dictionary should be amened to allow the use of
> case insensitive keys - as an option. I found some work done by others
> to do that at:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/283455
>
> but the problem with that approach is that th
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 ):
I believe the standard dictionary should be amened to allow the use of
case insensitive keys - as an option. I found some work done by others
to do that at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/283455
but the problem with that approach is that they lowercase the keys
immediate