bunch
bunch copied to clipboard
Python 3 Support?
Does this Bunch
implementation support Python 3?
I get some test errors with Python 3.4: https://gist.github.com/cdeil/5525c1ee193f1426ee8b
And Python 3 support is not listed via the setup.py
classifiers:
https://pypi.python.org/pypi/bunch/
If it doesn't support Python 3, could you please state this in the README?
I've found this fork by @redodo: https://github.com/redodo/lunch https://pypi.python.org/pypi/lunch
But it also gives test errors on Python 3:
https://gist.github.com/cdeil/fe6c116791c36b980dd1
and has the disadvantage that the lunch
package on PyPI
installs itself as bunch
in site-packages
, which is confusing.
@dsc Would you consider making a new bunch
release if someone makes a pull request that give simultaneous Python 2 / 3 support?
I'm also looking for Python 3 support.
:+1:
+1 (AttributeError: 'dict' object has no attribute 'iteritems') in bunchify(x)
Even Bunch.repr()
is broken on python3:
$ python3
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from bunch import Bunch
>>> a = Bunch(foo=123, bar=456)
>>> a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu/workflow/venv/lib/python3.5/site-packages/bunch/__init__.py", line 200, in __repr__
keys.sort()
AttributeError: 'dict_keys' object has no attribute 'sort'
>>>
This is because the keys()
method in python3 returns an iterator (like iterkeys()
in python2).
Solution: list(whatever.keys())
You might use Munch (from @vmalloc) instead of Bunch https://github.com/Infinidat/munch see https://github.com/dsc/bunch/issues/32
Thanks, I have switched to Munch now. It works fine, except I keep typing Much
by accident :-)
I submitted the fixes for that and my fork is already fixed https://github.com/olivecoder/bunch