Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

What the scientists have in their briefcases is terrifying. -- Nikita Khruschev


devel / comp.lang.python / Re: Why does not Python accept functions with no names?

SubjectAuthor
* Re: Why does not Python accept functions with no names?Abdur-Rahmaan Janhangeer
`* Re: Why does not Python accept functions with no names?Greg Ewing
 +- Re: Why does not Python accept functions with no names?Avi Gross
 +- Re: Why does not Python accept functions with no names?Chris Angelico
 +- Re: Why does not Python accept functions with no names?Eryk Sun
 +- Re: Why does not Python accept functions with no names?Avi Gross
 `- Re: Why does not Python accept functions with no names?Abdur-Rahmaan Janhangeer

1
Re: Why does not Python accept functions with no names?

<mailman.158.1645378047.7010.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17105&group=comp.lang.python#17105

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: arj.pyt...@gmail.com (Abdur-Rahmaan Janhangeer)
Newsgroups: comp.lang.python
Subject: Re: Why does not Python accept functions with no names?
Date: Sun, 20 Feb 2022 21:27:14 +0400
Lines: 13
Message-ID: <mailman.158.1645378047.7010.python-list@python.org>
References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de R4iRgYpjLO+YlF9riXuvBgkcqlgUKvgUTGxhecLELdqQ==
Return-Path: <arj.python@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=fF2qz5oI;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'url-ip:140.82/16': 0.03;
'subject:Why': 0.07; 'cc:addr:python-list': 0.09; 'subject:not':
0.09; 'subject:Python': 0.12; 'url:github': 0.14; 'url-ip:140/8':
0.15; 'cc:name:python': 0.16; 'from:addr:arj.python': 0.16;
'from:name:abdur-rahmaan janhangeer': 0.16; 'janhangeer': 0.16;
'mauritius': 0.16; 'subject:does': 0.16; 'python': 0.16; 'github':
0.17; 'name.': 0.19; 'cc:addr:python.org': 0.20; 'exception':
0.22; 'cc:2**0': 0.25; 'url-ip:51/8': 0.26; 'function': 0.27;
'blog': 0.30; 'message-id:@mail.gmail.com': 0.32; 'header:In-
Reply-To:1': 0.34; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; 'received:209.85': 0.37; 'thanks':
0.38; 'received:209': 0.39; 'received:209.85.208': 0.39; 'above':
0.62; 'pass': 0.64; 'well': 0.65; '100%': 0.66; 'anonymous': 0.76;
'deliberately': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=r+GgT6P39i3VYgkimuCK7hLZX4RJcB1WRgkAUn47o7M=;
b=fF2qz5oISQMuV/DYMSHPHeyYglhoe0MAciuyxkmrCXCGBqqA0AlddYWCzVxgYKHYE/
pMT3ac7jSD50+CecOXoTzLe7QqWk1ZHBLU7RD78BF2W+suLumA1sgCZThbjARq8StAQs
NkMVPnV8KRtZ+Khp2WcIJtQ+wnplWxj8U5VOMeKX3O6ndRSAvjzHACiMRFDheE9u+xJI
hdrC6ZoZoSk46hb2rKJH9Oao5fdEJsiojbq1+6WwtBywAkR10UWpkjq+OiW5VB5B07JG
TXXebe+TbgptRHrjf3erSIZWkQj7QEzKKMVByviynLTIZ0+Mumu+sdUAHtHtDeOWeXro
feHw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=r+GgT6P39i3VYgkimuCK7hLZX4RJcB1WRgkAUn47o7M=;
b=W+q6Fngl2335qyIOKKouxMAWfte4b9wdsiuGSjGGcSM3rwXs4sjYbbFaEItcgI5b/m
zyR6yd3oAXOiWDZgAFpKxezUZgWccj8l8sIcmuJoISGfC5iNQLc2r+PcP6tEp18Of8cX
Baix7iJFmDkgGlxpGta4LKn5c9B+tWwLVPTC8L3IJtyqRiNfOeHqIm9y9Y3SIyNtPX6f
HCdx7CVkJM3pu9fh+yVTy0izehVqdC5aWeex85Ar+ExIsqXyyb1LGjJ9yj0LzIj9zu79
JHdbbF3fFzseBNugC/Nlp8h8mEgUjIvK8Ig6SvJbDlFuBIYyHnHUOYfiSHkXSr6d0Nkj
kYWA==
X-Gm-Message-State: AOAM530DGG7xnSNEWBBKAEIzTFqEIEA/4hs3B/j0ZXu9fnx9wTTIaUz6
i5/RRbJYxAMtnqCy1QomjG11gDEcrka3hGEfA54bqL6hAHs=
X-Google-Smtp-Source: ABdhPJyL2ZO8He3yLxSdbtyr+vBhZ+P0gTyNToYnFupaKsQzhv9BoRaSTj+XybvTmrQoLRY1BsE95ywpo3H+ovAJ7TQ=
X-Received: by 2002:a05:651c:179d:b0:244:c216:5598 with SMTP id
bn29-20020a05651c179d00b00244c2165598mr12531659ljb.484.1645378045744; Sun, 20
Feb 2022 09:27:25 -0800 (PST)
In-Reply-To: <CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
X-Mailman-Original-References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
 by: Abdur-Rahmaan Janhan - Sun, 20 Feb 2022 17:27 UTC

Thanks for the answers.

@Chris Well Python deliberately throws an exception if we do not
pass in a function name. Just wanted to know why it should. As the
above case is a 100% pure anonymous function.

Kind Regards,

