[EMAIL PROTECTED] writes:
Was doing some string formatting, noticed the following:
x = None "%s" % x
'None'
Is there a reason it maps to 'None'? I had expected ''.
How would know, then, if there was no value at all or if it was an empty
string?
Well, for that matter, how can you tell the difference between
'%s' % False
and
'%s' % 'False'
since both inevitably produce the same output.
The bottom line is that you are trying to map the strings plus other values on to the strings, which means it's a mathematical certainty there will be ambiguities. It's just that you want *your* preferred ambiguities rather than what Python gives you.
Suppose Python were to do what you want, how could you distinguish between the outputs for "" and None? Of course, at the moment the outputs for "None" and None are the same, but that just supports my assertion about the inevitability of ambiguities.
regards Steve
-- http://mail.python.org/mailman/listinfo/python-list