Random string samples & unicode - Reprise

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Sep 12 19:00:13 PDT 2010


On 09/12/2010 08:13 PM, bearophile wrote:
> Jonathan M Davis:
>> You do seem to try to do a lot of things that most other folks never even think
>> of doing, let alone have a need to. This is one of them.
>
> Choosing few random chars out of a sequence of possible chars is very normal in Python, it's even a common thing.
>
>
>> I've found that if you want a string out of array(), what you need to do is
>> to!string(array(...))).
>
> I see.
>
>
>> if you're trying to grab random characters from
>> a string, that's likely to work best with a dstring because it supports random
>> access, so there's a decent chance that dstring is really what you want anyway,
>
> This may be right. But as I have tried to explain two times, you may end up having string-processing code made mostly of dstrings.

No, you end up having string-processing code dealing with ranges of 
dchar. Which is in fact exactly as it should. If you want to keep the 
comparison with Python complete, Python's support for Unicode also needs 
to be part of the discussion.

Andrei


More information about the Digitalmars-d mailing list