Abdur-Rahmaan Janhangeer
about <https://compileralchemy.github.io/> | blog
<https://www.pythonkitchen.com>
github <https://github.com/Abdur-RahmaanJ>
Mauritius

Re: Why does not Python accept functions with no names?

<j7ft0hF84ovU1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17114&group=comp.lang.python#17114

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: Why does not Python accept functions with no names?
Date: Mon, 21 Feb 2022 11:17:53 +1300
Lines: 25
Message-ID: <j7ft0hF84ovU1@mid.individual.net>
References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net uh1eWRA6huwrhqkH5a1PYw5w7+AztJFcZr6NOqGHdExrzXcb1O
Cancel-Lock: sha1:Sa3bHntMdDMtuIXb3/47AR+4Fic=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Content-Language: en-US
In-Reply-To: <mailman.158.1645378047.7010.python-list@python.org>
 by: Greg Ewing - Sun, 20 Feb 2022 22:17 UTC

On 21/02/22 6:27 am, Abdur-Rahmaan Janhangeer wrote:
> Well Python deliberately throws an exception if we do not
> pass in a function name. Just wanted to know why it should. As the
> above case is a 100% pure anonymous function.

The syntax for a function definition is defined in the grammar
as requiring an identifier. An identifier in turn is defined
as consisting of at least one character. So the grammar would
need to be changed to make the name optional. Also, the
compiler would need a special case to treat a missing name
there as though it were an empty string.

So again, why *should* it be allowed, given that the parser and
compiler would have to go out of their way to treat it as a
special case, only to create a function that there is no
easy way to call?

BTW, this is not what is usually meant by the term "anonymous
function". An anonymous function is one that is not bound
to *any* name. The thing you're proposing wouldn't be
anonymous -- it would have a name, that name being the empty
string.

--
Greg

Re: Why does not Python accept functions with no names?

<mailman.170.1645422419.7010.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17119&group=comp.lang.python#17119

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: avigr...@verizon.net (Avi Gross)
Newsgroups: comp.lang.python
Subject: Re: Why does not Python accept functions with no names?
Date: Mon, 21 Feb 2022 05:46:53 +0000 (UTC)
Lines: 45
Message-ID: <mailman.170.1645422419.7010.python-list@python.org>
References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
<2097576864.290697.1645422413705@mail.yahoo.com>
Reply-To: Avi Gross <avigross@verizon.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de wdGNZcCfLuevx6m0a43thwvzmAlt6msT9k0Pq1Nr6DkA==
Return-Path: <avigross@verizon.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=verizon.net header.i=@verizon.net header.b=KAv1iJr3;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.018
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '2022': 0.05;
'subject:Why': 0.07; 'sun,': 0.07; 'compiler': 0.09; 'meant':
0.09; 'proposing': 0.09; 'string,': 0.09; 'subject:not': 0.09;
'subject:Python': 0.12; '&gt;': 0.14; 'url:mailman': 0.15;
'syntax': 0.15; 'that.': 0.15; 'accessed': 0.16; 'function..':
0.16; 'functions,': 0.16; 'greg': 0.16; 'janhangeer': 0.16;
'received:74.6.133.40': 0.16;
'received:sonic305-1.consmr.mail.bf2.yahoo.com': 0.16;
'subject:does': 0.16; 'wrote:': 0.16; 'python': 0.16; 'feb': 0.17;
'name.': 0.19; 'to:addr:python-list': 0.20; 'exception': 0.22;
'to:name:python-list@python.org': 0.24; 'skip:- 10': 0.25; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25; 'again,': 0.26;
'function': 0.27; 'sense': 0.28; 'it,': 0.29; 'am,': 0.31; 'url-
ip:188/8': 0.31; 'elements': 0.32; 'empty': 0.32; 'requiring':
0.32; 'structure': 0.32; "wouldn't": 0.32; 'but': 0.32; 'there':
0.33; 'able': 0.34; 'header:In-Reply-To:1': 0.34; 'one.': 0.35;
'also,': 0.36; 'functions': 0.36; 'missing': 0.37; 'special':
0.37; 'though': 0.37; 'way': 0.38; 'least': 0.39; 'list': 0.39;
'something': 0.40; 'want': 0.40; 'above': 0.62; 'from:': 0.62;
'to:': 0.62; 'pass': 0.64; 'definition': 0.64; 're:': 0.64;
'received:74.6.133': 0.64; 'well': 0.65; 'named': 0.65; 'let':
0.66; '100%': 0.66; '20,': 0.67; 'accept': 0.67; 'end,': 0.69;
'easy': 0.74; 'name,': 0.75; 'anonymous': 0.76; 'treat': 0.76;
'sent:': 0.78; 'header:Reply-To:1': 0.79; 'allowed,': 0.84;
'consisting': 0.91; 'deliberately': 0.91; 'grammar': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verizon.net; s=a2048;
t=1645422415; bh=EijUowH73vWyoX19azwy/5cUzoxpQ/rtiZ/yqFY9zes=;
h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject:Reply-To;
b=KAv1iJr3K75OojSi0exKnYB/qLjC0BajsGQOZeRGbZCUUl6DxavXm6ngYDnXrjbnmRwffFWFyUQRb+AsQrT42oFZGnvNQA6v9VEFoTn+x3jCgyRNhAd4QoUho6XEJ0J1RRoup/jsYGA/6dNue+TPy7S6bwAvIrj3q/025PqOXKJ6QfuxntzQwjylMsUCPmFZsXwiAjVzDe9bRTRIiSfgn62M4kWDQWTdYRhntuJm0j/MWVjWermLO7oJJW+3n1FU8YFeLnFFmDuRkdQtNb2qi1oRqipaCjxHXW1VRYiU2w5ponX3tllcf7KE1iIaNe1wHGOjlLMBKQd6uD7GLeTmkw==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1645422415; bh=iOqXGFzkp53C2YTi8wDldZbB4h+jr8y+Hdp5KYQoIh+=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hdYr2a4T._hT.tLxZ6a.k_v5IdBWHr4S2XATFCCWqCN9XAylJiIsO2ThOkuAHc6jU
7lXzDtQ2LM86C9_X6QRN6f7YTqqqYir8kSw9AsWltogUEa.83HU_0R4x7vZhSqKqMo.TzMgwGnun
vPQBbwFyrcy_OyIEcUuW2Z6cX.8SJ_9IpGc.Ti2TWomIsbsJb3NbqQEG6EME1xfuNCwxVYHB08gy
nbigj4C3UQuyYmw0hp8ZOBT_4ZC6O5bS8H6AQ4rlYKfsuodwGFFsySxTACMn05BNn0AWM76ozQ0I
Aox7hkmYg_nGadQ21Iqk_2LWe.gsaxZbhJpCQ66NT_.7fSiAbBwjSYHxnrB6ZJC2Rbe0WwxpFeDH
nhkGbE5Wz7ISfJTVMv1n0.606S3u.I3N2ns9EEqA5_fIycY4UfFnOv9HJy4xEtbLqhDsJjJi.276
w8inEgbLrzifoOmNdJrrNkbeBEVar_PB2Fmrb4d14yDYVKBTiBrQBls0ZW_JRnbc1PmqUhqUttzw
L6rMJjQtplwHtZqKWqx0zw8QKNQ--
X-Sonic-MF: <avigross@verizon.net>
In-Reply-To: <j7ft0hF84ovU1@mid.individual.net>
X-Mailer: WebService/1.1.19797 aolwebmail
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <2097576864.290697.1645422413705@mail.yahoo.com>
X-Mailman-Original-References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
 by: Avi Gross - Mon, 21 Feb 2022 05:46 UTC

