GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • [Python-Dev] PEP 8: Discourage named lambdas?
  • [ date ]
  • [ thread ]
  • [ subject ]
  • [ author ]

This view

  • Original page
  • New address

GeezerVison is showing mail.python.org — [Python-Dev] PEP 8: Discourage named lambdas?

[Python-Dev] PEP 8: Discourage named lambdas?

Brett Cannon brett at python.org
Sat May 3 02:24:27 CEST 2008

  • Previous message: [Python-Dev] Dotted/indexed defs ? Re: PEP 8: Discourage named lambdas?
  • Next message: [Python-Dev] PEP 8: Discourage named lambdas?
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

On Sat, May 3, 2008 at 1:03 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> Some people write
>     somename = lambda args: expression
>  instead of the more obvious (to most people) and, dare I say, standard
>     def somename(args): return expression
>
>  The difference in the result (the only one I know of) is that the code and
>  function objects get the generic name '<lambda>' instead of the more
>  informative (in repr() output or tracebacks) 'somename'.  I consider this a
>  disadvantage.
>
>  In the absence of any compensating advantages (other than the trivial
>  saving of 3 chars), I consider the def form to be the proper Python style
>  to the point I think it should be at least recommended for the stdlib in
>  the Programming Recommendations section of PEP 8.
>
>  There are currently uses of named lambdas at least in urllib2.  This to me
>  is a bad example for new Python programmers.
>
>  What do our style mavens think?

+1.

-Brett

  • Previous message: [Python-Dev] Dotted/indexed defs ? Re: PEP 8: Discourage named lambdas?
  • Next message: [Python-Dev] PEP 8: Discourage named lambdas?
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

More information about the Python-Dev mailing list
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.