Hacker News new | past | comments | ask | show | jobs | submit login

My go-to is a factory classmethod:

    class Foo:
        def __init__(self, config: Config): ...

        @classmethod
        def from_config_file(cls, filename: str):
          config = # parse config file
          return cls(config)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: