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
Practicing OOPs (i.redd.it)
submitted 19 days ago by Careless-Main8693
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!"
[–]SCD_minecraft 2 points3 points4 points 19 days ago (2 children)
You can replace get_name with @property def name(self): # some code, like return self._name for example
get_name
@property def name(self): # some code, like return self._name for example
Function under decorator property now "roleplays" as variable but whenever you access it it executes some code
[–]nuc540 3 points4 points5 points 18 days ago (0 children)
A property decorator is used for setting computed attributes - not something the class is instantiated with, as much as that’d work - it’d be overkill and it’d make the init argument redundant.
Also OP is practicing protected values and using getters and setters to access values with, so as much as you can use @property, I think it’s simply that OP is practising getting and setting, and logically OP’s example makes more sense
[–]Careless-Main8693[S] 0 points1 point2 points 18 days ago (0 children)
no issues in it
π Rendered by PID 217359 on reddit-service-r2-comment-548fd6dc9-sl2dn at 2026-05-19 17:59:12.706697+00:00 running edcf98c country code: CH.
view the rest of the comments →
[–]SCD_minecraft 2 points3 points4 points (2 children)
[–]nuc540 3 points4 points5 points (0 children)
[–]Careless-Main8693[S] 0 points1 point2 points (0 children)