On Sat, 15 Aug 2020 11:47:03 +0200 Sibylle Koczian <nulla.epist...@web.de> wrote:
> Am 15.08.2020 um 10:14 schrieb Manfred Lotz: > > Hi Chris, > > Thanks a lot for you advice. > > > > On Sat, 15 Aug 2020 16:15:29 +1000 > > Chris Angelico <ros...@gmail.com> wrote: > > > >> On Sat, Aug 15, 2020 at 3:36 PM Manfred Lotz <ml_n...@posteo.de> > >> wrote: > >>> > >>> I have an object which I could initialize providind an int or a > >>> str. > ... > > > > For my use case I don't like this solution as I get the value which > > could be an int or str from a file. Means I would have to check the > > type beforehand in order to know if I have to do O4(val) or > > O4.from_name(val). > > > > Otherwise, it is admittedly a very good pattern. > > > > > Possibly silly question: No silly questions. There are at most stupid answers. :-) > if the value comes from a file, isn't it a > string in any case? A string that may be convertible to int or not? Or > what sort of file do I overlook? > In this case it is a TOML file. -- Manfred -- https://mail.python.org/mailman/listinfo/python-list