> 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