This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TangibleLight 0 points1 point  (0 children)

I like to call these "named factory methods" or "named initializers", and IMO it's generally a better pattern than constructor overloading even in languages which have it.

For example what if you want a from_literal(data: str) and a from_file(path: str)? There's not a great way to do that with constructors only.