lambda question

Andrew Koenig ark at research.att.com
Wed Mar 12 14:51:19 CET 2003


Max> One could even argue that it is even more readable to skip the lambda
Max> alltogether:

Max>      s = 'The Title'
Max>      title_tag = '<title> %s </title>'
Max>      print title_tag % s

>>>> <title> The Title </title>

Max> If it is simple enough to put into a lambda, it is probably simple
Max> enough to just use string substitution directly.

One could argue that way.  One could also argue that by using string
substitution directly, one makes it more difficult to change the
program in the future to do something that direct string substitution
can't handle, especially if title_tag is used in many places in the
program.

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list