Amusingly, Greg, if you had a system where the un-named anonymous function was to be named the unique value of the empty string, then a second such anonymous function definition would over-write it, as with any named function.. The kind of anonymous function we are more used to might be something you can create as say elements of a list so you have a list of functions you can access as in f[0] but in a sense that has a name as it can be accessed as a component of the data structure called f.  I am not sure if python would trivially let you create that. But the point is if you want to be able to make many such pseudo-anonymous functions, in the end, there can only be one.

-----Original Message-----
From: Greg Ewing <greg.ewing@canterbury.ac.nz>
To: python-list@python.org
Sent: Sun, Feb 20, 2022 5:17 pm
Subject: Re: Why does not Python accept functions with no names?

On 21/02/22 6:27 am, Abdur-Rahmaan Janhangeer wrote:
> Well Python deliberately throws an exception if we do not
> pass in a function name. Just wanted to know why it should. As the
> above case is a 100% pure anonymous function.

The syntax for a function definition is defined in the grammar
as requiring an identifier. An identifier in turn is defined
as consisting of at least one character. So the grammar would
need to be changed to make the name optional. Also, the
compiler would need a special case to treat a missing name
there as though it were an empty string.

So again, why *should* it be allowed, given that the parser and
compiler would have to go out of their way to treat it as a
special case, only to create a function that there is no
easy way to call?

BTW, this is not what is usually meant by the term "anonymous
function". An anonymous function is one that is not bound
to *any* name. The thing you're proposing wouldn't be
anonymous -- it would have a name, that name being the empty
string.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Re: Why does not Python accept functions with no names?

