On Thu, Dec 26, 2019 at 11:15 PM Marco Sulla via Python-ideas
<python-ideas@python.org> wrote:
> Chris Angelico wrote:
> > > Subtracting two lists or two strings has no sense, so the comparison is
> > > unfair.
> > Except that it DOES make sense in some contexts.
>
> Source, please.

Pike v8.1 release 13 running Hilfe v3.5 (Incremental Pike Frontend)
> "abc, def, ghi" - ", ";
(1) Result: "abcdefghi"
> ({1, 4, 2, 8, 5, 7}) - ({2, 4});
(2) Result: ({ /* 4 elements */
                1,
                8,
                5,
                7
            })

In the case of arrays/lists, subtraction is defined as "remove each of
these elements, as many times as it comes up" (kinda like set
difference, but retaining order). In the case of strings, it's "remove
this substring any time it occurs".

I'm not saying that Python needs these features, but they DO make
sense in the contexts that make use of them. They are not nonsensical
operations.

> > People are far too
> > quick to say that something "makes no sense", implying that there is
> > no sensible way to interpret it.
>
> "There's preferably only one obvious way to do it", no?

That's an argument for not incorporating them into Python. It's not
stating that they "make no sense".

> > I've seen plenty of people complain
> > that you can't add two strings together (ie that concatenation is
> > fundamentally different from addition), that you can't multiply a list
> > by an integer, that you can't multiply a string by an integer, that
> > you can't divide a string by a string, etc, etc, etc.
>
> Well, they are wrong :D
> They want funny and lazy operators? Suggest them numpy. numpy transform 
> Python in the "language" Matlab. And I've seen numpy coders that used ~ also 
> for simple integers... Really funny results. Usually they are scientists, and 
> programming is boring for them.
>

This is the Blub Paradox in action. You understand adding strings
together and therefore it makes sense; but subtracting strings makes
no sense, because it doesn't fit in your mind. In reality, both
operations are equally plausible.

> > that's
> > actually only one logically defensible interpretation of division
> > (another being "split on this substring", and I'm sure there are
> > others)
>
> No. There is the split function. It's more typical that you forgot to 
> transform the strings, that you probably get from a file, to numbers.

Again, that's a justification for not including it in Python, but it
does NOT mean that the operation is nonsensical.

> > I do ask people to be a little more respectful to the notion that these
> > operations are meaningful.
>
> .....respectful? I presented my opinion. You are free to agree or not. I've 
> not swore of split on the floor :D

When your opinion is that an operation "has no sense", that's not respectful.

> > Mathematically, the subset relationship is a perfectly reasonable
> > ordering, so it makes perfect sense that the "<" operator be used for
> > this meaning.
>
> Mathematically, the operator is ⊂. "<" operator is used for comparison, and 
> it's vital for sorting. And sorting sets makes no sense.
>

Once again, you assert this. Do you have proof that it absolutely
makes NO SENSE in any context, or just that you don't see value in it?
If you're just presenting your opinion, then present it as an opinion,
not as a scoffing dismissal.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/3XJXLJYQUTHSAYAKGDGY6WA42DH44PM7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to