0

Can you explain "__init__" to me? Please.

I don't understand "data = None" in this code: def __init__(self, data = None, next = None): self. data=data self.next=next Can you explain it to me? What does it mean? And Can you send to me example for it. Thank you so much.

8th Aug 2020, 4:41 AM
Sàm Sàm Channel !
Sàm Sàm Channel ! - avatar
2 Réponses
+ 2
__init__ automatically runs when an object of a class is instantiated. data = None just means that by default variable data has the value None. It can be overridden by passing a value when creating the object
8th Aug 2020, 4:49 AM
JME
0
Thank you 😊 It can be overridden. I understand !
8th Aug 2020, 5:03 AM
Sàm Sàm Channel !
Sàm Sàm Channel ! - avatar