David Trémouilles wrote:
Hi,
Is there any better (shorter) way to negate a boolean list than:
negated_boolean_list = [not elem for elem in boolean_list]
?
I tried:
map(not, boolean_list)
but it seems that not is not a function.
Thanks in advance,
David
But import module
On Feb 10, 7:46 am, David Trémouilles [EMAIL PROTECTED] wrote:
Hi,
Is there any better (shorter) way to negate a boolean list than:
negated_boolean_list = [not elem for elem in boolean_list]
?
I tried:
map(not, boolean_list)
but it seems that not is not a function.
Thanks in
Paddy wrote:
On Feb 10, 7:46 am, David Trémouilles [EMAIL PROTECTED] wrote:
Hi,
Is there any better (shorter) way to negate a boolean list than:
negated_boolean_list = [not elem for elem in boolean_list]
?
I tried:
map(not, boolean_list)
but it seems that not is not a function.
On Sun, 10 Feb 2008 08:46:24 +0100, David Trémouilles wrote:
[snip]
I tried:
map(not, boolean_list)
but it seems that not is not a function.
`not` is not a function, indeed. It is a keyword, allowing you to write
``not x`` instead of ``not(x)``.
You can of course write a function that
Thanks to all of you for the prompt answer to my question.
Just a short feedback:
map(not_, boolean_list)
looks more readable to me
but:
[not elem for elem in boolean_list]
seems to be slightly faster (ipython timeit results)
(python 2.5.1 MacOS X)
Not a big deal anyway!
Most important for
On Feb 10, 1:41 pm, Steve Holden [EMAIL PROTECTED] wrote:
Paddy wrote:
On Feb 10, 7:46 am, David Trémouilles [EMAIL PROTECTED] wrote:
Hi,
Is there any better (shorter) way to negate a boolean list than:
negated_boolean_list = [not elem for elem in boolean_list]
?
I tried:
Hi,
Is there any better (shorter) way to negate a boolean list than:
negated_boolean_list = [not elem for elem in boolean_list]
?
I tried:
map(not, boolean_list)
but it seems that not is not a function.
Thanks in advance,
David
--
http://mail.python.org/mailman/listinfo/python-list