DEV Community

Discussion on: Python: __init__() is not the only constructor

Collapse
 
robinscodeongit profile image
robin

Hi,
I'm relatively new to python and was using it more as scripting language (without bothering to create classes) since my projects are rather small.
But I was wondering what the clse in this line
if (cls.Inst_created >= clse.MAX_Inst)
Meant, I googled that, but it seems, that it's most likely a typo, but your program did work, so
.. ?

Collapse
 
delta456 profile image
Swastik Baranwal

It's like self reference that points to current instance of the class. I used cls because it needs to be like that.

Collapse
 
robinscodeongit profile image
robin

No, I explicitly meant the cls*e*

Thread Thread
 
delta456 profile image
Swastik Baranwal

That seems to be a typo. I have updated the post so please check again.

Thread Thread
 
robinscodeongit profile image
robin

Okay, thanks a lot
Really nice and easy to understand article then :)