__slots__ tag

1 questions


1 answers
52 views
0
Why are properties created that are not in Python class __slots__?

class b(): __slots__=['a'] c=1one=b()one.a=1try: one.b=2except: print(Cannot be created)print(one.a)class q(): passclass w(q): __slots__=['a']two=w()two.a=1two.b=2print(two.a, two.b)In class b, slots ...

2 years ago

© 2024 OneMinuteCode. All rights reserved.