map() question...

Bengt Richter bokr at
Mon Jan 13 04:15:41 CET 2003

On Sun, 12 Jan 2003 18:50:29 -0800, Erik Max Francis <max at> wrote:

>Mike Meyer wrote:
>> "Kevin Ethridge" <kevinethridge at> writes:
>> > Why doesn't map() work with the print function?
>> > ie map(print, ['Have', 'a', 'great', 'day.'])
>> Because print isn't a function, it's a statement. It will work with
>> sys.stdout.write.
>Only if wrapped in a lambda.  Don't forget that trailing newline that's
>implicit in a print statement (one with no trailing comma, anyway):
>	lambda x: sys.stdout.write(x + '\n')
And then there's softspace ;-)

Bengt Richter

More information about the Python-list mailing list