[Python-projects] pylint/astng feature request: namedtuple support

Vincent Legoll vincent.legoll at gmail.com
Thu Mar 26 01:00:59 CET 2009


pylint was failing to detect such cases on meld code (meld.sf.net)

from misc.py:

class struct(object):
    """Similar to a dictionary except that members may be accessed as s.member.

    Usage:
    s = struct(a=10, b=20, d={"cat":"dog"} )
    print s.a + s.b
    """
    def __init__(self, **args):
        self.__dict__.update(args)
    def __repr__(self):
        r = ["<"]
        for i in self.__dict__.keys():
            r.append("%s=%s" % (i, getattr(self,i)))
        r.append(">\n")
        return " ".join(r)
    def __cmp__(self, other):
        return cmp(self.__dict__, other.__dict__)

uses of instances of this class are flagged as errors

-- 
Vincent Legoll


More information about the Python-Projects mailing list