i have to revise my last posting -- exporting the new ``str`` pure-python implementation breaks -- of course! -- as soon as ``isinstance(x,str)`` [sic] is used. right now it breaks because you can't have a function as the second argument of ``isinstance()``, but even if that could be avoided by canny programming, the fact remains that any object derived from e.g. a string literal will still be constructed from the underlying implementation and can't therefore be an instance of the old ``str``. also, ``str.__bases__`` is not extendable (it's a tuple) and not replaceable (it's a built-in), so there seems to be no way to get near a truly working solution except with C-level patches.
On Tue, 23 Aug 2005 17:21:57 +0200, Neil Schemenauer <[EMAIL PROTECTED]> wrote: > I don't think isinstance() would be okay. That test is meant as an > optimization to avoid calling __str__ on str and unicode instances. > Subclasses should still have their __str__ method called otherwise > they cannot override it. makes perfect sense, i'll change the line back. _wolf _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com