Commit 6828e18a authored by Martin v. Löwis's avatar Martin v. Löwis

Patch #825679: Clarify semantics of .isfoo on empty strings.

Backported to 2.3.
parent 849a972f
...@@ -613,7 +613,8 @@ is at least one character, false otherwise. ...@@ -613,7 +613,8 @@ is at least one character, false otherwise.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{isdigit}{} \begin{methoddesc}[string]{isdigit}{}
Return true if there are only digit characters, false otherwise. Return true if all characters in the string are digits and there
is at least one character, false otherwise.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{islower}{} \begin{methoddesc}[string]{islower}{}
...@@ -623,13 +624,14 @@ there is at least one cased character, false otherwise. ...@@ -623,13 +624,14 @@ there is at least one cased character, false otherwise.
\begin{methoddesc}[string]{isspace}{} \begin{methoddesc}[string]{isspace}{}
Return true if there are only whitespace characters in the string and Return true if there are only whitespace characters in the string and
the string is not empty, false otherwise. there is at least one character, false otherwise.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{istitle}{} \begin{methoddesc}[string]{istitle}{}
Return true if the string is a titlecased string: uppercase Return true if the string is a titlecased string and there is at least one
characters may only follow uncased characters and lowercase characters character, i.e. uppercase characters may only follow uncased
only cased ones. Return false otherwise. characters and lowercase characters only cased ones. Return false
otherwise.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{isupper}{} \begin{methoddesc}[string]{isupper}{}
......
...@@ -2733,10 +2733,10 @@ string_zfill(PyStringObject *self, PyObject *args) ...@@ -2733,10 +2733,10 @@ string_zfill(PyStringObject *self, PyObject *args)
} }
PyDoc_STRVAR(isspace__doc__, PyDoc_STRVAR(isspace__doc__,
"S.isspace() -> bool\n" "S.isspace() -> bool\n\
"\n" \n\
"Return True if there are only whitespace characters in S,\n" Return True if all characters in S are whitespace\n\
"False otherwise."); and there is at least one character in S, False otherwise.");
static PyObject* static PyObject*
string_isspace(PyStringObject *self) string_isspace(PyStringObject *self)
...@@ -2766,7 +2766,7 @@ string_isspace(PyStringObject *self) ...@@ -2766,7 +2766,7 @@ string_isspace(PyStringObject *self)
PyDoc_STRVAR(isalpha__doc__, PyDoc_STRVAR(isalpha__doc__,
"S.isalpha() -> bool\n\ "S.isalpha() -> bool\n\
\n\ \n\
Return True if all characters in S are alphabetic\n\ Return True if all characters in S are alphabetic\n\
and there is at least one character in S, False otherwise."); and there is at least one character in S, False otherwise.");
static PyObject* static PyObject*
...@@ -2797,7 +2797,7 @@ string_isalpha(PyStringObject *self) ...@@ -2797,7 +2797,7 @@ string_isalpha(PyStringObject *self)
PyDoc_STRVAR(isalnum__doc__, PyDoc_STRVAR(isalnum__doc__,
"S.isalnum() -> bool\n\ "S.isalnum() -> bool\n\
\n\ \n\
Return True if all characters in S are alphanumeric\n\ Return True if all characters in S are alphanumeric\n\
and there is at least one character in S, False otherwise."); and there is at least one character in S, False otherwise.");
static PyObject* static PyObject*
...@@ -2828,8 +2828,8 @@ string_isalnum(PyStringObject *self) ...@@ -2828,8 +2828,8 @@ string_isalnum(PyStringObject *self)
PyDoc_STRVAR(isdigit__doc__, PyDoc_STRVAR(isdigit__doc__,
"S.isdigit() -> bool\n\ "S.isdigit() -> bool\n\
\n\ \n\
Return True if there are only digit characters in S,\n\ Return True if all characters in S are digits\n\
False otherwise."); and there is at least one character in S, False otherwise.");
static PyObject* static PyObject*
string_isdigit(PyStringObject *self) string_isdigit(PyStringObject *self)
...@@ -2893,7 +2893,7 @@ string_islower(PyStringObject *self) ...@@ -2893,7 +2893,7 @@ string_islower(PyStringObject *self)
PyDoc_STRVAR(isupper__doc__, PyDoc_STRVAR(isupper__doc__,
"S.isupper() -> bool\n\ "S.isupper() -> bool\n\
\n\ \n\
Return True if all cased characters in S are uppercase and there is\n\ Return True if all cased characters in S are uppercase and there is\n\
at least one cased character in S, False otherwise."); at least one cased character in S, False otherwise.");
static PyObject* static PyObject*
...@@ -2927,9 +2927,10 @@ string_isupper(PyStringObject *self) ...@@ -2927,9 +2927,10 @@ string_isupper(PyStringObject *self)
PyDoc_STRVAR(istitle__doc__, PyDoc_STRVAR(istitle__doc__,
"S.istitle() -> bool\n\ "S.istitle() -> bool\n\
\n\ \n\
Return True if S is a titlecased string, i.e. uppercase characters\n\ Return True if S is a titlecased string and there is at least one\n\
may only follow uncased characters and lowercase characters only cased\n\ character in S, i.e. uppercase characters may only follow uncased\n\
ones. Return False otherwise."); characters and lowercase characters only cased ones. Return False\n\
otherwise.");
static PyObject* static PyObject*
string_istitle(PyStringObject *self, PyObject *uncased) string_istitle(PyStringObject *self, PyObject *uncased)
......
...@@ -4897,7 +4897,7 @@ unicode_islower(PyUnicodeObject *self) ...@@ -4897,7 +4897,7 @@ unicode_islower(PyUnicodeObject *self)
PyDoc_STRVAR(isupper__doc__, PyDoc_STRVAR(isupper__doc__,
"S.isupper() -> bool\n\ "S.isupper() -> bool\n\
\n\ \n\
Return True if all cased characters in S are uppercase and there is\n\ Return True if all cased characters in S are uppercase and there is\n\
at least one cased character in S, False otherwise."); at least one cased character in S, False otherwise.");
static PyObject* static PyObject*
...@@ -4931,9 +4931,10 @@ unicode_isupper(PyUnicodeObject *self) ...@@ -4931,9 +4931,10 @@ unicode_isupper(PyUnicodeObject *self)
PyDoc_STRVAR(istitle__doc__, PyDoc_STRVAR(istitle__doc__,
"S.istitle() -> bool\n\ "S.istitle() -> bool\n\
\n\ \n\
Return True if S is a titlecased string, i.e. upper- and titlecase\n\ Return True if S is a titlecased string and there is at least one\n\
characters may only follow uncased characters and lowercase characters\n\ character in S, i.e. upper- and titlecase characters may only\n\
only cased ones. Return False otherwise."); follow uncased characters and lowercase characters only cased ones.\n\
Return False otherwise.");
static PyObject* static PyObject*
unicode_istitle(PyUnicodeObject *self) unicode_istitle(PyUnicodeObject *self)
...@@ -4978,8 +4979,8 @@ unicode_istitle(PyUnicodeObject *self) ...@@ -4978,8 +4979,8 @@ unicode_istitle(PyUnicodeObject *self)
PyDoc_STRVAR(isspace__doc__, PyDoc_STRVAR(isspace__doc__,
"S.isspace() -> bool\n\ "S.isspace() -> bool\n\
\n\ \n\
Return True if there are only whitespace characters in S,\n\ Return True if all characters in S are whitespace\n\
False otherwise."); and there is at least one character in S, False otherwise.");
static PyObject* static PyObject*
unicode_isspace(PyUnicodeObject *self) unicode_isspace(PyUnicodeObject *self)
...@@ -5007,7 +5008,7 @@ unicode_isspace(PyUnicodeObject *self) ...@@ -5007,7 +5008,7 @@ unicode_isspace(PyUnicodeObject *self)
PyDoc_STRVAR(isalpha__doc__, PyDoc_STRVAR(isalpha__doc__,
"S.isalpha() -> bool\n\ "S.isalpha() -> bool\n\
\n\ \n\
Return True if all characters in S are alphabetic\n\ Return True if all characters in S are alphabetic\n\
and there is at least one character in S, False otherwise."); and there is at least one character in S, False otherwise.");
static PyObject* static PyObject*
...@@ -5036,7 +5037,7 @@ unicode_isalpha(PyUnicodeObject *self) ...@@ -5036,7 +5037,7 @@ unicode_isalpha(PyUnicodeObject *self)
PyDoc_STRVAR(isalnum__doc__, PyDoc_STRVAR(isalnum__doc__,
"S.isalnum() -> bool\n\ "S.isalnum() -> bool\n\
\n\ \n\
Return True if all characters in S are alphanumeric\n\ Return True if all characters in S are alphanumeric\n\
and there is at least one character in S, False otherwise."); and there is at least one character in S, False otherwise.");
static PyObject* static PyObject*
...@@ -5094,8 +5095,8 @@ unicode_isdecimal(PyUnicodeObject *self) ...@@ -5094,8 +5095,8 @@ unicode_isdecimal(PyUnicodeObject *self)
PyDoc_STRVAR(isdigit__doc__, PyDoc_STRVAR(isdigit__doc__,
"S.isdigit() -> bool\n\ "S.isdigit() -> bool\n\
\n\ \n\
Return True if there are only digit characters in S,\n\ Return True if all characters in S are digits\n\
False otherwise."); and there is at least one character in S, False otherwise.");
static PyObject* static PyObject*
unicode_isdigit(PyUnicodeObject *self) unicode_isdigit(PyUnicodeObject *self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment