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

[Python-Dev] to string or not to string...

[Python-Dev] to string or not to string...Guido van Rossum guido@python.org
Fri, 24 May 2002 17:20:03 -0400
> Recent checkins mean that:
> 
> E:\CVS\python\dist\src\PCbuild>python
> Python 2.3a0 (#29, May 24 2002, 13:47:58) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> isinstance('foo', string)
> True
>  >>> import string
>  >>> isinstance('foo', string)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: isinstance() arg 2 must be a class or type
>  >>>
> 
> I realize that there isn't a backwards compatibility problem per se, but 
> there is something bothersome about the above, I think.  I also am not 
> to keen on having to keep "str" and "string" separate, but I don't have 
> any better suggestion for the interface name (for that's what "string" is).

'str' and 'string' have to be separate because the whole point is that
isinstance(u"", string) returns True.

We could rename string to basestring?

> Do we want string to be both the module and the interface
> masquerading as a type?

That would *almost* work (string.lower could be an unbound method that
calls the corresponding real class method) except string.join() would
have the arguments reversed. :-(

> [Trent gets the credit for asking the question -- I'm just the tester =)]

Trent needn't be so shy. :-)

--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