<div dir="ltr">On 12 September 2013 02:03, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 09/11/2013 08:49 AM, Victor Stinner wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2013/9/11 Ethan Furman <<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
He isn't keeping the key unchanged (notice no white space in MAPPING), he's<br>
merely providing a function that will automatically strip the whitespace<br>
from key lookups.<br>
</blockquote>
<br>
transformdict keeps the key unchanged, see the first message:<br>
<br>
    >>> d = transformdict(str.lower)<br>
    >>> d['Foo'] = 5<br>
    >>> d['foo']<br>
    5<br>
    >>> d['FOO']<br>
    5<br>
    >>> list(d)<br>
    ['Foo']<br></blockquote></div></blockquote><div> </div><div>That seems backwards to me. I would think that retrieving the keys from the dict would return the transformed keys (I'd call them canonical keys). That way there's no question about which key is stored - it's *always* the transformed key.</div>
<div><br></div><div>In fact, I think this might get more traction if it were referred to as a canonicalising dictionary (bikeshedding, I know).</div><div><br></div><div>Tim Delaney</div></div></div></div>