On Tue, Aug 23, 2005 at 10:46:36AM +0200, Wolfgang Lipp wrote: > one point i don't seem to understand right now is why it says in the > function definition:: > > if type(s) is str or type(s) is unicode: > ... > > instead of using ``isinstance()``. 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. > the code as it stands means i have to remember that *in this special > case only* (when deriving from ``unicode``), i have to add a > ``__str__()`` method myself that simply returns ``self``. Ah, I see that unicode.__str__ returns a str instance. > then of course, one could change ``unicode.__str__()`` to return > ``self``, itself, which should work. but then, why so complicated? I think that may be the right fix. Neil
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