Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Love may fail, but courtesy will previal." -- A Kurt Vonnegut fan


devel / comp.lang.python / RE: New assignmens ...

SubjectAuthor
o RE: New assignmens ...Avi Gross

1
RE: New assignmens ...

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

  copy mid

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

  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: New assignmens ...
Date: Mon, 25 Oct 2021 17:41:21 -0400
Lines: 127
Message-ID: <mailman.42.1635198088.23718.python-list@python.org>
References: <MN2PR02MB68461EB83EC01991C31D6752A8839@MN2PR02MB6846.namprd02.prod.outlook.com>
<00a701d7c9e9$0d745650$285d02f0$@verizon.net>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de ROiCb9j5XJShMkpSgUP8SgfewkD/5/w1mTjZ349xE/gQ==
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=KYHvAcg1;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'message:': 0.03;
'python?': 0.03; 'stream': 0.04; 'variable': 0.05; 'all!': 0.07;
'loop': 0.07; 'pep': 0.07; 'programmer': 0.07; 'text/plain;':
0.07; 'wanting': 0.07; '+0200': 0.09; 'apparently': 0.09;
'developers.': 0.09; 'example:': 0.09; 'operators': 0.09;
'rarely': 0.09; 'url:mailman': 0.15; 'antoon': 0.16;
'assignments': 0.16; 'calculations': 0.16; 'condition.': 0.16;
'ctr': 0.16; 'duplication': 0.16; 'expressions': 0.16; 'finger':
0.16; 'initialize': 0.16; 'niche': 0.16; 'pardon': 0.16;
'personally,': 0.16; 'received:(vzm hermes smtp server)': 0.16;
'received:74.6.135.42': 0.16;
'received:sonic302-3.consmr.mail.bf2.yahoo.com': 0.16; 'roger':
0.16; 'subset': 0.16; 'syntactic': 0.16; 'typing': 0.16;
'understand.': 0.16; 'value?': 0.16; 'values?': 0.16; 'yield':
0.16; 'wrote:': 0.16; 'python': 0.16; 'october': 0.17;
'implement': 0.19; 'reduce': 0.19; 'to:addr:python-list': 0.20;
'language': 0.21; 'languages': 0.22; 'teach': 0.22; 'code': 0.23;
'(and': 0.25; 'anything': 0.25; '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; 'programming': 0.25; 'url-ip:188.166/16':
0.25; 'anyone': 0.25; 'seems': 0.26; 'follows:': 0.26; 'suspect':
0.26; 'function': 0.27; 'old': 0.27; 'done': 0.28; 'chris': 0.28;
'purpose': 0.28; 'suggest': 0.28; 'recently': 0.29; 'it,': 0.29;
'whole': 0.30; 'code,': 0.31; 'takes': 0.31; 'url-ip:188/8': 0.31;
'discussions': 0.32; 'expand': 0.32; 'obtain': 0.32; 'performed':
0.32; 'programmers': 0.32; 'python-list': 0.32; 'tool.': 0.32;
'unless': 0.32; 'but': 0.32; 'there': 0.33; 'particular': 0.33;
'requires': 0.34; 'header:In-Reply-To:1': 0.34; 'trying': 0.35;
'cases': 0.36; 'count': 0.36; 'mon,': 0.36; 'people': 0.36;
'those': 0.36; 'really': 0.37; 'using': 0.37; 'class': 0.37;
'others': 0.37; 'students': 0.38; 'way': 0.38; 'could': 0.38;
'25,': 0.62; 'here': 0.62; 'limited': 0.62; 'feel': 0.63; 'great':
0.63; 'down': 0.64; 're:': 0.64; 'received:74.6.135': 0.64;
'your': 0.64; 'saw': 0.65; 'benefit': 0.65; 'similar': 0.65;
'tool': 0.65; 'required': 0.65; 'less': 0.65; 'let': 0.66; 'day':
0.66; 'lead': 0.67; 'back': 0.67; 'more,': 0.67; 'choose': 0.67;
'right': 0.68; 'operations': 0.68; 'adds': 0.69; 'counter': 0.69;
'forcing': 0.69; 'highlight': 0.69; 'instead,': 0.70; 'truly':
0.70; '2021': 0.71; 'care': 0.71; 'addition': 0.71; 'longer':
0.71; 'free': 0.72; 'features': 0.75; 'choice': 0.76; 'sent:':
0.78; 'var': 0.81; 'more.': 0.82; '(such': 0.84; 'compromise':
0.84; 'furthermore': 0.84; 'one:': 0.84; 'pennsylvania': 0.84;
'remind': 0.84; 'deliberately': 0.91; 'hand.': 0.91; 'petition':
0.91; 'mind,': 0.93; 'seemingly': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verizon.net; s=a2048;
t=1635198086; bh=B5aze5Fkerhdtt76wTRq1wu5JyXXYpBY3iqBYmlqZk4=;
h=From:To:References:In-Reply-To:Subject:Date:From:Subject:Reply-To;
b=KYHvAcg16qNf1rAvnFaF/QQf5J+/1pVWK2kHdmmUtCVG0APUfAroEzJoqEjbAiiHX2hBTwNmVGf8/7kEBEJRJ7HSapRVgseA5/Lerpxr0E8as1d1RQ4ZKDkVhS+44kkyzmpYN/U0pJNDZ6Lf1OqTvWahx3dQFPenDT8k9I0fL4f/I3Uu3r7ByiPOpT41K6Gc3OeQepiNJrWIq+eXPxbL2A3wTGAbGs2I4Yh3E83aMgFQFIisTPGxTLqx4rvT1LPw+RTV5Unu9R9PnxTJzb9ny3/ssQC9NIDUkMmF4zdwuvSCd+EJ53UvqjHIoCuswlxOhhUmxR9GnlSpGSUXMoiUpg==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1635198086; bh=JZrqQA/VVqB2XV0ItNxpDXLhaZCFIYt37hKm9NSILln=;
h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
b=ItUG5Agz3TdSFBpV2AuLYi1/AmB6/Wa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.c7uxRCGUf9.
ApOvuh.ckLuwxTSspVoZPpELxpCKRis5et.BBoor2kTg2Dp5R1CKIdtnN0BdfyFaVruJKshYRNCR
JiAPbny1Wfai3puHcg16EbRWYnFq7xYVhUSVRqg3wG8so_C3VaD8eXXMjpVmMWD5noA4lKj9sRI_
Qlm2BxEdc.YFvnjSOLkmPNyIWqFrlf3wySgY4CV5vB2hoRimhSpcWt9jLVvGN69Yzfvl8GAobB9o
9OAs2x46IhsyA7xFjxlqAU0pF8_D9206vPr40jn3fbLqjfypG6Y5ZMrIwiZQHL_kQJ..iDiMDKpm
GpnEEE8eT_UhX3QLdJxTZAY8zkjCMhsUU7a7GgoCJlhGZGnTZrfdvMMQhNPvVHcrPwlTt.gjRxaJ
qna6fKGiy85wO.tJYsfEZAqoPAgGvFsMj0Uzdsu.5rco-
X-Sonic-MF: <avigross@verizon.net>
In-Reply-To: <MN2PR02MB68461EB83EC01991C31D6752A8839@MN2PR02MB6846.namprd02.prod.outlook.com>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQIabq3W4q9bEf96n0X0U3+MV//5C6te8UmQ
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.35
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: <00a701d7c9e9$0d745650$285d02f0$@verizon.net>
X-Mailman-Original-References: <MN2PR02MB68461EB83EC01991C31D6752A8839@MN2PR02MB6846.namprd02.prod.outlook.com>
 by: Avi Gross - Mon, 25 Oct 2021 21:41 UTC

We have had discussions debating if Python is a good language for teaching.
The short answer is NO unless you only teach a small subset and the students
know there is more they can learn as needed. The language is too rich and
has too many ways to do seemingly anything and that is before you add more
functionality. But that can make it a great language for developers.

Assignments in middle of expressions are often syntactic sugar that may be
re-arranged internally to similar code than what could be done other ways
without it. It can lead to ambiguities. And it can make it harder for anyone
other than the programmer that wrote it (or them a day later) to understand.

So, while we are at it, why not add the ++ and --- operators that were
deliberately NOT included in Python? Why not throw back pointers?

The short answer is that there are plenty of programming languages to choose
from and some of those do have the features you want and some do not want
them. Sure, you might push in what you want but have you considered all the
places it might be tried? Can you do it in a comprehension where an
assignment is implicitly being done?

[ var := 5 in range(10) ]

The old adage is that some people will be given a finger and take a hand. I
had NOTHING to do with the process but others here know more. Chris suggests
that there was a compromise of sorts here and a choice to implement a
limited subset of fuller functionality for NOW without ruling out doing some
more later. So those wanting more, feel free to petition for it as an
ADDITION but I suggest a more polite tone than trying to say the people who
did it were idiots who did it badly.

Personally, I don't care what is done and suspect I will rarely feel much
need to use the current walrus operator, let alone an enhanced Odobenus
rosmarus operator like ::== ...

