Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The universe seems neither benign nor hostile, merely indifferent. -- Sagan


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

SubjectAuthor
o RE: New assignmens ...Avi Gross

1
RE: New assignmens ...

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: avigross@verizon.net (Avi Gross)
Newsgroups: comp.lang.python
Subject: RE: New assignmens ...
Date: Fri, 29 Oct 2021 19:43:47 -0400
Lines: 101
Message-ID: <mailman.146.1635551032.23718.python-list@python.org>
References: <MN2PR02MB68461EB83EC01991C31D6752A8839@MN2PR02MB6846.namprd02.prod.outlook.com>
<00a701d7c9e9$0d745650$285d02f0$@verizon.net>
<CAPTjJmpfVz_TjRnpOhmO33eqYqxXitO0FGqnoHr=RvPHV+jm2Q@mail.gmail.com>
<f83e5665-5262-28d2-efc9-6c704e1e1f35@DancesWithMice.info>
<CAPTjJmr-_jPLRwATvMY+8SeHOwP=EfAcjKqZ96+ezGJk_cDOog@mail.gmail.com>
<7fe4dae1-0144-8e99-cc32-17d733961df1@vub.be>
<034401d7cb5f$5b5619e0$12024da0$@verizon.net>
<83918585-0e37-f785-43d8-2a26350c3695@vub.be>
<004a01d7cc22$4c055050$e40ff0f0$@verizon.net>
<ec690126-b073-a14b-cb8f-43af01ec619a@vub.be>
<024201d7cd1e$d1be1f90$753a5eb0$@verizon.net>
Mime-Version: 1.0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de agdmiq4AwZGCrYcM/JgNwwfJHK+SDUlq8npFGQ3CGEOA==
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=BIyU7HjF;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'this:': 0.03; 'def': 0.04;
'variable': 0.05; 'lets': 0.07; 'string': 0.07; 'suggestion':
0.07; 'bot': 0.09; 'meant': 0.09; 'neat': 0.09; 'question:': 0.09;
'readable': 0.09; 'trivial': 0.09; 'url:mailman': 0.15; 'antoon':
0.16; 'assuming': 0.16; 'avi': 0.16; 'computation.': 0.16;
'gross': 0.16; 'indeed': 0.16; 'instead.': 0.16; 'pardon': 0.16;
'pardon.': 0.16; 'properly.': 0.16; 'received:(vzm hermes smtp
server)': 0.16; 'reference,': 0.16; 'schreef': 0.16; 'things,':
0.16; 'tries': 0.16; 'python': 0.16; 'october': 0.17; 'values':
0.17; 'figure': 0.19; 'to:addr:python-list': 0.20; 'language':
0.21; 'languages': 0.22; 'code': 0.23; 'lines': 0.23; 'run': 0.23;
'skip:- 10': 0.25; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'python,': 0.25; 'extension': 0.25;
'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25; 'again,': 0.26;
'friday,': 0.26; 'object': 0.26; 'creating': 0.27; 'function':
0.27; 'purpose': 0.28; 'attempt': 0.31; 'url-ip:188/8': 0.31;
'think': 0.32; 'python-list': 0.32; 'but': 0.32; 'there': 0.33;
'someone': 0.34; 'mean': 0.34; 'header:In-Reply-To:1': 0.34;
'question.': 0.35; 'request': 0.35; 'functions': 0.36; 'work,':
0.36; 'people': 0.36; 'change': 0.36; 'necessarily': 0.37;
'currently': 0.37; 'using': 0.37; 'way': 0.38; 'adding': 0.39;
'setting': 0.39; 'something': 0.40; 'try': 0.40; 'should': 0.40;
'family': 0.60; 'including': 0.60; 'above': 0.62; 'from:': 0.62;
'to:': 0.62; 'showing': 0.62; 'security': 0.64; 'down': 0.64;
'imagine': 0.64; 're:': 0.64; 'won\xe2\x80\x99t': 0.64; 'your':
0.64; 'well': 0.65; 'choose': 0.67; 'exactly': 0.68; 'within':
0.69; 'front': 0.70; '2021': 0.71; 'interesting': 0.71;
'challenges': 0.76; 'implemented': 0.76; 'sent:': 0.78;
'returned': 0.81; 'var': 0.81; 'extra': 0.84; 'reasons': 0.84;
'method,': 0.84; 'that:': 0.91; 'aspects': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verizon.net; s=a2048;
t=1635551029; bh=cWvzUKcRUNBSJf5ADksulcFrxagl5DG5lfJfnxjC4bo=;
h=From:To:References:In-Reply-To:Subject:Date:From:Subject:Reply-To;
b=BIyU7HjF7M3L89CELHYyGJwgrIsD3n1MZq1PNBuUZwAqs0P3SGRk25bCCoNWDLo4+/OZ/UTWIVg5dNZRsYf5kB5GsMoj0qdzPwvYZZhzd8D/kOqCY7MDf+jpb5qWNIu2fttc4vi7iS10HRfghz5Lvxd/B7Z8FGC4mke2ut1GLTfHzIlkMG9xUOdsXhUHITv1S4NNPgrqJ8ywAr4Ew8VvLaubyU9INoB7oCOWCSofYX++lvsCoHGP6DIDWAPTYxAXNrjWwr3cSRiH8OBrxPgNaoN9fqPDZ5YFGpVdjQqCTJhcttpGGmptev2dHSS5MhAskpf64vlNYMEL8jYKTIP+iw==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1635551029; bh=E5QhH1tj4ztUb3jK1PGF+8Px+cXZRKSoS/iUJugBU3I=;
h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
b=McyA6S9jgw4069+CTrOuaxaz1SgYF/gPCLfiRvlUxkWe+0glvnCxpCTdgPIlc3fai04w6m/z0KP+PxQSQiIG1rfY+zicGz+dEfvmRihkSKbaB2EdZlUcqtfmOxNFaXNBuOoMNXd2ett5IZWvK2HAOlb17TEDw3s4PX9llhfW2SyjG9opNG4b+g4usq/FHO6I9K8AqKteieLP23sziOJ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x8QT5pe05Fj51Ki5U5kKMYleFwLh_.2VaA7wfQ6bQakCXRxf
k8lyo9jBtS_rVsf6fMjl0h9Lw6tVLJ8Ijqnss95jpOtLBEysAOixEcuHqUK_R7wFfB4mgcw5dd_G
04Qolf2XUdvzQiqwf4baMZYQeUFKLfmTCKXTMZFfbmCdVrcmVhLbwbWOQFg3fbagAWzfx2y87i3g
m5XZN4nAc0iE3hMNg0wKTgpPpH5neRdUXU0Q8
X-Sonic-MF: <avigross@verizon.net>
In-Reply-To: <ec690126-b073-a14b-cb8f-43af01ec619a@vub.be>
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQIabq3W4q9bEf96n0X0U3+MV//5CwFhWOenAxR6e+ECJA4zFALUI9ekAcRwKU4DEoQnEwE6LatjAmC3E4MBxn8Ay6rIKZFQ
Content-Language: en-us
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: <024201d7cd1e$d1be1f90$753a5eb0$@verizon.net>
X-Mailman-Original-References: <MN2PR02MB68461EB83EC01991C31D6752A8839@MN2PR02MB6846.namprd02.prod.outlook.com>
<00a701d7c9e9$0d745650$285d02f0$@verizon.net>
<CAPTjJmpfVz_TjRnpOhmO33eqYqxXitO0FGqnoHr=RvPHV+jm2Q@mail.gmail.com>
<f83e5665-5262-28d2-efc9-6c704e1e1f35@DancesWithMice.info>
<CAPTjJmr-_jPLRwATvMY+8SeHOwP=EfAcjKqZ96+ezGJk_cDOog@mail.gmail.com>
<7fe4dae1-0144-8e99-cc32-17d733961df1@vub.be>
<034401d7cb5f$5b5619e0$12024da0$@verizon.net>
<83918585-0e37-f785-43d8-2a26350c3695@vub.be>
<004a01d7cc22$4c055050$e40ff0f0$@verizon.net>
<ec690126-b073-a14b-cb8f-43af01ec619a@vub.be>
 by: Avi Gross - Fri, 29 Oct 2021 23:43 UTC

