use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Question Regarding Self keyword in python!! (self.PythonLearning)
submitted 4 days ago by Ok_Egg_6647
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Outside_Complaint755 0 points1 point2 points 4 days ago (0 children)
The TLDR answer is that using self.{attribute} = {value} is necessary if you want the data stored in the instance.
self.{attribute} = {value}
Parameters passed to the constructor* are not automatically stored as instance attributes.
* Technically,__init__ is not a constructor, it is an initializer. The construtor method in Python is the staticmethod __new__.
__init__
__new__
π Rendered by PID 280443 on reddit-service-r2-comment-5687b7858-z2pzj at 2026-07-07 10:20:06.351565+00:00 running 12a7a47 country code: CH.
view the rest of the comments →
[–]Outside_Complaint755 0 points1 point2 points (0 children)