dsc / bunch

A Bunch is a Python dictionary that provides attribute-style access (a la JavaScript objects).
http://github.com/dsc/bunch
MIT License
483 stars 176 forks source link

Iteration order is different with py2 and py3 #22

Open femtotrader opened 9 years ago

femtotrader commented 9 years ago

Hello,

With Python 2.7:

from bunch import Bunch
b=Bunch(foo=Bunch(lol=True), hello=42, ponies='are pretty!')
[ (k,b[k]) for k in b ]

returns

[('ponies', 'are pretty!'), ('foo', Bunch(lol=True)), ('hello', 42)]

but with Python 3.3

[ (k,b[k]) for k in b ]

returns

[('foo', Bunch(lol=True)), ('hello', 42), ('ponies', 'are pretty!')]

So some tests are failing.

femtotrader commented 9 years ago

see http://legacy.python.org/dev/peps/pep-0469/