Roberto Bonvallet ha scritto:
> imho <[EMAIL PROTECTED]>:
>> map(lambda x:"" , [i for i in [a,b,c] if i in ("None",None) ])
>
> You don't need map when using list comprehensions:
>
>["" for i in [a, b, c] if i in ("None", None)]
>
I know that... I tried to match the idiom used by the o.p. :
Scott David Daniels wrote:
> Roberto Bonvallet wrote:
>> imho <[EMAIL PROTECTED]>:
>>> map(lambda x:"" , [i for i in [a,b,c] if i in ("None",None) ])
>> You don't need map when using list comprehensions:
>>["" for i in [a, b, c] if i in ("None", None)]
>>
> More like:
>
> [(i, "")[i in ("N
Roberto Bonvallet wrote:
> imho <[EMAIL PROTECTED]>:
>> map(lambda x:"" , [i for i in [a,b,c] if i in ("None",None) ])
> You don't need map when using list comprehensions:
>["" for i in [a, b, c] if i in ("None", None)]
>
More like:
[(i, "")[i in ("None", None)] for i in [a,b,c]]
--
--
"Roberto Bonvallet" <[EMAIL PROTECTED]> wrote:
> You don't need map when using list comprehensions:
>
> ["" for i in [a, b, c] if i in ("None", None)]
>
That loses list elements that aren't in the tests:
>>> a=7
>>> b="None"
>>> c=None
>>> ["" for i in [a,b,c] if i in ("None",None)]
['', ''
imho <[EMAIL PROTECTED]>:
> map(lambda x:"" , [i for i in [a,b,c] if i in ("None",None) ])
You don't need map when using list comprehensions:
["" for i in [a, b, c] if i in ("None", None)]
--
Roberto Bonvallet
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 18 Jun 2006 07:37:00 -0500, Tim Chase <[EMAIL PROTECTED]> wrote:
>> i wish to map None or "None" values to "".
>> eg
>> a = None
>> b = None
>> c = "None"
>>
>> map( , [i for i in [a,b,c] if i in ("None",None) ])
>>
>> I can't seem to find a way to put all values to "". Can anyone help?
[EMAIL PROTECTED] wrote:
> hi
> i wish to map None or "None" values to "".
> eg
> a = None
> b = None
> c = "None"
>
> map( , [i for i in [a,b,c] if i in ("None",None) ])
>
> I can't seem to find a way to put all values to "". Can anyone help?
> thanks
a = [None, 'None', None]
def filtre(x):
[EMAIL PROTECTED] ha scritto:
> hi
> i wish to map None or "None" values to "".
> eg
> a = None
> b = None
> c = "None"
>
> map( , [i for i in [a,b,c] if i in ("None",None) ])
>
> I can't seem to find a way to put all values to "". Can anyone help?
> thanks
>
You already filtered [a,b,c] in
> i wish to map None or "None" values to "".
> eg
> a = None
> b = None
> c = "None"
>
> map( , [i for i in [a,b,c] if i in ("None",None) ])
>
> I can't seem to find a way to put all values to "". Can anyone help?
> thanks
I'd consider this a VeryBadIdea(tm). However, given Python's
introsp