[Python-Dev] Re: [Python-checkins]
python/dist/src/Lib/test test_string.py, 1.25, 1.26
Nick Coghlan
ncoghlan at iinet.net.au
Fri Aug 27 01:20:15 CEST 2004
Walter Dörwald wrote:
> I'm working on it, however I discovered that unicode.join()
> doesn't optimize this special case:
I noticed that during the implementation of the patch. I think it's
because unicode join doesn't use a multi-pass approach, so there's no
opportunity to notice that the optimisation is possible.
> s = "foo"
> assert "".join([s]) is s
>
> u = u"foo"
> assert u"".join([s]) is s
>
> The second assertion fails.
>
> I'd say that this test (joining a one item sequence returns
> the item itself) should be removed because it tests an
> implementation detail.
Fine by me - I was uncertain about that when I posted the patch to SF
(there's a question about it in the patch tracker item). The main reason
I had that test there was to make sure that the second version of the
patch didn't break this optimisation the way the first version did.
Regards,
Nick.
More information about the Python-Dev
mailing list