Re:Why Do Python Lists Multiply Oddly? Exploring the CPython...
by kerkeslager on Tuesday April 09, 2024 @11:14AM
(#39980338)
This feels like a legitimate critique to me. I'm developing a programming language myself and I'm not going to include a syntax like this--multiplying an array by a number feels like a type error to me.
[ Parent
| on HN ]
Re:Why Do Python Lists Multiply Oddly? Exploring the CPython...
by aeonik on Tuesday April 09, 2024 @11:52AM
(#39980746)
I wouldn't recommend just throwing the idea away, it just needs to be approached with care. You can do it in a type safe way.
Research Rank Polymorphism and Array Languages:
Re:Why Do Python Lists Multiply Oddly? Exploring the CPython...
by kerkeslager on Wednesday April 10, 2024 @12:25AM
(#39986949)
I mean, is there anything there that couldn't just be a library function? Not everything has to be an operator.
Re:Why Do Python Lists Multiply Oddly? Exploring the CPython...
by aeonik on Friday April 12, 2024 @06:22PM
(#40018274)
Philosophically, I don't know what "must" or "has" to be an operator.
I certainly don't want to tell you how to design your language.
I'm just trying to say, don't rule the pattern out because it's perceived as a type error; you may have other reasons that are good, but my citations provide a basis of how to make the typing work (if you were inclined).
If you have other reasons, even if it's just aesthetic, that's fine.
Re:Why Do Python Lists Multiply Oddly? Exploring the CPython...
by hughesjj on Tuesday April 09, 2024 @12:29PM
(#39981113)
Totally agreed @ just not implementing this part.
I think the motivation was being able to do scalar multiplication with a vector, but it gets ugly when operating on anything but numbers imo