Antoon,

As long as we understand that my suggestion is not meant to be taken seriously, your extension is along the lines I intended.

You might indeed have a family of helper functions whose purpose is to bot make a change on the side and return the value to be used in a computation. Your specific implementation of something like that:

def setxattr(obj, attr, value):
setattr(obj, attr, value)
return value

Would need to have access to the original object and change it in a way that propagates properly. So when you do this:

if setxattr(self, 'ctr', self.ctr - 1) <= 0 :

Then assuming passing it 'ctr' as a string makes sense, and the object self is passed by reference, I can see it working without a walrus operator.

But it is extra overhead. This being python, setting values WITHIN an object is a challenge. I mean there are ways to make a value readable but not writeable or writeable only using a designated method, or an attempt to set the value may be intercepted and the interceptor may choose to do something different such as ignoring the request if someone tries to set the time to thirteen o'clock or even setting it to 1 o'clock instead. The above kind of code perhaps should not return value but obj.attr so we see what was stored. But again, Python lets you intercept things in interesting ways so I can imagine it showing something other that what you stored.

Sigh

As noted, the general case implemented walrus style may have challenges and even efforts like the above may not always be straightforward.

Language design is not as trivial as some think and like with many things, adding a neat new feature may open up holes including security holes if people figure out how to abuse it. Shutting down some such abilities is exactly why people code defensively and try to hide the inner aspects of an object by doing things like having a proxy in front of it and creating getters and setters.

-----Original Message-----
From: Python-list <python-list-bounces+avigross=verizon.net@python.org> On Behalf Of Antoon Pardon
Sent: Friday, October 29, 2021 10:04 AM
To: python-list@python.org
Subject: Re: New assignmens ...

Op 28/10/2021 om 19:36 schreef Avi Gross via Python-list:
> Now for a dumb question. Many languages allow a form of setting a variable to a value like:
>
>
>
> assign(var, 5+sin(x))
>
>
>
> If we had a function that then returned var or the value of var, cleanly, then would that allow an end run on the walrus operator?
>
>
>
> if (assign(sign, 5+sin(x)) <= assign(cosign, 5+cos(x))) …
>
>
>
> Not necessarily pretty and I am sure there may well be reasons it won’t work, but I wonder if it will work in more places than the currently minimal walrus operator.

This was the orginal code to illustrate the question:

if (self.ctr:=self.ctr-1)<=0

So if I understand your sugested solution it would be something like:

def setxattr(obj, attr, value):
setattr(obj, attr, value)
return value

if setxattr(self, 'ctr', self.ctr - 1) <= 0

Did I get that right?

--
Antoon Pardon.

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


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

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor