namedtuples bug between 3.3.2 and 3.4.1
Hi. I am using Python 3.4.1 installed with Anaconda. I tried the following (expecting an OrderedDict as result):
from collections import namedtuple NT = namedtuple("NT",["a","b"]) nt = NT(1,2) print(vars(nt)) {}
so the result is an empty dict. In Python 3.3.2 (downgraded in the same Anaconda environment) results in:
print(vars(nt)) OrderedDict([('a', 1), ('b', 2)])
I haven't looked at the source code, I can do that later in the week and see if I can pinpoint where this is happening. But any suggestions what and where to fix this would be good :) Cheers, Brynjar
On Sun, Sep 14, 2014 at 8:13 PM, Brynjar Smári Bjarnason
I am using Python 3.4.1 installed with Anaconda. I tried the following (expecting an OrderedDict as result):
from collections import namedtuple NT = namedtuple("NT",["a","b"]) nt = NT(1,2) print(vars(nt)) {}
so the result is an empty dict. In Python 3.3.2 (downgraded in the same Anaconda environment) results in:
print(vars(nt)) OrderedDict([('a', 1), ('b', 2)])
For what it's worth, I can't reproduce the issue on trunk CPython (built from default branch on Aug 21, so it's a little old now), nor on 3.4.1 as currently shipping with Debian Jessie, nor with 3.4.0 on Windows. So this may be an Anaconda issue. Do you know if it's meant to be a patched install of Python? ChrisA
On Mon, 15 Sep 2014 02:13:53 +1000
Chris Angelico
On Sun, Sep 14, 2014 at 8:13 PM, Brynjar Smári Bjarnason
wrote: I am using Python 3.4.1 installed with Anaconda. I tried the following (expecting an OrderedDict as result):
from collections import namedtuple NT = namedtuple("NT",["a","b"]) nt = NT(1,2) print(vars(nt)) {}
so the result is an empty dict. In Python 3.3.2 (downgraded in the same Anaconda environment) results in:
print(vars(nt)) OrderedDict([('a', 1), ('b', 2)])
For what it's worth, I can't reproduce the issue on trunk CPython (built from default branch on Aug 21, so it's a little old now), nor on 3.4.1 as currently shipping with Debian Jessie, nor with 3.4.0 on Windows. So this may be an Anaconda issue. Do you know if it's meant to be a patched install of Python?
There may be a couple distutils-specific patches, but that's all. Anaconda issues should be reported at https://github.com/ContinuumIO/anaconda-issues/issues/ Regards Antoine.
FWIW I cannot reproduce the bug with Anaconda's Python 3.4.1 (from a miniconda install): $ python Python 3.4.1 |Continuum Analytics, Inc.| (default, Sep 2 2014, 14:00:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux Type "help", "copyright", "credits" or "license" for more information.
from collections import namedtuple; vars(namedtuple("T", "a b")(1, 2)) OrderedDict([('a', 1), ('b', 2)])
Antony
2014-09-14 9:27 GMT-07:00 Antoine Pitrou
On Mon, 15 Sep 2014 02:13:53 +1000 Chris Angelico
wrote: On Sun, Sep 14, 2014 at 8:13 PM, Brynjar Smári Bjarnason
wrote: I am using Python 3.4.1 installed with Anaconda. I tried the following (expecting an OrderedDict as result):
from collections import namedtuple NT = namedtuple("NT",["a","b"]) nt = NT(1,2) print(vars(nt)) {}
so the result is an empty dict. In Python 3.3.2 (downgraded in the same Anaconda environment) results in:
print(vars(nt)) OrderedDict([('a', 1), ('b', 2)])
For what it's worth, I can't reproduce the issue on trunk CPython (built from default branch on Aug 21, so it's a little old now), nor on 3.4.1 as currently shipping with Debian Jessie, nor with 3.4.0 on Windows. So this may be an Anaconda issue. Do you know if it's meant to be a patched install of Python?
There may be a couple distutils-specific patches, but that's all. Anaconda issues should be reported at https://github.com/ContinuumIO/anaconda-issues/issues/
Regards
Antoine.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/antony.lee%40berkeley.edu
participants (4)
-
Antoine Pitrou
-
Antony Lee
-
Brynjar Smári Bjarnason
-
Chris Angelico