A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-September/128826.html below:

[Python-Dev] Use an empty def as a lambda

[Python-Dev] Use an empty def as a lambda [Python-Dev] Use an empty def as a lambdaBen Finney ben+python at benfinney.id.au
Sat Sep 21 21:56:02 CEST 2013
Westley Martínez <anikom15 at gmail.com> writes:

> My reasoning is that we use class to make classes, lambda to make
> lambda functions, and def to make--well not defs--functions, which
> doesn't really make sense to me.

Your reasoning is flawed. There is no such thing in Python as a “lambda
function”.

Python has functions. It doesn't matter whether you use a ‘lambda’ or
‘def’ statement to create it, there's no resulting difference in the
type of the object. It is a function.

So: you make a class with a ‘class’ statement; you make a function using
either a ‘def’ statement or a ‘lambda’ expression. There is no third
type of object being discussed here.

-- 
 \         “Faith may be defined briefly as an illogical belief in the |
  `\                  occurrence of the improbable.” —Henry L. Mencken |
_o__)                                                                  |
Ben Finney

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4