Hi Carl,
On Tue, Nov 06, 2007 at 01:07:29PM +0100, Carl Friedrich Bolz wrote:
> My proposal is the following: forbid _all_ mixing of strings and unicode
> in RPython.
Right now we allow mixing plain and unicode characters, at least in the
annotator. There is at least one use case for this: you can write in a
uniform way some code that gets two specialized versions, one for string
and one for unicode. I use this e.g. in objspace.std.formatting, where
two versions of the formatter build a list called 'result' in both
cases, but which is either a list of chars or a list of unichars. It's
full of code like
result += '0' * padding
which works in both cases because the character is turned into a unichar
if necessary - that is, if 'result' is already known to be a list of
unichars.
So while I see the motivation for forbidding implicit conversion, I also
think that there are good use cases where it makes sense to have it - at
least for single characters. I guess that, as usual, the "RPython way"
is to forbid implicit conversions from full strings to full unicode
strings, until the day where we have a good use case for it :-)
Armin
_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev