Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
This happened to me all the time when I first started Python.
This page explains it nicely. It makes sense to me even more after reading:
https://programiz.com/article/...
Will probably still be weird for programmers of other OOP languages for a while. -
@corscheid thanks for sharing that , was good read , seems like its not necessary just as i thought but staying anyway .
-
@harambae yeah it's better than Geany and SPE and actually works, unlike Eclipse+PyDev.
-
Ooh and not just to constructor (__init__)
have to pass it to every method ,this is so unintuitive for me. -
As a person who codes mostly just in PY, this is something normal lol. BTW, I really like Spyder as IDE.
-
I think it makes sense. Self can't be some global "thing". It's depends on the context. So Python takes advantage of that and shows that it is a parameter
-
@kyleperik self is not a keyword in python anything you pass as first parameter becomes reference for current object ,I think it is used to differentiate between object and class variable (self.x==object variable & x==class variable). It's necessary as unlike java there is no private and static keywords.The only problem is that you have to pass it every method definition and omit it while calling the method.
Related Rants
everything was going great, I was loving it,
then self happens
why should one pass self (current object refrance) to the constructor in python , why doesn't this keyword exist in python.
coming from java I always forget to add it.
just WHY?????
undefined
__init__
python