n-list@python.org
Asunto: Re: try..except or type() or isinstance()?
On Sun, 16 Aug 2020 09:40:12 +0200
Manfred Lotz wrote:
> On Sat, 15 Aug 2020 12:20:48 -0400
> Dennis Lee Bieber wrote:
>
> > On Sat, 15 Aug 2020 15:31:56 +0200, Manfred Lotz
> > declaimed the following:
&
On Sun, 16 Aug 2020 09:40:12 +0200
Manfred Lotz wrote:
> On Sat, 15 Aug 2020 12:20:48 -0400
> Dennis Lee Bieber wrote:
>
> > On Sat, 15 Aug 2020 15:31:56 +0200, Manfred Lotz
> > declaimed the following:
> >
> > >On Sat, 15 Aug 2020 11:47:03 +0200
> > >Sibylle Koczian wrote:
> > >
> >
On 15 Aug 2020 14:49:48 GMT
r...@zedat.fu-berlin.de (Stefan Ram) wrote:
> Manfred Lotz writes:
> >Here a minimal example
>
> main.py
>
> source="""
> sehr gut
> 1
> """[ 1: -1 ].split( "\n" )
>
> class grades:
> names =[ "sehr gut" ]
> @staticmethod
> def is_numeric( text ):
>
On Sat, 15 Aug 2020 12:20:48 -0400
Dennis Lee Bieber wrote:
> On Sat, 15 Aug 2020 15:31:56 +0200, Manfred Lotz
> declaimed the following:
>
> >On Sat, 15 Aug 2020 11:47:03 +0200
> >Sibylle Koczian wrote:
> >
>
> >> if the value comes from a file, isn't it a
> >> string in any case? A string
On Sat, 15 Aug 2020 11:47:03 +0200
Sibylle Koczian 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 wrote:
> >
> >> On Sat, Aug 15, 2020 at 3:36 PM Manfred Lotz
> >> 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 wrote:
On Sat, Aug 15, 2020 at 3:36 PM Manfred Lotz
wrote:
I have an object which I could initialize providind an int or a str.
...
For my use case I do
On Sat, 15 Aug 2020 08:33:58 +0200
Peter Otten <__pete...@web.de> wrote:
> Chris Angelico wrote:
>
> > On Sat, Aug 15, 2020 at 3:36 PM Manfred Lotz
> > wrote:
> >>
> >> I have an object which I could initialize providind an int or a
> >> str.
> >>
> >> I am not sure which of the following is b
Hi Chris,
Thanks a lot for you advice.
On Sat, 15 Aug 2020 16:15:29 +1000
Chris Angelico wrote:
> On Sat, Aug 15, 2020 at 3:36 PM Manfred Lotz
> wrote:
> >
> > I have an object which I could initialize providind an int or a str.
> >
> > I am not sure which of the following is best to use
> > -
Chris Angelico wrote:
> On Sat, Aug 15, 2020 at 3:36 PM Manfred Lotz wrote:
>>
>> I have an object which I could initialize providind an int or a str.
>>
>> I am not sure which of the following is best to use
>> - try/except
>> - if type(int)...
>> - if isinstance(v, int)
>>
>> Here a minimal
On Sat, Aug 15, 2020 at 3:36 PM Manfred Lotz wrote:
>
> I have an object which I could initialize providind an int or a str.
>
> I am not sure which of the following is best to use
> - try/except
> - if type(int)...
> - if isinstance(v, int)
>
> Here a minimal example
>
> def get_id(fromname):
I have an object which I could initialize providind an int or a str.
I am not sure which of the following is best to use
- try/except
- if type(int)...
- if isinstance(v, int)
Here a minimal example
def get_id(fromname):
# do something with `fromname`
return 0
def get_name(fromid):
11 matches
Mail list logo