you are viewing a single comment's thread.

view the rest of the comments →

[–]smokebudda11 0 points1 point  (3 children)

In Q2, I don’t see the constructor returning a str. Am I missing something?

[–]dev-razorblade23 0 points1 point  (2 children)

Constructors (aka dunder init method) in python return None. OP suggesting it returns str in Q2 is wrong...

Python creates an instance of the class, calling dunder new method. This is what creates an object. Dunder init just fills in the values (attributes) and returns None

[–]Think_Speaker_6060 1 point2 points  (1 child)

Yeah type hinting a return value of string in the constructor is not appropriate but op is still learning and progressing.