lets say I have 2 strings that are interchangeable, like a full word and it's abbreviation: 'max' and 'maximum'
I would like to set it so that they respond the same, for example if i have the following dictionary:
d = {'max':10,'a':5,'b':9}
d['maximum'] will return 10
is this even remotely possible?
note:
these two strings could be 'dog' and 'cat', they do not have to be related.
what I am asking is if I could do something like:
a = 'a' or 'b'
that way the two strings are interchangeable. I do understand that above is not correct syntax, I am just curious if anything like it is possible
"max"and"maximum"aren't the same string. You could subclass dict and make sure to only use one or the other ... but that only catches the dictionary case (and it doesn't work with literals)....tryandexcepts