Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53134 > unrolled thread
| Started by | Fabrice POMBET <fp2161@gmail.com> |
|---|---|
| First post | 2013-08-28 13:42 +0200 |
| Last post | 2013-08-28 13:42 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Rép : Why is str(None) == 'None' and not an empty string? Fabrice POMBET <fp2161@gmail.com> - 2013-08-28 13:42 +0200
| From | Fabrice POMBET <fp2161@gmail.com> |
|---|---|
| Date | 2013-08-28 13:42 +0200 |
| Subject | Rép : Why is str(None) == 'None' and not an empty string? |
| Message-ID | <mailman.304.1377690272.19984.python-list@python.org> |
On 8/28/2013 4:57 AM, Piotr Dobrogost wrote: > Having repr(None) == 'None' is sure the right thing but why does str(None) == 'None'? Wouldn't it be more correct if it was an empty string? the point of str(obj) is to return a string containing the obj (a sequence of characters if it is unbound or not built-in, etc.)... If you set the rule str(None)=="", then you will cause plenty of problems. For instance, if you want to build a string like request="SELECT X"+"IN Y"+"WHERE B="+String(B) to prepare a sequel request, and the field B happens to be sometimes "None", you would automatically end up with """SELECT X IN Y WHERE B=''""" instead of """SELECT X IN Y WHERE B='None'""", and your sql request will fall into limbos...
Back to top | Article view | comp.lang.python
csiph-web