<mailman.171.1645423252.7010.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17120&group=comp.lang.python#17120

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: Why does not Python accept functions with no names?
Date: Mon, 21 Feb 2022 17:00:39 +1100
Lines: 50
Message-ID: <mailman.171.1645423252.7010.python-list@python.org>
References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
<2097576864.290697.1645422413705@mail.yahoo.com>
<CAPTjJmp=iKWgWhqL7tpnLrCJx4JJxOs8xyp6vjFw1q2+1qRCdA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de yIoj248EN3khgPNbnA+1qgFRplSMHLJmLVrpWgZsPbpg==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=adIqocay;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.020
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'def': 0.04; '2022': 0.05;
'subject:Why': 0.07; 'string,': 0.09; 'subject:not': 0.09;
'subject:Python': 0.12; 'that.': 0.15; 'accessed': 0.16;
'arbitrary': 0.16; 'attributes': 0.16; 'attributes,': 0.16; 'avi':
0.16; 'chrisa': 0.16; 'frequently': 0.16; 'from:addr:rosuav':
0.16; 'from:name:chris angelico': 0.16; 'functions,': 0.16;
'gross': 0.16; 'subject:does': 0.16; 'wrote:': 0.16; 'python':
0.16; 'feb': 0.17; "aren't": 0.19; 'name.': 0.19; 'to:addr:python-
list': 0.20; 'skip:_ 10': 0.22; 'to:name:python-list@python.org':
0.24; '(and': 0.25; 'function': 0.27; '>>>': 0.28; 'sense': 0.28;
'it,': 0.29; 'looked': 0.31; "doesn't": 0.32; 'elements': 0.32;
'empty': 0.32; 'python-list': 0.32; 'structure': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; 'there': 0.33; 'able':
0.34; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'fine': 0.35; 'one.': 0.35; 'from:addr:gmail.com': 0.35;
'functions': 0.36; 'mon,': 0.36; 'name:': 0.37; 'necessarily':
0.37; "it's": 0.37; 'received:209.85': 0.37; 'way': 0.38;
'received:209': 0.39; 'two': 0.39; 'least': 0.39; 'list': 0.39;
'still': 0.40; 'double': 0.40; 'something': 0.40; 'want': 0.40;
'lack': 0.60; "there's": 0.61; 'simply': 0.63; 'definition': 0.64;
'named': 0.65; 'let': 0.66; 'shows': 0.67; 'per': 0.68; 'end,':
0.69; 'etc,': 0.69; 'them,': 0.70; 'interesting': 0.71; 'little':
0.73; 'name,': 0.75; 'anonymous': 0.76; 'names,': 0.81; 'up,':
0.84; 'absolutely': 0.84; 'attribute': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:content-transfer-encoding;
bh=scq3iiqpBjK26hc6vNKdhQDR1D4UO29l8GBFbSP0mlA=;
b=adIqocaykzYR51S39YtQzTuXMNP7si8+0TTakpFKXOWm8/Je+jRRYiSpU5hTQENmfg
vSmPESt9Hr7SoCIyme3qtMpfUFBM5PkmdTS9Q0gvW9jxv5T79dieB1UCVCIBdXWJBGQF
hyOmUqqIczKxJF2MGN55LbccgTSFgMBbWkm4XipBJOqUbkYEJTPTuGIsmXci4H2xG/cb
1BIW0isQRtj0xGrIqPB/gLy/sRxj7cIaOh6w0yoI8OY1Mrt48xzXsuctwMmIpNkiZBB8
SjBwwYI+mLukrIrRzrLObMG9b/MGSndkDSWy2e8vCPhVhsIAtuW3aN8YOlgSmtd58D5p
EoiA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:content-transfer-encoding;
bh=scq3iiqpBjK26hc6vNKdhQDR1D4UO29l8GBFbSP0mlA=;
b=Om4TLaFsHgaY5cLDbrrqdch9SgOVSIF3sYQupyRuV+CYzk3ZVdF/4ZkgjOdGNQIqQ6
bxG/3mpKLpSeR6uwqEX59/LUbhSHQj3ydtVNhKyKf/75N9OmRve+kBmyiJOV5nCwP2Oz
AdDpi4QttmxBOw81fQkzMrX1XvtQRo2i+j+eL9v/1GfRXrakKtcQYrQZ1jUA50DT34pc
F+7/uL3SdVZIyWZRQxlUr9Kok4GDLUfeAafSXTtfwfIMIsrFnKv1hbRhZorZpuBJX8S/
j22S39vSgWu3wE3Rt9vPVTEt+16X9vIvlGLaAOtWYjUtu4kaZEKrk+hC/mbgQ1OyRkbT
prjA==
X-Gm-Message-State: AOAM530K9tOE4qnjgOl1KcLI+c6UfDinLB2Xw3u/5HskFloZZuVL8h+h
L41c0GhIvdAoVumws6Syq72w6pm/HuvaDlF+86aU76DrTW8=
X-Google-Smtp-Source: ABdhPJxqwOQSmaoOn2FWHnzs2qEVktC7sUq/pZiy02uROKt8LtybfBaWUODNAxnf9QyrRtkRusJoSewU9YBLsiNV4Pw=
X-Received: by 2002:a5d:408c:0:b0:1e3:23a9:799f with SMTP id
o12-20020a5d408c000000b001e323a9799fmr13962425wrp.104.1645423250693; Sun, 20
Feb 2022 22:00:50 -0800 (PST)
In-Reply-To: <2097576864.290697.1645422413705@mail.yahoo.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmp=iKWgWhqL7tpnLrCJx4JJxOs8xyp6vjFw1q2+1qRCdA@mail.gmail.com>
X-Mailman-Original-References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
<2097576864.290697.1645422413705@mail.yahoo.com>
 by: Chris Angelico - Mon, 21 Feb 2022 06:00 UTC

On Mon, 21 Feb 2022 at 16:48, Avi Gross via Python-list
<python-list@python.org> wrote:
>
> Amusingly, Greg, if you had a system where the un-named anonymous function was to be named the unique value of the empty string, then a second such anonymous function definition would over-write it, as with any named function. The kind of anonymous function we are more used to might be something you can create as say elements of a list so you have a list of functions you can access as in f[0] but in a sense that has a name as it can be accessed as a component of the data structure called f. I am not sure if python would trivially let you create that. But the point is if you want to be able to make many such pseudo-anonymous functions, in the end, there can only be one.
>

Functions in Python have two different concepts of "name", which
aren't always the same. One is the way that you refer to it; the other
is its __name__ attribute (and related attributes like __qualname__).
An anonymous function doesn't necessarily have to lack a name, per se;
it simply doesn't have a very interesting name:

>>> (lambda: 1).__name__
'<lambda>'
>>> (lambda: 2).__name__
'<lambda>'
>>> (lambda: 3).__name__
'<lambda>'

If you want to refer to them as f[0] etc, they can have arbitrary
names, which may or may not themselves be meaningful. I frequently
build a dictionary or list of functions by decorating standard 'def'
statements:

funcs = []

@funcs.append
def spam(): ...
@funcs.append
def ham(): ...

They still have __name__ attributes, but it's absolutely fine to
double them up, since they're going to be looked up via the list.
(Though there's still value in having at least *some* name on them,
since it shows up in backtraces.)

There's very little reason to have a function that actually doesn't
have a name. It's usually fine to give it an arbitrary and meaningless
name.

ChrisA

