Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"In the long run, every program becomes rococo, and then rubble." -- Alan Perlis


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

SubjectAuthor
* Re: New assignmens ...Chris Angelico
`* Re: New assignmens ...Paul Rubin
 `- Re: New assignmens ...Jon Ribbens

1
Re: New assignmens ...

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

  copy mid

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

  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: New assignmens ...
Date: Thu, 28 Oct 2021 05:42:45 +1100
Lines: 28
Message-ID: <mailman.87.1635360178.23718.python-list@python.org>
References: <MN2PR02MB68467E4D2BE43F80139AE970A8859@MN2PR02MB6846.namprd02.prod.outlook.com>
<CAPTjJmpsarS5gueM-B2fkfKn56Q1K_a=0TSs5sG=yWP_OX9aGw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de fmJYEroLeg2Qb57yj/3X2gnQta/3A7IQRr8TmJONhdzA==
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=p6snKp28;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.022
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'loop': 0.07;
'calculating': 0.09; 'infinite': 0.09; 'arguments': 0.16;
'cases,': 0.16; 'chrisa': 0.16; 'examples.': 0.16;
'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16;
'one?': 0.16; 'roger': 0.16; 'wrote:': 0.16; 'thu,': 0.19;
'to:addr:python-list': 0.20; 'input': 0.21; "i've": 0.22; 'code':
0.23; 'to:name:python-list@python.org': 0.24; 'depends': 0.25;
'seems': 0.26; 'returning': 0.32; 'message-id:@mail.gmail.com':
0.32; 'but': 0.32; 'there': 0.33; 'mean': 0.34; 'header:In-Reply-
To:1': 0.34; 'received:google.com': 0.34; 'from:addr:gmail.com':
0.35; "we're": 0.35; 'those': 0.36; 'couple': 0.37; 'special':
0.37; 'really': 0.37; 'received:209.85': 0.37; 'though': 0.37;
'put': 0.38; 'received:209': 0.39; 'single': 0.39; 'define': 0.40;
'exact': 0.40; 'something': 0.40; 'want': 0.40; 'tell': 0.60;
'mental': 0.62; 'here': 0.62; 'look': 0.65; 'named': 0.65; '2021':
0.71; 'little': 0.73
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;
bh=eHxcW1vc3H9m2Bf/NpR1DFTcJMmIYvVazimczowMs6o=;
b=p6snKp28cECD+GVswh2973SwlMWAyP1kKeuQtemsv03dTUxSYE3H0Nz53BvQI5+Zjx
/smUmc4HTClgcSBuq5hnpvmVFhniXphhQJFpbpJJgN2ivXfMe8H3mPYpwYdOSk+cSSCI
yZtLrWoD4i9iDTO/OfnvMTa9LrXVfqrwxNPUSrh7Ub75IZG1XD6uHSyRFJomq0+o5CoX
ekjGkWHqoDcasnaGsuAZmMjd/UOxw2LWqgvPquE4bJ+913kOHzwxHZtMODNUF5eBnNiB
BTawu7K/g0GOk+Ri79HXCfFr49DIRjg0pbOqiVxcqD9mcBvyEs2M1pT0GRHQuJtqLcUq
t8Ag==
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;
bh=eHxcW1vc3H9m2Bf/NpR1DFTcJMmIYvVazimczowMs6o=;
b=tzhmQyT/Ap+Mnz13i7dcS3YdkLWBeOk4QOii2lDEPaPm7pmkM93RcFqgsiO6ZwbWuM
zyowp8xRw6ZgyA8trNXZ+T5STEwXtdH/RvuQwnssCDPQU8RlynNJJPGW3KfmHETnVlSP
GI/BJL/XpfXDgInegp3tThx8YjCeBwfPeNx1V/PipN+j8ESVP/e1SdanB+K8eNM/B7Gx
eH3lLglaLnGQzmDAwW8/HSjd42Zj7ibtFnBArHOUlObwAFBGtAe82WhHqZlJyec3t2Sz
+nFYh5yXjF026Y2ee6N87XdruUv0uv3XU4yelsUGTpQoExJ/XPl0XDRoZvY7+IZhDZpz
GRCw==
X-Gm-Message-State: AOAM530V2Jps/5JZWj8NtwTECYLFU6zQsXAxY7zILCmnyORVt5oA4xdF
OAYDY25Ew2Z/cfeJpEmt0bSwkowPItvzBpOI4zgCvOrL
X-Google-Smtp-Source: ABdhPJzxWCf5NS8XcB5Aox3lPEVhetVe0yOlJ6t2XyJPMz0lI4a+ENwspZUjbD4+LSgjon017OLeXSk4rM3Omt6WqXQ=
X-Received: by 2002:adf:ec03:: with SMTP id x3mr35910665wrn.281.1635360175830;
Wed, 27 Oct 2021 11:42:55 -0700 (PDT)
In-Reply-To: <MN2PR02MB68467E4D2BE43F80139AE970A8859@MN2PR02MB6846.namprd02.prod.outlook.com>
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: <CAPTjJmpsarS5gueM-B2fkfKn56Q1K_a=0TSs5sG=yWP_OX9aGw@mail.gmail.com>
X-Mailman-Original-References: <MN2PR02MB68467E4D2BE43F80139AE970A8859@MN2PR02MB6846.namprd02.prod.outlook.com>
 by: Chris Angelico - Wed, 27 Oct 2021 18:42 UTC

