General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Dr Gamma D
Indently
comments
Comments by "Dr Gamma D" (@DrDeuteron) on "Learn Python OOP in under 20 Minutes" video.
the convention is a leading underscore, _foo, is private, and all that means is that clients should not use it nor rely on it. and then there is name-mangling (double leading underscore), that merges the instance name a class name so it cannot be accessed by subclasses.
2
Init and str are strongly typed, you can’t return anything else. The actual constructor is dunder new. Dunder Init is indeed an initializer.
2
Python should never have get and set methods, ever, for attributes. Rather, use the property() decorator.
1
@foo def bar()... is syntactic sugar for: def bar()... bar = foo(bar) class method changes the default arg "self" to "type(self)" or "self dot dunder class".
1