K
Kristian Domke
Hello to all
I am trying to learn python at the moment studying an example program
(cftp.py from the twisted framework, if you want to know)
There I found a line
foo = (not f and 1) or 0
In this case f may be None or a string.
If I am not wrong here, one could simply write
foo = not f
because if f = None:
(not f) = true,
(true and 1) = true,
(true or 0) = true
or if f = 'bar'
(not f) = false
(false and 1) = false
(false or 0) = false
So why bothering with the longer version?
I hope, I made clear, what I want...
CU
Kristian
I am trying to learn python at the moment studying an example program
(cftp.py from the twisted framework, if you want to know)
There I found a line
foo = (not f and 1) or 0
In this case f may be None or a string.
If I am not wrong here, one could simply write
foo = not f
because if f = None:
(not f) = true,
(true and 1) = true,
(true or 0) = true
or if f = 'bar'
(not f) = false
(false and 1) = false
(false or 0) = false
So why bothering with the longer version?
I hope, I made clear, what I want...
CU
Kristian