On Mon, Mar 9, 2009 at 12:48 AM, Grant Edwards gra...@visi.com wrote:
I didn't say that he hadn't authorized that assumption. I just
said that the code does rely on such an assumption. In my
experience, assumptions like that result broken code down the
road.
And assumptions like when
Lie Ryan wrote:
Fencer wrote:
Hi, I need a boolean b to be true if the variable n is not None and
not an empty list, otherwise b should be false.
I ended up with:
b = n is not None and not not n
which seems to work but is that normally how you would do it?
It can be assumed that n is always
On 2009-03-09, Andre Engels andreeng...@gmail.com wrote:
On Mon, Mar 9, 2009 at 12:48 AM, Grant Edwards gra...@visi.com wrote:
I didn't say that he hadn't authorized that assumption. ??I
just said that the code does rely on such an assumption. ??In
my experience, assumptions like that result
Scott David Daniels wrote:
Lie Ryan wrote:
Fencer wrote:
The literal translation of that would be:
if n is not None and n != []:
b = True
else:
b = False
it is a bit verbose, so one might want to find something shorter
b = True if n is not None and n != [] else False
I always feel if
On Sat, 07 Mar 2009 05:03:08 -, Grant Edwards gra...@visi.com wrote:
On 2009-03-07, Rhodri James rho...@wildebst.demon.co.uk wrote:
On Fri, 06 Mar 2009 15:34:08 -, Grant Edwards inva...@invalid
wrote:
On 2009-03-06, Fencer no.s...@plz.ok wrote:
Hi, I need a boolean b to be true
On 2009-03-08, Rhodri James rho...@wildebst.demon.co.uk wrote:
b = (n is not None) and (n != [])
The second comparison isn't actually necessary, since an
empty list is True and a non-empty one False.
b = (n is not None) and n
Putting the comparison in does make the code slightly less
Fencer wrote:
Hi, I need a boolean b to be true if the variable n is not None and not
an empty list, otherwise b should be false.
I ended up with:
b = n is not None and not not n
which seems to work but is that normally how you would do it?
It can be assumed that n is always None or a list that
Fencer no.s...@plz.ok writes:
Hi, I need a boolean b to be true if the variable n is not None and
not an empty list, otherwise b should be false
It can be assumed that n is always None or a list that might be empty
b = bool(n)
--
http://mail.python.org/mailman/listinfo/python-list
Lie Ryan wrote:
Fencer wrote:
The literal translation of that would be:
if n is not None and n != []:
b = True
else:
b = False
it is a bit verbose, so one might want to find something shorter
b = True if n is not None and n != [] else False
I always feel if and in-line if to be easier
On Sat, Mar 7, 2009 at 6:03 AM, Grant Edwards gra...@visi.com wrote:
Putting in the second comparison in makes the code match the
stated requirement. Otherwise you have to start making
assumptions about what n might be besides None or the empty
list.
But the stated requirement already
Hi, I need a boolean b to be true if the variable n is not None and not
an empty list, otherwise b should be false.
I ended up with:
b = n is not None and not not n
which seems to work but is that normally how you would do it?
It can be assumed that n is always None or a list that might be empty
Fencer schrieb:
Hi, I need a boolean b to be true if the variable n is not None and not
an empty list, otherwise b should be false.
I ended up with:
b = n is not None and not not n
which seems to work but is that normally how you would do it?
It can be assumed that n is always None or a list
On 2009-03-06, Fencer no.s...@plz.ok wrote:
Hi, I need a boolean b to be true if the variable n is not
None and not an empty list, otherwise b should be false.
I ended up with:
b = n is not None and not not n
I'd do it like this:
b = (n is not None) and (n != [])
Your code doesn't meet
On Fri, 06 Mar 2009 15:34:08 -, Grant Edwards inva...@invalid wrote:
On 2009-03-06, Fencer no.s...@plz.ok wrote:
Hi, I need a boolean b to be true if the variable n is not
None and not an empty list, otherwise b should be false.
I ended up with:
b = n is not None and not not n
I'd
On 2009-03-07, Rhodri James rho...@wildebst.demon.co.uk wrote:
On Fri, 06 Mar 2009 15:34:08 -, Grant Edwards inva...@invalid wrote:
On 2009-03-06, Fencer no.s...@plz.ok wrote:
Hi, I need a boolean b to be true if the variable n is not
None and not an empty list, otherwise b should be
15 matches
Mail list logo