[issue38752] __init__ taking out of context variables

2019-11-08 Thread Eric V. Smith
Eric V. Smith added the comment: Also: you're statement that bar was initialized to "some value" isn't true: you didn't use attr1 in your __init__ method, so "some value" was never used. If you're confused, I suggest you ask on the python-list or tutor mailing lists. More info here: https://

[issue38752] __init__ taking out of context variables

2019-11-08 Thread Eric V. Smith
Eric V. Smith added the comment: This isn't a bug, it's how the language works. You're not forced to use the parameters to a function (in this case __init__), and you can reference any variable, including a global. -- components: -asyncio nosy: +eric.smith _

[issue38752] __init__ taking out of context variables

2019-11-08 Thread Sebastian Bevc
New submission from Sebastian Bevc : 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