Null String Variable

Steve Holden steve at holdenweb.com
Tue May 17 00:59:33 EDT 2005


Sean McIlroy wrote:
> well, somebody's already pointed out that bool(msg)==False iff msg==''.
> i'm curious to know what's wrong with simply writing
> 
> if msg=='':
>     ## do_something
> 
You would write this if there was a possibility that msg could be 
something other than a string, whose value might also be interpreted as 
False by the "if" (e.g. the None object, or an empty list) even though 
your application wanted to handle it differently from an empty string.

regards
  Steve
-- 
Steve Holden        +1 703 861 4237  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/




More information about the Python-list mailing list