Did pylint's support for collections.namedtuple regress, or am I doing
something silly?

This code shows what I'm talking about:

  #!/usr/local/cpython-3.5/bin/python3

  # pylint: disable=superfluous-parens

  '''Test if pylint can see into namedtuples yet'''

  from __future__ import print_function

  import collections

  class SimpleClass(object):
      '''Just a container: used to test if pylint sees we have no jkl
member'''
      def __init__(self):
          self.abc = 5
          self.ghi = 6

  def main():
      '''Main function'''
      named_tuple = collections.namedtuple('named_tuple', field_names='abc
ghi')
      named_tuple.abc = 5
      named_tuple.ghi = 6
      print(named_tuple.abc)
      print(named_tuple.ghi)
      # This tracebacks, without a pylint warning
      print(named_tuple.jkl)

      simple_class = SimpleClass()
      print(simple_class.abc)
      print(simple_class.ghi)
      # pylint catches this one!
      print(simple_class.jkl)

  main()

I'm using:

$ /usr/local/cpython-3.5/bin/pylint --version
No config file found, using default configuration
pylint 1.5.4,
astroid 1.4.4
Python 3.5.0 (default, Feb  8 2016, 13:56:41)
[GCC 4.8.4]

Should I be doing something differently?

If it is a bug, where should I report it? I googled for about twenty
minutes trying to find The Right Place, but came up with nothing.

Thanks for the great tool!

-- 
Dan Stromberg
_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to