On Saturday 19 March 2016 04:42:29 Chris Angelico wrote: > 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
And my obvious question is, does python have such a construction as ]var[ ? Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> -- https://mail.python.org/mailman/listinfo/python-list