At 14:27 a note about convention and class methods pops up on the screen. I didn't quite understand if what we did on the video was following that convention or not?
If we didn't, how else should we write it to follow the cls convention?
Sorry, I'm still crawling in python...
In short: @classmethod
functions have the first parameter named cls
to represent the class being passed as an argument, just like the first parameter in instance functions (such as execute()
) is self
to represent the instance. So my naming it self
can just be misleading to other programmers. But in this case it does not affect the code working. It won't cause any errors here. I believe I correct myself to name itcls
in later scripts and lessons. I just forgot in this case while recording 😄
Got it! Thanks! Yeah... I know I should have watched the whole course before asking the basics, but it turns out I'm having to watch every lesson twice as is. Lol. I'll get there.