2.2 features

Kirill Simonov kirill at xyz.donetsk.ua
Fri Jul 27 23:47:41 CEST 2001


On Fri, Jul 27, 2001 at 08:01:04PM +0000, Guido van Rossum wrote:
> John Schmitt <jschmitt at vmlabs.com> writes:
> 
> > Why do we have to wait for 2.2?  You can do this already.  
> 
> > >>> import types
> > >>> types.IntType
> > <type 'int'>
> > >>> assert isinstance(0,types.IntType)
> 
> [me, earlier]
> > >   assert isinstance(num, int)
> > >   assert isinstance(msg, str)
> 
> In 2.2 you don't have to import types.

It would be nice to have 'in' operator for types:

assert (num in int)
assert (msg in str)


Kirill.





More information about the Python-list mailing list