python2.2: type('name') -> <type 'str'> ??
Richard Jones
richard at bizarsoftware.com.au
Wed Jul 25 00:39:28 EDT 2001
On Wed, 25 Jul 2001 14:14, Tim Peters wrote:
> Note this cute consequence:
> >>> x = 1L
> >>> type(x)(3)
>
> 3L
>
>
> That is, type() in 2.2a1 truly returns a constructor, and type(1L)(y) is
> the same as long(y). Likewise for
>
> >>> type("abc")(42)
>
> '42'
>
> >>> type("abc") is str
>
> 1
>
> >>> type(1L) is long
>
> 1
Not having access to 2.2 for the moment, what's the story if type() returns
the instance type?
just-curious'ly ... Richard
--
Richard Jones
richard at bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)
More information about the Python-list
mailing list