joining strings question

Peter Otten __peter__ at web.de
Fri Feb 29 20:18:09 CET 2008


I V wrote:

> On Fri, 29 Feb 2008 08:18:54 -0800, baku wrote:
>>     return s == s.upper()
> 
> A couple of people in this thread have used this to test for an upper
> case string. Is there a reason to prefer it to s.isupper() ?

Note that these tests are not equivalent:

>>> s = "123"
>>> s.isupper(), s.upper() == s
(False, True)

Peter




More information about the Python-list mailing list