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/024787.html below:

[Python-Dev] Removing types module from stdlib

[Python-Dev] Removing types module from stdlibGuido van Rossum guido@python.org
Fri, 31 May 2002 10:18:53 -0400
> Should I start converting/removing uses of the types module where possible?

Go ahead, but don't be too aggressive.  I.e. leave cases where it's
unclear what to do alone, and don't strive for completeness.  OTOH, I
see no need to go through the SF patch manager for this, as long as
the test suite runs.

> So where we have:
> 	assert type(lineno) is types.IntType
> 	assert type(lineno) in (types.IntType, types.LongType)
> 
> would become:
> 	assert type(lineno) is int
> 	assert type(lineno) in (int, long)
> 
> or
> 	assert isinstance(lineno, int)
> 	assert isinstance(lineno, (int, long))
> 
> Preferences?

I strongly prefer the isinstance() forms, but beware that they have
different semantics in the light of subtypes.  You may have to think
about what's intended.  Usually isinstance() will be the right thing
to do though.

--Guido van Rossum (home page: http://www.python.org/~guido/)




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