See Pep 294. was: Re: Why is there no instancemethod builtin?

John Roth newsgroups at jhrothjr.com
Sun Jun 19 09:08:13 EDT 2005


"Michael Hoffman" <cam.ac.uk at mh391.invalid> wrote in message 
news:d93b6a$k0c$2 at gemini.csx.cam.ac.uk...
> John Roth wrote:
>
>> you need _both_ isinstance and the types  module to do a correct
>> check for any string type: isinstance(fubar, types.StringTypes).
>> That's because both string and unicode are subtypes of one base.
>
> But basestring, their base class is a built-in.

True, but that wasn't the question.

However, to add a bit of sanity to this thread, please consider
that PEP 294 is still open - it survived the recent spate of PEP
rejections and closings. It suggests extending the types module
to include all types, including those in the new module (which the
OP seems to have overlooked,) and then depreciating the new
module.

John Roth


> -- 
> Michael Hoffman 




More information about the Python-list mailing list