There is a class that I want to be constructed from a string in 2 different ways. Here is what I mean:
class ParsedString():
def __init__(self, str):
#parse string and init some fields
def __init__2(self, str):
#parse string in another way and init the same fields
In Java I would provide a private constructor with 2 static factory methods each of which define a way of parsing string and then call the private constructor.
What is the common way to solve such problem in Python?
initializer. Note that it receivesself, so it must have already been constructed )