[New-bugs-announce] [issue16279] namedtuple should compare equality with field names taken into account

Julian Berman report at bugs.python.org
Thu Oct 18 21:59:43 CEST 2012


New submission from Julian Berman:

I find the following to be unintuitive:

Python 3.3.0rc1 (default, Sep  6 2012, 16:02:32) 
[GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.58)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from collections import namedtuple
>>> F = namedtuple("F", "x")
>>> G = namedtuple("G", "y")
>>> F(12) == G(12)
True

I'm OK with not taking the class name into account, that sounds reasonable, but I think field names should make those unequal.

----------
components: Library (Lib)
messages: 173292
nosy: Julian, rhettinger
priority: normal
severity: normal
status: open
title: namedtuple should compare equality with field names taken into account
type: enhancement
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16279>
_______________________________________


More information about the New-bugs-announce mailing list