Skip to content

issue with enum.Enum.value (@DynamicClassAttribue vs @property) #2306

@RemiCardona

Description

@RemiCardona

Steps to reproduce

from enum import Enum

class Color(Enum):
    red = 1
    green = 2
    blue = 3

    def __lt__(self, other):
        return self.value < other.value
$ pylint -d C testcase_enum.py
************* Module testcase_enum
testcase_enum.py:9:15: W0143: Comparing against a callable, did you omit the parenthesis? (comparison-with-callable)

------------------------------------------------------------------
Your code has been rated at 8.57/10 (previous run: 8.57/10, +0.00)

In python 3.4.2 (debian jessie's python), value is defined like so:

    @DynamicClassAttribute
    def value(self):
        """The value of the Enum member."""
        return self._value_

@DynamicClassAttribue is supposed to be like @property but not quite, according to the docstring. I didn't get too much into it.

pylint --version output

$ pylint --version
pylint 2.0.0
astroid 2.0.0.dev4
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions