A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-May/024377.html below:

[Python-Dev] Re: [Python-checkins] python/dist/src/Lib types.py,1.26,1.27

[Python-Dev] Re: [Python-checkins] python/dist/src/Lib types.py,1.26,1.27Thomas Heller thomas.heller@ion-tof.com
Fri, 24 May 2002 20:04:43 +0200
>     Testing for inclusion in a set of types is a little less
>     straightforward if you are concerned about possible subclassing.
>     Currently, to see if an object is a number you would write
> 
>         if type(o) in (IntType, FloatType, ComplexType):
>             ...
> 
>     That would be converted to 
> 
>         if type(o) in (int, float, complex):
>             ...
> 
>     or
> 
>         if (isinstance(o, int) or isinstance(o, float) or
>             isinstance(o, complex)):
>             ...
> 
>     The last case is decidedly cumbersome.
> 
or 
          if isinstance(o, (int, float, complex)):


Thomas





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4