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

Type Names in the types Module

[Python-Dev] PEP 294: Type Names in the types ModuleOren Tirosh oren-py-d@hishome.net
Tue, 25 Jun 2002 01:02:10 -0400
On Tue, Jun 25, 2002 at 12:09:38AM +0100, Michael Hudson wrote:
> Oren Tirosh <oren-py-l@hishome.net> writes:
> 
> > Abstract
> > 
> >     This PEP proposes that symbols matching the type name should be
> >     added to the types module for all basic Python types in the types
> >     module:
> > 
> >         types.IntegerType -> types.int
> >         types.FunctionType -> types.function
> >         types.TracebackType -> types.traceback
> >          ...    
> > 
> >     The long capitalized names currently in the types module will be
> >     deprecated.
> 
> Um, can I be a little confused?  If you are writing code that you know
> will be run in 2.2 and later, you write
> 
>    isinstance(obj, int)
> 
> If you want to support 2.1 and so on, you write 
> 
>    isinstance(obj, types.IntType)
> 
> What would writing 
> 
>    isinstance(obj, types.int)
> 
> ever gain you except restricting execution to 2.3+?

It's like asking what do you gain by using string methods instead of the 
string module.  It's part of a slow, long-term effort to clean up the 
language while trying to minimize the impact on existing code.

	Oren





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