Re: Why does not Python accept functions with no names?

<mailman.172.1645428920.7010.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17121&group=comp.lang.python#17121

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: eryk...@gmail.com (Eryk Sun)
Newsgroups: comp.lang.python
Subject: Re: Why does not Python accept functions with no names?
Date: Mon, 21 Feb 2022 01:35:17 -0600
Lines: 14
Message-ID: <mailman.172.1645428920.7010.python-list@python.org>
References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
<CACL+1aup1BrEeuFgEpSGK33k8PNWoYQmQSbkfcq95oXEf6ycag@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de W5xcDgXjJLljZou0RHL7VQG0FjBmzzGiwQRrSwrnmaZg==
Return-Path: <eryksun@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=UAuWzOOR;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.006
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'string': 0.07;
'subject:Why': 0.07; 'compiler': 0.09; 'meant': 0.09; 'proposing':
0.09; 'subject:not': 0.09; 'subject:Python': 0.12; 'syntax': 0.15;
'greg': 0.16; 'results,': 0.16; 'sorry.': 0.16; 'subject:does':
0.16; 'useless': 0.16; 'wrote:': 0.16; 'python': 0.16; 'name.':
0.19; 'to:addr:python-list': 0.20; 'language': 0.21; 'doubt':
0.22; 'first,': 0.22; 'past': 0.25; 'function': 0.27; 'empty':
0.32; "wouldn't": 0.32; 'message-id:@mail.gmail.com': 0.32;
"didn't": 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'question.': 0.35;
'from:addr:gmail.com': 0.35; 'errors': 0.36; "it's": 0.37;
'received:209.85': 0.37; 'read': 0.38; 'received:209': 0.39;
'popular': 0.60; 'scanned': 0.64; 'less': 0.65; 'let': 0.66;
'name,': 0.75; 'anonymous': 0.76; 'reply': 0.77; 'statement.':
0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to;
bh=cfS388VSnzvVCLL/1RpkZT+i+BJShuqqWh+zo6I5O3Q=;
b=UAuWzOORZt7d2mo4fYfM0+CkYMUlXL4FnT6gJ4TFGH/J31IOwQczqihPZ49D1CjqgB
90TvuJ1Mu9a/mCcMtzqtGqPXztXZw0lUGQ6MsBXmpF40ahZfpOYaQVFUd2bBoGhoAhuk
dLzX20T7dZ+SELp/Cc/vNWL7gNcLs2OPwxwEvXq/I37DGC+7o9/vBDwJyBS8Nm2EE31K
WfbVRMA4YsR+CJ0mYEPAxAFQ42WiUPEKOUrKYHylCcF+v07Y4p7XBqQzyhMlMx97kEaK
3cTZIV5rNkPenZvORA7cIVrJsEvSq26uoyOwTqDmRGbQ0gdHqmhThojX59xa/GoKUX+V
EWiw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:in-reply-to:references:from:date
:message-id:subject:to;
bh=cfS388VSnzvVCLL/1RpkZT+i+BJShuqqWh+zo6I5O3Q=;
b=HHtec2pURvt9Xygvm4ZOJrcDxmhYoxzd7hIG6ICs42ZqUTAGchseH7/Ig5+VQDWR2U
BpeqfIaYtSwdO9sUAe9g9XqgHSi7GXw8qZ673twDNiLHTJSrgBO8f62+kWrsyRQWNh49
2nNEiZEpd8cfg/FoZ7VMXqIM0Og+2K43Jf3ztlK1alm2vHLuCz+1OHysY5Klq3xIvpre
HBX2gakoA7PenkHBd3uoMO8ktvdE57OgMd2LHyGENuOwF5gOeabvkJ6YpPTKBMNcAHgN
KhjFbf9IEiSPsd4lzu4wr2b/bbKtOtz8qf/BqObSIt87p70TIRiDyzyl3q2dRSX3WdIf
rhlQ==
X-Gm-Message-State: AOAM533wbuHgj3mk1AsXZiAP+jogNh9H7dcTfKWlO3GmxjiiHzepnA08
M2WczFmZ/9AR7LUL1992uvERrQznuAVS19oUqirPR0Wm
X-Google-Smtp-Source: ABdhPJzhtOmPua6fPNZ76qObML49ISh3oblUQUO5iYJ7OM17tdla2i1NdFeLU7D2Wdm6WwtaNjeQWKbcBC2fA1cqn2I=
X-Received: by 2002:a63:cd49:0:b0:373:5fbb:c790 with SMTP id
a9-20020a63cd49000000b003735fbbc790mr15455453pgj.206.1645428918290; Sun, 20
Feb 2022 23:35:18 -0800 (PST)
In-Reply-To: <j7ft0hF84ovU1@mid.individual.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CACL+1aup1BrEeuFgEpSGK33k8PNWoYQmQSbkfcq95oXEf6ycag@mail.gmail.com>
X-Mailman-Original-References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
 by: Eryk Sun - Mon, 21 Feb 2022 07:35 UTC

On 2/20/22, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
>
> BTW, this is not what is usually meant by the term "anonymous
> function". An anonymous function is one that is not bound
> to *any* name. The thing you're proposing wouldn't be
> anonymous -- it would have a name, that name being the empty
> string.

Sorry. I read Avi's reply first, scanned the original post and didn't
consider the literal question. I doubt that Python would have become a
popular language if it allowed the empty string as an identifier. That
would let common syntax errors slip past the compiler with useless
results, e.g `= 1`, `c. = 1`. It's no less absurd in a `def`
statement.

Re: Why does not Python accept functions with no names?

