Re: mapping None values to ''

2006-06-19 Thread imho
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. :

Re: mapping None values to ''

2006-06-18 Thread Steven Bethard
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

Re: mapping None values to ''

2006-06-18 Thread Scott David Daniels
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]] -- --

Re: mapping None values to ''

2006-06-18 Thread Max Erickson
"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)] ['', ''

Re: mapping None values to ''

2006-06-18 Thread Roberto Bonvallet
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

Re: mapping None values to ''

2006-06-18 Thread Jean-Paul Calderone
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?

Re: mapping None values to ''

2006-06-18 Thread Gerard Flanagan
[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):

Re: mapping None values to ''

2006-06-18 Thread imho
[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

Re: mapping None values to ''

2006-06-18 Thread Tim Chase
> 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