[Tutor] Can't use builtin function objects like user defined objects

Jason Stokes jstok@bluedog.apana.org.au
Sat, 4 Mar 2000 02:53:51 +1100


-----Original Message-----
From: Emile van Sebille <emile@fenx.com>
To: Python Tutor <tutor@python.org>
Date: Thursday, March 02, 2000 8:11 PM
Subject: Re: [Tutor] Can't use builtin function objects like user defined
objects


>As a follow up then, why doesn't this work:
>
>>>> testtext = ['Four', 'lines', 'of', 'text.']
>>>> map(lambda x: x, testtext)
>['Four', 'lines', 'of', 'text.']
>>>> map(lambda x: print x, testtext)
>SyntaxError: invalid syntax


Because Python doesn't allow nested statements in lambda expression.  At
all.

Jason (who figured out the print issue after soon posting, but still wonders
*why*).