E
Eric S. Johansson
I apologize if this is an FAQ but googling has not turned up anything,
at least to my keywords.
I need to parse a configuration file from an existing application and
I'm treating it as a dictionary. I created my class with a parent class
of dict. Everything works okay except I discover I need to force keys
to uppercase when setting a value.
I override __setitems__ and, as you'd expect, I get a recursive loop.
I'm obviously missing a clue on how to break the recursion. My
admittedly simpleminded method overloading looks like:
def __setitem__ (self, index, value):
"""force keys to uppercase"""
self[index.upper()] = value
thanks for any pointers.
at least to my keywords.
I need to parse a configuration file from an existing application and
I'm treating it as a dictionary. I created my class with a parent class
of dict. Everything works okay except I discover I need to force keys
to uppercase when setting a value.
I override __setitems__ and, as you'd expect, I get a recursive loop.
I'm obviously missing a clue on how to break the recursion. My
admittedly simpleminded method overloading looks like:
def __setitem__ (self, index, value):
"""force keys to uppercase"""
self[index.upper()] = value
thanks for any pointers.