New submission from Ohad Shemesh <ohadsu...@gmail.com>:

A have a simple scenario in which I have a class with some initialized 
attribute that I want to be able to reset again. 
In order to avoid code duplication I'd to to something like this - 

class A:
    def __init__(self):
        self.reset()

    def reset(self):
        self.ls: List[datetime] = []

However this behavior makes the linter (in my case in pycharm) say "instance 
attribute defined outside __init__".
I think it'd be for the better if the linter allows this kind of definition if 
the function (i.e reset) is called in __init__.

----------
components: Parser
messages: 393568
nosy: lys.nikolaou, ohadsunny, pablogsal
priority: normal
severity: normal
status: open
title: let linter allow defining attribute outside __init__ if called in 
__init__
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44122>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to