New submission from Sebastian Bevc <sebastian.b...@gmail.com>:
Hello, This is my first bug report. While doing some homework i came to realize that the __init__ of a class was taking out of context variables. class Foo(object): def __init__(self, attr1): self.out_of_context = out_of_context # Raises NameError as it is expected foo = Foo('some attr') # 'bar' is bounded to 'out_of_context' although it was initialized # with value 'some value' out_of_context = 'bar' foo = Foo('some value') print(foo.out_of_context') # prints 'bar' ---------- components: asyncio messages: 356277 nosy: asvetlov, sebasbeco, yselivanov priority: normal severity: normal status: open title: __init__ taking out of context variables versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38752> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com