<mailman.174.1645463373.7010.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17123&group=comp.lang.python#17123

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: avigr...@verizon.net (Avi Gross)
Newsgroups: comp.lang.python
Subject: Re: Why does not Python accept functions with no names?
Date: Mon, 21 Feb 2022 17:09:27 +0000 (UTC)
Lines: 75
Message-ID: <mailman.174.1645463373.7010.python-list@python.org>
References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
<CACL+1aup1BrEeuFgEpSGK33k8PNWoYQmQSbkfcq95oXEf6ycag@mail.gmail.com>
<1789599238.380432.1645463367458@mail.yahoo.com>
Reply-To: Avi Gross <avigross@verizon.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de jYy36xI6vhIuVD13BMU25gAJATIv1tlUZ/K8z8DfSPZA==
Return-Path: <avigross@verizon.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=verizon.net header.i=@verizon.net header.b=lvlXOaNs;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '2022': 0.05; 'variable':
0.05; 'happened': 0.07; 'matching': 0.07; 'partial': 0.07;
'string': 0.07; 'subject:Why': 0.07; 'compiler': 0.09;
'construct': 0.09; 'fails': 0.09; 'language,': 0.09; 'meant':
0.09; 'prints': 0.09; 'proposing': 0.09; 'skip:` 10': 0.09;
'subject:not': 0.09; 'suggestion,': 0.09; 'typically': 0.09;
'subject:Python': 0.12; 'url:mailman': 0.15; 'syntax': 0.15;
'that.': 0.15; '(1,': 0.16; '(after': 0.16; 'amusing': 0.16;
'context.': 0.16; 'defined.': 0.16; 'eryk': 0.16; 'expected.':
0.16; 'found,': 0.16; 'greg': 0.16; 'ignored': 0.16;
'interpreter': 0.16; 'nonsense': 0.16; 'over,': 0.16; 'pointers':
0.16; 'results,': 0.16; 'reused': 0.16; 'says:': 0.16;
'something.': 0.16; 'sorry.': 0.16; 'structures': 0.16;
'subject:does': 0.16; 'typing': 0.16; 'useless': 0.16; 'wrote:':
0.16; 'python': 0.16; 'feb': 0.17; 'uses': 0.19; 'calls': 0.19;
'it?': 0.19; 'name.': 0.19; 'to:addr:python-list': 0.20;
'language': 0.21; 'machine': 0.22; 'languages': 0.22; 'creates':
0.22; 'doubt': 0.22; 'first,': 0.22; 'version': 0.23; 'code':
0.23; 'to:name:python-list@python.org': 0.24; 'anything': 0.25;
'past': 0.25; 'skip:- 10': 0.25; 'url-ip:188.166.95.178/32': 0.25;
'url-ip:188.166.95/24': 0.25; 'python,': 0.25; 'url:listinfo':
0.25; 'url-ip:188.166/16': 0.25; 'seems': 0.26; 'creating': 0.27;
'function': 0.27; 'done': 0.28; 'expect': 0.28; 'sense': 0.28;
'recently': 0.29; 'asked': 0.29; 'error': 0.29; 'url-ip:188/8':
0.31; 'wondering': 0.31; 'question': 0.32; 'empty': 0.32;
'language.': 0.32; "wouldn't": 0.32; 'but': 0.32; 'there': 0.33;
'same': 0.34; "didn't": 0.34; 'mean': 0.34; 'header:In-Reply-
To:1': 0.34; 'complex': 0.35; 'meaning': 0.35; 'question.': 0.35;
'errors': 0.36; 'functions': 0.36; 'mon,': 0.36; 'special': 0.37;
"it's": 0.37; 'way': 0.38; 'could': 0.38; 'put': 0.38; 'simply':
0.63; 'accessing': 0.64; 'definition': 0.64; 'imagine': 0.64;
're:': 0.64; 'received:74.6.133': 0.64; 'scanned': 0.64; 'thus':
0.64; 'parts': 0.65; 'less': 0.65; 'let': 0.66; 'shows': 0.67;
'caught': 0.67; 'accept': 0.67; 'away': 0.67; 'items': 0.68;
'operations': 0.68; 'counter': 0.69; 'times': 0.69; 'within':
0.69; 'above,': 0.70; 'resulting': 0.70; 'them,': 0.70; 'care':
0.71; 'name,': 0.75; '....': 0.76; 'anonymous': 0.76;
'implemented': 0.76; 'languages,': 0.76; 'reply': 0.77; 'sent:':
0.78; 'highly': 0.78; 'header:Reply-To:1': 0.79; 'happens': 0.84;
'allowed,': 0.84; 'clue': 0.84; 'experiment': 0.84; 'forgot':
0.84; 'harmless': 0.84; 'meaning.': 0.84; 'retains': 0.84;
'statement.': 0.84; 'deliberately': 0.91; 'exists': 0.91; 'last.':
0.91; 'replacing': 0.91; 'aspects': 0.93; 'seemingly': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verizon.net; s=a2048;
t=1645463371; bh=HQP5Dcq5nZ9AQZ2hWYTuF8faw3U0Xpl/GEaEgQnr9a4=;
h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject:Reply-To;
b=lvlXOaNsUO58m4VDYKm9orYt4hNuVtGZ67Y1OS9ByY6QZjPBaxG93/wQthaFeNlOeV3QqRbNr0y3rgA6xp+SdavOcIHD7hpT2LfCMKWYyyUXjvgc6N05Gs/Ph2ez5969VIxbOdyxpp07VgzidqTqSh9IG0Wr93r9if/QFpkdUZHqQXWdpP5+4BLQP+4OtcjqeWHlUtQYfe7ak22Sszs5DMvXyyKwaBxgZU/aULWz5aNhlRryl7f/1MkSczr3wMKT74FI4mfil8Ow8HtxF5hfWsn8LAKSD8x4wSZ1HefgSf2bT3XOeBBr4xhRl9EFk3b5I0CZhsyFoLcjebV5zAjqzA==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1645463371; bh=TdDdLJAUbILpsAhzFiThC4avCyI/l8S6zAmzWgMwHD2=;
h=X-Sonic-MF:Date:From:To:Subject:From:Subject;
b=XvQwuAcjFCxWlCcP1zewD09jpvQGeDmZNmbwaIRwNurjK3J4+wap5P1LRes77qq0wKlMS1Tum1aZnypOmnUXBx53JD1jsPXN1JuXXqsF35WxsYydnee/5YlRNkwStcOp1iiK0xyM0IpsJEO+8tKXw78YZ1hPbKXf6+VVN4939HL7Bc3B1jU/+LqdsDNrlIsXTHo6i1C3eaP5OhBrmI+MKskbZsNH4o5xg8aYef9Bxm28HLJFW4nrr0FWUFioN5D4WHAD2WBeLvGGYEfl7mWAPYTuqpdlDwEALOl7/YsHcidbkK1lPrOTGkIKi3tn4ds+OuBRtxwkXvX1eibprVNDoA==
X-YMail-OSG: ALOBzpUVM1nYux22pSMjjsyCSTzpd3r2E0gEsDP4d6fbcIYdKDA_BRowVY.fX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gJlkSwgM2tAFSinTFMPUkNwy1zcr3tEOdTr3BgIH.QMbXuhak8eprNgZj3ZW43WQ.uL8Y
-
X-Sonic-MF: <avigross@verizon.net>
In-Reply-To: <CACL+1aup1BrEeuFgEpSGK33k8PNWoYQmQSbkfcq95oXEf6ycag@mail.gmail.com>
X-Mailer: WebService/1.1.19797 aolwebmail
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <1789599238.380432.1645463367458@mail.yahoo.com>
X-Mailman-Original-References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
<CACL+1aup1BrEeuFgEpSGK33k8PNWoYQmQSbkfcq95oXEf6ycag@mail.gmail.com>
 by: Avi Gross - Mon, 21 Feb 2022 17:09 UTC

