Skip to content

Files

Latest commit

 

History

History
25 lines (18 loc) · 501 Bytes

property-with-parameters.md

File metadata and controls

25 lines (18 loc) · 501 Bytes

Pattern: Use of property with parameters

Issue: -

Description

Used when we detect that a property also has parameters, which are useless, given that properties cannot be called with additional arguments.

Example of incorrect code:

class Cls:
    @property
    def attribute(self, param, param1): # [property-with-parameters]
        return param + param1

Example of correct code:

class Cls:
    @property
    def attribute(self):
        return self.test