Why is str(None) == 'None' and not an empty string?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Aug 29 22:44:28 EDT 2013


On Fri, 30 Aug 2013 01:57:45 +0000, Steven D'Aprano wrote:

> So while I don't doubt that it wouldn't be occasionally convenient to
> map None to '' rather than 'None', I think it would be surprising and,
> indeed, dangerous if it happened by default, since it would encourage
> people to build up SQL query strings by concatenation, as in the
> Original Poster's example.

Ah, apparently I'm smoking crack, since it wasn't the OP at all. My 
apologies. And worse, it was given as an example of what *not* to do.


-- 
Steven



More information about the Python-list mailing list