Eric,
You bring up a related topic which I agree with. You need to be careful to make aspects of a language as consistent as possible and thus allowing no receiver of a function definition (somewhat different than no name) might result in anomalies in other parts of the language. Errors that could be caught would be accepted, even if teh resulting code was nonsense.
Some languages use a real placeholder such as "_" (single underscore) to represent an I DON'T CARE scenario meaning I do not want to provide a name and Python allows code like:
(a, _, c, _, e) = (1, 2, 3, 4, 5)
print(a, _, c, _, e)1 4 3 4 5
The above code snippet suggests that _ is allowed to be used multiple times and retains whatever is done last. But an experiment shows there is nothing special about underscore as a name in that replacing it with an x above gets the same results. It may not be implemented at the interpreter level as "throw away" or skip over, but I can imagine languages implementing just that. In the above, certainly, the reading in of the number 2 may have happened and the variable reused leaves it without one of the pointers to it.
But consider what happens if the matching above was to more complex items like function calls that may have all kinds of effects and side effects.  I may want to throw away the results returned, but may want the side effect. 
So in a sense the question being asked might have a partial suggestion, in Python, to simply provide a clue when creating the function to have the name _, albeit I still keep wondering WHY you want that.
Consider other things like a language in which just typing the name of a variable has no meaning. I mean it does not autoprint. If a line by itself says:
myvar
It typically starts a search for whatever method the language uses to find that name in their data structures to determine if it exists in the current context. If not found, you expect an error message. But even if found, what does one do with it? In some languages, there seems to be no point in even accessing it and it seems to be anything from harmless code to be ignored or an error because it is not a valid construct and the user may have meant to say myvar = 6 or something. But in a language like Python, it may have some impact just from being invoked such as incrementing a counter within an object. If you want to have such functionality in the language, you now have to allow it. And one way to support this is to make believe you typed print(myvar) which on my machine fails when myvar is not defined. When it is, it prints what it can. This works even when I ask for seemingly useless operations like "()" which creates and then (after the print) ignores an empty tuple. 
Anonymous functions arguably have an important place in many languages and I keep seeing languages adding some version of them or new syntax for them, as R recently did. But they are best used when made deliberately and the example we are given seems highly likely to be a mistake where the user forgot to put in a name where it was expected. At the very least it may merit a WARNING. Or, if allowed, I wonder if the interpreter should perhaps do something amusing like give it some long nonsense name and notify the user that in case they actually wanted a real function, it is now mxyzptlk666 ...

-----Original Message-----
From: Eryk Sun <eryksun@gmail.com>
To: python-list@python.org
Sent: Mon, Feb 21, 2022 2:35 am
Subject: Re: Why does not Python accept functions with no names?

On 2/20/22, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
>
> BTW, this is not what is usually meant by the term "anonymous
> function". An anonymous function is one that is not bound
> to *any* name. The thing you're proposing wouldn't be
> anonymous -- it would have a name, that name being the empty
> string.

Sorry. I read Avi's reply first, scanned the original post and didn't
consider the literal question. I doubt that Python would have become a
popular language if it allowed the empty string as an identifier. That
would let common syntax errors slip past the compiler with useless
results, e.g `= 1`, `c. = 1`. It's no less absurd in a `def`
statement.
--
https://mail.python.org/mailman/listinfo/python-list

