ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
Re: [Tutor] Python Cookbook
by Yigal Duppen other posts by this author
Aug 26 2002 2:46PM messages near this date
[Tutor] Why lambda could be considered evil | [Tutor] books arrived
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>  But what -is- the problem that some people have with lambda?  (You
>  mention that you don't have a problem with it, but that implies that
>  others do.)

Most people favoring lambda have experience in Functional Programming, Lisp 
and/or lambda calculus; people disliking it don't. To them, it probably looks 
obscure. 

>  One last question -- in your final example above, you have an "if"
>  statement FOLLOWING the "main" part of the list comprehension.  Is this
>  a normal Python construction or something that is allowed for list
>  comprehensions only?  I have seen that sort of construction in Perl:

No, the trailing if is only allowed in LCs. Luckily. Furthermore, in LCs the 
if _must_ be trailing; for example, the following is illegal:

[ x if x % 2 == 0 for x in [1,2,3]]

otoh, the following is legal:

[ x for x in [1, 2, 3, 4] if x % 2 == 0 and x < 4 ]

>     print "Correct" if ($correct);

Indeed one of the more horrible examples from Perl ;)

YDD
- -- 
http://www.xs4all.nl/~yduppen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9aj9HLsKMuCf5EdwRAm/rAJ4iZBZZc4RkIbd/KFFPMgyQnwG90QCgpGBB
Flm6MUe7uIKu+zaTxrsXJQw=
=OoD1
-----END PGP SIGNATURE-----


_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Erik Price
Danny Yoo
Erik Price
Yigal Duppen
Erik Price
Scot W. Stevenson
Yigal Duppen

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved