On Jan 17, 6:51 pm, nn <prueba...@latinmail.com> wrote:
> I somehow missed this before. I like most of the additions from
> Raymond Hettinger. But the api on this baffles me a bit:
>
> >>> d = OrderedDict.fromkeys('abcde')
> >>> d.move_to_end('b', last=False)
> >>> ''.join(d.keys)
>
> 'bacde'
>
> I understand that "end" could potentially mean either end, but would
> "move_to_end" and "move_to_beginning" not have been clearer?

It's a minor issue, but I'd tend to lean that way.  Most other times
when something can happen on one end of a sequence or another, it uses
different function calls.  E.g.: startswith vs endswith, lstrip vs
rstrip, and even pop vs popleft.

Oddly, Hettinger seems to be a big advocate of not overloading
functions.


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

Reply via email to