Re: Why does not Python accept functions with no names?

<mailman.175.1645502742.7010.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17126&group=comp.lang.python#17126

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: arj.pyt...@gmail.com (Abdur-Rahmaan Janhangeer)
Newsgroups: comp.lang.python
Subject: Re: Why does not Python accept functions with no names?
Date: Tue, 22 Feb 2022 07:05:27 +0300
Lines: 8
Message-ID: <mailman.175.1645502742.7010.python-list@python.org>
References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
<CADrxXXnUgfZ-pvWWyQwy7FCn8U-F45xmuFsbCe8nPdR5LY6ZZA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de NlqiykVSLLwQaetWpbNYTQ3XMIwRP6djDlkP2Kv4KWNQ==
Return-Path: <arj.python@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=OVTGGTv+;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Why': 0.07;
'cc:addr:python-list': 0.09; 'meant': 0.09; 'proposing': 0.09;
'subject:not': 0.09; 'subject:Python': 0.12; '&gt;': 0.14;
'cc:name:python': 0.16; 'from:addr:arj.python': 0.16; 'from:name
:abdur-rahmaan janhangeer': 0.16; 'subject:does': 0.16; 'name.':
0.19; 'cc:addr:python.org': 0.20; 'cc:2**0': 0.25; 'function':
0.27; 'empty': 0.32; "wouldn't": 0.32; 'message-
id:@mail.gmail.com': 0.32; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'received:209.85': 0.37; 'thanks': 0.38; 'received:209': 0.39;
'name,': 0.75; 'anonymous': 0.76
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=9IsMUu1TaJVfezKNMxCXRbgx0BRXzUl+oFUtPOyJe7E=;
b=OVTGGTv+UzBPgYieL4b5lDdUX8xvo/iSPMWgregOfR3zFzcowmuPd2VV9zlpmKLUKo
ejPEXumy+OxdHvhEbhB7uzMoy8ZzE050g45Bobzt1Ez90328UGSILnm19Z7QpQRmmed1
h9UvIvX5E3BgHBC23mGUxPA2qJpWebVeFAORf5Xkkp96pOfO+HrE5qv+D4isJ97P0Y8v
l4W7NKTgyEeg5tEFbPlbH9iPCUAhyvksindiFM+JbU1hahkTqn7B+njR16vfHatrKBuH
48nPOzNCwAJqsRO6LNnu+LsRyVoDstKtj3YLDW+VRWnEpCjU15CxFjbXYLuVOWlAvBut
i2UA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=9IsMUu1TaJVfezKNMxCXRbgx0BRXzUl+oFUtPOyJe7E=;
b=c1CtnrY2Qbi9Hh7JXhn/g+0ZpVntl+kwENQh7z/mUDa2O3YMRMtjhuo1uuKwGG7vgd
BdfRcLB/INVPFLmLRWAnzfr6nOyYyLIZxLpe0rK3euGj3+Uare+Wafk3CPRwxAmEuf4C
lFkz61IY9s84hcgiB/S4bF4L8nSGRPlaZo01l88Wj4DTyNlm3Ep/LoE5pEq9LbXh4N//
ni2MhRowH/DrnMuGDaW0MrlVm7BNmpWpF/I4yLmjvX9swCApDLN82DcoWQo/gOSwnZqK
Or6RRIHFMxKqP4chl/jvJQWbWFcSnyL10fTMCgjhtO2DNy2QosdW5uUlml1Lb1lf21rp
OfZg==
X-Gm-Message-State: AOAM5305s/2z3R6rKOTFFq0I15kPde8oDgPfEXCBfxj11BS0xOFZvLRJ
3yDLAAnC4SrbpGeUY9ZlyFF2RL3T+JxhRCYl8fXxurDbess=
X-Google-Smtp-Source: ABdhPJzWtVFM0Tpg6KSpZkDRGIc8X0vMdcYpVk8aZfKEpMOteixG7aOMYXQoZGuTe5xtYu6qP6mCD19r4lvSy+tm4Wc=
X-Received: by 2002:ac2:5e2f:0:b0:443:3f6c:35a3 with SMTP id
o15-20020ac25e2f000000b004433f6c35a3mr15500176lfg.292.1645502740108; Mon, 21
Feb 2022 20:05:40 -0800 (PST)
In-Reply-To: <j7ft0hF84ovU1@mid.individual.net>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CADrxXXnUgfZ-pvWWyQwy7FCn8U-F45xmuFsbCe8nPdR5LY6ZZA@mail.gmail.com>
X-Mailman-Original-References: <CADrxXXn+xkO_vZXwqXwL21iLF4LJE+avAnfoXkBe2xV1rZigsQ@mail.gmail.com>
<CAPTjJmrNRa_Ut1NkEx4QDeVxXoXhQM7LETtdA6PZnZpfoOhFTQ@mail.gmail.com>
<CADrxXXmGcWXdVtL3aJr-GXFyp=GD8asz6UuzD=Yi8JxDo9=VYA@mail.gmail.com>
<mailman.158.1645378047.7010.python-list@python.org>
<j7ft0hF84ovU1@mid.individual.net>
 by: Abdur-Rahmaan Janhan - Tue, 22 Feb 2022 04:05 UTC

> BTW, this is not what is usually meant by the term "anonymous
function". An anonymous function is one that is not bound
to *any* name. The thing you're proposing wouldn't be
anonymous -- it would have a name, that name being the empty
string.

Thanks for clarifying this point 👍👍👍

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor