Re: Some pattern annoyance

Paul Moore <[email protected]> Wed, 2 Aug 2023 17:30:19 +0100
Newsgroups gmane.comp.python.devel
Message-ID <CACac1F-5-C01D7=DbqNe7Z_dSpv9+g3iWdFs=ZxoCwGoyN9m_Q@mail.gmail.com>
--===============4808198755103735080==
Content-Type: multipart/alternative; boundary="0000000000007ae7720601f32e7c"

--0000000000007ae7720601f32e7c
Content-Type: text/plain; charset="UTF-8"

On Wed, 2 Aug 2023 at 15:24, Stephen J. Turnbull <
[email protected]> wrote:

> Partly because that's where the other discussants are (the network
> externality is undeniably powerful), and partly (I believe) because
> effective use of email is a skill that requires effort to acquire.
> Popular mail clients are designed to be popular, not to make that
> expertise easy to acquire and exercise.  Clunky use of email makes
> lists much less pleasant for everyone than they could be.
>
> I guess that's sad (I am, after all, a GNU Mailman developer), but
> it's reality.
>

Personally, I'm sad because some people whose contributions I enjoy (you
being one of them :-)) didn't move to Discourse. But like you say, it's how
things are.

Christian - you can make named constants using class attributes (or an
enum):

class A:
    M = "M"

match seq:
    case A.M, A.M, A.M, A.M, *r:
        return 4*1000, r

Basically, the "names are treated as variables to assign to" rule doesn't
apply to attributes.

I'm not sure how helpful that is (it's not particularly *shorter*) but I
think the idea was that most uses of named constants in a match statement
would be enums or module attributes. And compromises had to be made.

Cheers,
Paul

--0000000000007ae7720601f32e7c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Wed, 2 Aug 2023 at 15:24, Stephen J. T=
urnbull &lt;<a href=3D"mailto:[email protected]">turnbull=
[email protected]</a>&gt; wrote:<br></div><div class=3D"gmail_quo=
te"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left:1px solid rgb(204,204,204);padding-left:1ex">Partly because that&#=
39;s where the other discussants are (the network<br>
externality is undeniably powerful), and partly (I believe) because<br>
effective use of email is a skill that requires effort to acquire.<br>
Popular mail clients are designed to be popular, not to make that<br>
expertise easy to acquire and exercise.=C2=A0 Clunky use of email makes<br>
lists much less pleasant for everyone than they could be.<br>
<br>
I guess that&#39;s sad (I am, after all, a GNU Mailman developer), but<br>
it&#39;s reality.<br></blockquote><div><br></div><div>Personally, I&#39;m s=
ad because some people whose contributions I enjoy (you being one of them :=
-)) didn&#39;t move to Discourse. But like you say, it&#39;s how things are=
.</div><div><br></div><div>Christian - you can make named constants using c=
lass attributes (or an enum):</div><div><br></div><div>class A:<br>=C2=A0 =
=C2=A0 M =3D &quot;M&quot;<br><br></div><div>match seq:<br>=C2=A0 =C2=A0 ca=
se A.M, A.M, A.M, A.M, *r:<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 4*1000, r<=
br><br></div><div>Basically, the &quot;names are treated as variables to as=
sign to&quot; rule doesn&#39;t apply to attributes.</div><div><br></div><di=
v>I&#39;m not sure how helpful that is (it&#39;s not particularly *shorter*=
) but I think the idea was that most uses of named constants in a match sta=
tement would be enums or module attributes. And compromises had to be made.=
</div><div><br></div><div>Cheers,</div><div>Paul</div></div></div>

--0000000000007ae7720601f32e7c--

--===============4808198755103735080==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline