On Sat, Mar 19, 2016 at 7:29 PM, Steven D'Aprano <st...@pearwood.info> wrote:
> On Sat, 19 Mar 2016 12:36 pm, Chris Angelico wrote:
>
>> So unpacking will give you those keys - in an arbitrary order. Of
>> course, you don't care about the order when there's only one.
>
> But what if you want the key in reverse order?
>
> # Standard order
> [key] = mydict
>
> # Reverse order
> [yɘʞ] = mydict

Unfortunately, Steven, that won't work - you forgot to invert the
brackets. And no, switching them won't work:

]yɘʞ[ = mydict

You need to have actual backward brackets so Python knows you want to
iterate backward through the dictionary, starting with the last value
and proceeding to the first index.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to