Carl Banks wrote:
On Apr 29, 6:46 am, Bruno Desthuilliers wrote:
Filip Gruszczyński a écrit :
One of the Python Zen rules is Explicit is better implicit. And yet
it's ok to do:
if x:
do_sth
when x is string or list. Since it's very comfy, I've got nothing
against though. I am just curious,
On Apr 29, 6:46 am, Bruno Desthuilliers wrote:
> Filip Gruszczyński a écrit :
>
> > One of the Python Zen rules is Explicit is better implicit. And yet
> > it's ok to do:
>
> > if x:
> > do_sth
>
> > when x is string or list. Since it's very comfy, I've got nothing
> > against though. I am just
On Apr 29, 8:37 am, Filip Gruszczyński wrote:
> One of the Python Zen rules is Explicit is better implicit. And yet
> it's ok to do:
>
> if x:
> do_sth
>
> when x is string or list. Since it's very comfy, I've got nothing
> against though. I am just curious, why is it so?
It also works for num
Yes, I get the difference. If x is [], than
if x:
won't be executed and
if x is not None:
will be.
Thanks for clarifying.
--
Filip Gruszczyński
--
http://mail.python.org/mailman/listinfo/python-list
Filip Gruszczyński schrieb:
> One of the Python Zen rules is Explicit is better implicit. And yet
> it's ok to do:
>
> if x:
>do_sth
>
> when x is string or list. Since it's very comfy, I've got nothing
> against though. I am just curious, why is it so?
>
> And one more thing: is it ok to do
Filip Gruszczyński a écrit :
One of the Python Zen rules is Explicit is better implicit. And yet
it's ok to do:
if x:
do_sth
when x is string or list. Since it's very comfy, I've got nothing
against though. I am just curious, why is it so?
Because it is explicit (or at least considered as