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 valu
Sean McIlroy wrote:
> well, somebody's already pointed out that bool(msg)==False iff msg==''.
I may not have received the message yet, but if "iff" still means "if
and only if", then that statement is wrong. There are, of course, about
a dozen things for which bool(msg) is False when msg != '',
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
--
http://mail.python.org/mailman/listinfo/python-list
Rotary wrote:
> I want to say something like that: if msg is empty ...then do
> something. So how can i figure that msg is empty string (no
> character, msg = '').
#v+
if not msg:
print 'msg is empty'
#v-
--
Klaus Alexander Seistrup
Magnetic Ink, Copenhagen, Denmark
http://magnetic-ink
I have a variable that store a string (i.e. a variable name msg).I want to
say something like that: if msg is empty ...then do something.So how can i
figure that msg is empty string (no character, msg = '').Maybe a silly
question but i have no programming experiense.Thanks, Leonidas
--
http: