On Sunday 12 September 2010 18:13:47 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.
Well, I don't think that I've ever seen a program that did that sort of thing. Of course, I don't program in python (I bought a book on it but haven't gotten around to reading it yet), but I suspect that either it's simply an artifact of what you are trying to do as opposed to what's typical in python or that it's something that's typical to do in python but not other languages (which could be an artifact of which language people use for which task). > > 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. Well, yes. That would be a side effect of using algorithms that need dstrings. If the algorithms that you're using are primarily random access-based, then naturally, most of your code will end up using dstrings rather than strings. There's no really any way around that unless you want to keep translating back and forth. If your string processing doesn't require random access, then you avoid the problem, but as long as it needs random access, you're pretty much stuck. - Jonathan M Davis