On Thu, Oct 28, 2021 at 4:34 AM Christman, Roger Graydon <dvl@psu.edu> wrote:
> Do you put special code in next_couple() to recognize that the provided arguments
> are actually the first couple so it can return those unmodified, but then require its
> own mental note not to give you an infinite loop forever returning that first couple?
>
> Do you have to define a special case such as (a,b) = (0,0) or (None,None) to tell
> next_couple that you really want the first one? That seems a little counter-intuitive
> to have something named "next" need a special input to mean "first",

In some cases, there is a very real special startup value (a seed).
For instance, if we're calculating something relating to the
Mandelbrot set:

# The point we're working with
c = (0.25 + 0.125j)
# Always start here
z = (0 + 0j) # or just 0
while abs(z := z*z+c) < 2:
...

Though in this case, you don't look for a next_couple, you look for a
single next value, and the other value is constant.

But it all depends on the exact process being done, which is why I've
been asking for real examples.

ChrisA

Re: New assignmens ...

<87ilxhudmf.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.python
Subject: Re: New assignmens ...
Date: Wed, 27 Oct 2021 18:44:40 -0700
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <87ilxhudmf.fsf@nightsong.com>
References: <MN2PR02MB68467E4D2BE43F80139AE970A8859@MN2PR02MB6846.namprd02.prod.outlook.com>
<CAPTjJmpsarS5gueM-B2fkfKn56Q1K_a=0TSs5sG=yWP_OX9aGw@mail.gmail.com>
<mailman.87.1635360178.23718.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="f414e63b38abb142fd3c389da494b2d1";
logging-data="27550"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18aaQQBZKtGtZ+w6ZnVhool"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:wbHxPyBwz/v99HwQ0n0ZIZxOehw=
sha1:4OC3u85Q/9MOy2kRNoWAkpemuyQ=
 by: Paul Rubin - Thu, 28 Oct 2021 01:44 UTC

Chris Angelico <rosuav@gmail.com> writes:
> But it all depends on the exact process being done, which is why I've
> been asking for real examples.

My most frequent use case for walrus is so common that I have sometimes
implemented a special class for it:

if g := re.search(pat1, text):
hack(g.group(1))
elif g := re.search(pat2, text):
smack(g.group(2), "foo")
...

It's way messier if you have to separate the assignment and test the old
way. That said, I'm still on Python 3.7 so I haven't yet gotten to use
walrus or the new match statement (or is it expression).

I do feel surprised that you can't use an arbitrary lvalue (to use C
terminology) on the lhs of a walrus. That seems downright weird to me.
But, I haven't studied the PEP so I don't know if there was a particular
rationale.

Re: New assignmens ...

<slrnsnksph.503.jon+usenet@raven.unequivocal.eu>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jon+use...@unequivocal.eu (Jon Ribbens)
Newsgroups: comp.lang.python
Subject: Re: New assignmens ...
Date: Thu, 28 Oct 2021 09:53:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <slrnsnksph.503.jon+usenet@raven.unequivocal.eu>
References: <MN2PR02MB68467E4D2BE43F80139AE970A8859@MN2PR02MB6846.namprd02.prod.outlook.com>
<CAPTjJmpsarS5gueM-B2fkfKn56Q1K_a=0TSs5sG=yWP_OX9aGw@mail.gmail.com>
<mailman.87.1635360178.23718.python-list@python.org>
<87ilxhudmf.fsf@nightsong.com>
Injection-Date: Thu, 28 Oct 2021 09:53:53 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="c6021b344ec465a8ad8d4955663f019b";
logging-data="21536"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bJZusRTSg0c4ONCtvxsjf6/zUMunJFfQ="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:LFddYlmNMENTfI6zkqWoQ8YKaxw=
 by: Jon Ribbens - Thu, 28 Oct 2021 09:53 UTC

On 2021-10-28, Paul Rubin <no.email@nospam.invalid> wrote:
> Chris Angelico <rosuav@gmail.com> writes:
>> But it all depends on the exact process being done, which is why I've
>> been asking for real examples.
>
> My most frequent use case for walrus is so common that I have sometimes
> implemented a special class for it:
>
> if g := re.search(pat1, text):
> hack(g.group(1))
> elif g := re.search(pat2, text):
> smack(g.group(2), "foo")
> ...
>
> It's way messier if you have to separate the assignment and test the old
> way. That said, I'm still on Python 3.7 so I haven't yet gotten to use
> walrus or the new match statement (or is it expression).
>
> I do feel surprised that you can't use an arbitrary lvalue (to use C
> terminology) on the lhs of a walrus. That seems downright weird to me.
> But, I haven't studied the PEP so I don't know if there was a particular
> rationale.

Well, that's what I was saying: there's no rationale - the limitation
is not even mentioned, let alone explained.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor