This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sebasbeco
Recipients asvetlov, sebasbeco, yselivanov
Date 2019-11-09.01:07:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1573261648.24.0.116935582519.issue38752@roundup.psfhosted.org>
In-reply-to
Content
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'
History
Date User Action Args
2019-11-09 01:07:28sebasbecosetrecipients: + sebasbeco, asvetlov, yselivanov
2019-11-09 01:07:28sebasbecosetmessageid: <1573261648.24.0.116935582519.issue38752@roundup.psfhosted.org>
2019-11-09 01:07:28sebasbecolinkissue38752 messages
2019-11-09 01:07:27sebasbecocreate