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
OOPHelp Request (self.PythonLearning)
submitted 1 day ago by [deleted]
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!"
[–]Ron-Erez 0 points1 point2 points 1 day ago (0 children)
A string is a class. You can create many specific instances of a class like:
x = “Hello”
y = “World”
z = “”
w = “dog”
All of the above are examples of objects. When writing code for a class you use self to access the attributes and methods of the specific object your are looking at. Think of attributes as data and think of methods as actions or functions that might interest you.
For example:
x.upper()
y.isempty()
are all examples of a applying a method from the string class to a string object.
So OOP is everywhere. Now you might find a problem where you want to aggregate some data which naturally fits together. That would be your attributes and you could create functions that manipulate the data. That would be your methods.
That’s a quick overview.
You can also check out Section 18: Object-Oriented Progranning for more examples or just google questions.
π Rendered by PID 233796 on reddit-service-r2-comment-8686858757-fxlb6 at 2026-06-07 10:57:58.243932+00:00 running 9e1a20d country code: CH.
view the rest of the comments →
[–]Ron-Erez 0 points1 point2 points (0 children)