-----Original Message-----
From: Python-list <python-list-bounces+avigross=verizon.net@python.org> On
Behalf Of Christman, Roger Graydon
Sent: Monday, October 25, 2021 12:48 PM
To: python-list@python.org
Subject: Re: New assignmens ...

Message: 8
Date: Mon, 25 Oct 2021 11:20:52 +0200
From: Antoon Pardon <antoon.pardon@vub.be>
To: python-list@python.org
Subject: Re: New assignmens ...
Message-ID: <5761dd65-4e87-8b8c-1400-edb8212048db@vub.be>
Content-Type: text/plain; charset=utf-8; format=flowed On 25/10/2021 11:20,
Anton Pardon wrote:
> Suppose I would like to write a loop as follows:

> while ((a, b) := next_couple(a, b))[1]:
> do needed calculations

> What I can do is write it as follows:

> while [tmp := next_couple(a,b), a := tmp[0], b := tmp[1]][-1]:
> do needed calculations

> I really don't see what is gained by "forcing" me to right the second code
over the first.

No, nobody is forcing you to right it the second way over the first.
Nobody is forcing you to use the walrus operator at all!

Instead, I would recommend something more like:

while b:
do needed calculations
(a,b) = next_couple(a,b)

This requires even less typing than what you had before!

But it also raises a whole lot of problems with this particular example:
-- neither a nor b is defined in your sample while loop. It seems you
would
need to initialize a and b before your while loop (and mine)
-- is b truly a boolean value, or are you short-cutting some other value?
-- are a and b truly necessary parameters to next_couple, or are they just
there to remind the function of its previous return values?
If the latter, poerhaps you want a stream or list or something with
yield

This example (and some of the others I have seen) just highlight how
programmers will take advantage of any new tool to help them write
worse code than if they did not have the tool. In my mind, the walrus
operator was designed to serve a particular niche case like this one:

while (x := input()) > 0:

where not having the operator required duplicating the input() operation
both before the loop and at the end of the loop -- or more complicated
cases where some additional operations had to be performed to get that test
value for the while condition (such as getting the b out of (a,b)).

But the walrus only adds a benefit if it is there to avoid the duplication
of the code that is used to obtain that test condition. This next_couple
example does not qualify, since apparently (a,b) are initialized by some
other means (and not be a call to next_couple with undefined values)

Or the other abuse I saw recently about using the walrus operator:

while (self.ctr := self.ctr-1) > 0:

-- there was no compelling reason for a loop counter to be a class variable
(anyone who peeks at this counter when the loop is down would only see a
zero)
-- this requires self.ctr to be initialized to a value one higher than the
first meaningful value (start at 11 if you want to count down from 10) So my
recommended alternative, which furthermore also takes less typing:

while ctr > 0:
...
ctr = ctr-1

TL;DR: The Walrus operator serves the purpose as described in its PEP
just as it is, and I see no compelling reason to expand its use.
It is there to reduce code size by eliminating a duplication of code, If the
code you write using the walrus operator is longer or more complicated than
the code would be without it, you are misusing it.

Roger Christman
Pennsylvania State University
--
https://mail.python.org/mailman/listinfo/python-list

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor