← Back to team overview

divmod-dev team mailing list archive

[Bug 812958] [NEW] property decorator -> redefinition of function

 

Public bug reported:

Code from: http://docs.python.org/library/functions.html#property

-------------------------------------- foo.py

class C(object):
    def __init__(self):
        self._x = None

    @property
    def x(self):
        """I'm the 'x' property."""
        return self._x

    @x.setter
    def x(self, value):
        self._x = value

    @x.deleter
    def x(self):
        del self._x

---------------------------------------------

pyflakes output is

$ pyflakes foo.py
foo.py:11: redefinition of function 'x' from line 6
foo.py:15: redefinition of function 'x' from line 11

** Affects: pyflakes
     Importance: Undecided
         Status: New


** Tags: decorator property redefinition

** Description changed:

  Code from: http://docs.python.org/library/functions.html#property
  
  -------------------------------------- foo.py
  
  class C(object):
-     def __init__(self):
-         self._x = None
+     def __init__(self):
+         self._x = None
  
-     @property
-     def x(self):
-         """I'm the 'x' property."""
-         return self._x
+     @property
+     def x(self):
+         """I'm the 'x' property."""
+         return self._x
  
-     @x.setter
-     def x(self, value):
-         self._x = value
+     @x.setter
+     def x(self, value):
+         self._x = value
  
-     @x.deleter
-     def x(self):
-         del self._x
+     @x.deleter
+     def x(self):
+         del self._x
  
  ---------------------------------------------
  
  pyflakes output is
  
  $ pyflakes foo.py
- deco.py:11: redefinition of function 'x' from line 6
- deco.py:15: redefinition of function 'x' from line 11
+ foo.py:11: redefinition of function 'x' from line 6
+ foo.py:15: redefinition of function 'x' from line 11

-- 
You received this bug notification because you are a member of Divmod-
dev, which is the registrant for Pyflakes.
https://bugs.launchpad.net/bugs/812958

Title:
  property decorator ->  redefinition of function

Status in Pyflakes:
  New

Bug description:
  Code from: http://docs.python.org/library/functions.html#property

  -------------------------------------- foo.py

  class C(object):
      def __init__(self):
          self._x = None

      @property
      def x(self):
          """I'm the 'x' property."""
          return self._x

      @x.setter
      def x(self, value):
          self._x = value

      @x.deleter
      def x(self):
          del self._x

  ---------------------------------------------

  pyflakes output is

  $ pyflakes foo.py
  foo.py:11: redefinition of function 'x' from line 6
  foo.py:15: redefinition of function 'x' from line 11

To manage notifications about this bug go to:
https://bugs.launchpad.net/pyflakes/+bug/812958/+subscriptions


Follow ups

References