🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #2042

Re: variadic min and max, (any some and none, cat and more)

#2042
From: Janis Papanagnou
Date: Mon, 30 Nov 2026 22:50
34 lines
2846 bytes
On 2026-11-30 22:34, Lawrence D’Oliveiro wrote:
> [...]
> 
> And unlike C++, and almost like Algol 68, it can do things that look
> like custom operators, too

What does that mean? - Behind your link quoted below we can read:
  "Python lets you add custom overloads for its built-in operators,
   but it doesn’t let you create entirely new operators."
Overloading existing operators is also possible in C++, so what's
the actual difference (in Python)? - It seems the only difference
is to be able to provide [clumsy] _named_ operators that (compared
to ordinary functions) just avoids the necessity for parentheses.
The method seems convoluted, though, and the syntax is very crude,
IMO.

The "final score" (on the linked page) is the Python example for
the cross product (and requiring additional helper functions) with
an operator expression like
   v1 .cross* v2 .cross* v3
which would in Algol 68 (since you mentioned it) probably be more
something like either (with named operator 'X'), say,
   v1 X v2 X v3
or (with symbolic operator), say,
   v1 * v2 * v3
or any other allowed operator symbol(-sequence). Take your choice.

Concerning the C++ case I don't see that Python would add anything
worthwhile here. YMMV.

Janis

> <https://gitlab.com/ldo/python_topics_notebooks/-/blob/master/Defining%20(Almost)%20Custom%20Operators.ipynb>.
Technical Details
Message-ID: <11ekujf$4d6q$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11bes8b$1gncr$1@dont-email.me> <11ek7b2$j8f6$1@raubtier-asyl.eternal-september.org> <11ekfu0$mq5n$4@dont-email.me> <11ekg71$n5p7$1@raubtier-asyl.eternal-september.org> <11ekgf8$mq5n$8@dont-email.me> <11ekjsp$pmch$2@raubtier-asyl.eternal-september.org> <11ekq4q$snda$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: variadic min and max, (any some and none, cat and more)
Date: Mon, 30 Nov 2026 23:50:23 +0100
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <11ekujf$4d6q$1@dont-email.me>
References: <11bes8b$1gncr$1@dont-email.me>
 <11ek7b2$j8f6$1@raubtier-asyl.eternal-september.org>
 <11ekfu0$mq5n$4@dont-email.me>
 <11ekg71$n5p7$1@raubtier-asyl.eternal-september.org>
 <11ekgf8$mq5n$8@dont-email.me>
 <11ekjsp$pmch$2@raubtier-asyl.eternal-september.org>
 <11ekq4q$snda$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 30 Nov 2026 22:50:23 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="144602"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18uMjfyo1vJh9qAAHfHwfg6"; posting-host="ab397fe073dedb2519c6addfac5a25d3"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:03tJhM/QL6xkx697P/4R91/ARnI= sha256:4uYFGvjdSbMjx1x99aRp1JMRVufhlhb7xiBomlDnJOs=
	sha1:cGZuxReYMtIDSlEMou33kwNQykM= sha256:z74Xa25UDCqpAxMXx49k93NHgZoaP6wTxBQWDV7PEwU=
In-Reply-To: <11ekq4q$snda$1@dont-email.me>
Content-Language: en-US