Post

Royce
Royce@Royce4Q2·
@Python_Dv class Test: def __init__(self, __id): self.__id = 101 test = Test(102) D) ERROR. When you define an attribute with double underscores(__id), python changes the name to _Test__id to avoid name clashes in subclasses so you get an error. print(test.__id)
English
2
0
2
352
A
A@Pushpen18873807·
@Python_Dv Error will come
English
0
0
0
357
Biel Men
Biel Men@BielMenHaha·
@Python_Dv Error, because the attribute received the init argument, but its internal to the class. This implies that isn't possible to use this atribute by a simple way outside the class
English
0
0
0
308
Paylaş