I'm amazed (and horrified) how come such an intelligent mathematician and designer of a beautiful programming language made such an obvious fuckup of using a commutative operator for string concatenation. Really, I hate python just for this single idiotic notation. I mean, it's right there in front of your eyes. He talks about the convenience of using a visually commutative operator like "+" for commutative operation…
Why Operators Are Useful
111–120 of 173 posts
Re: Why Operators Are Useful
#112I'm amazed (and horrified) how come such an intelligent mathematician and designer of a beautiful programming language made such an obvious fuckup of using a commutative operator for string concatenation. Really, I hate python just for this single idiotic notation. I mean, it's right there in front of your eyes. He talks about the convenience of using a visually commutative operator like "+" for commutative operation…
I understand the confusion it may cause to a new Python developer who comes from the mathematical background. Does it cause any problems beyond that? For example, does it interfere with some elegant patterns, or result in some bug prone code, etc? FWIW, the single main annoyance I've had with python was its treatment of strings as iterables of single character strings. While not wrong in any obvious theoretical sense…
While it makes sense to think of them as sequences, this has bitten me more than I care to admit. OT: Is there a name for things we love to complain about, but wouldn't change?
Re: Why Operators Are Useful
#113Re: Why Operators Are Useful
#114I'm amazed (and horrified) how come such an intelligent mathematician and designer of a beautiful programming language made such an obvious fuckup of using a commutative operator for string concatenation. Really, I hate python just for this single idiotic notation. I mean, it's right there in front of your eyes. He talks about the convenience of using a visually commutative operator like "+" for commutative operation…
IMO it weirds people out
Re: Why Operators Are Useful
#115I've grown to dislike operator overloading quite a bit, and thus developed a general skepticism with regard to operators in general, and I think this article actually reveals why partially. First off, I'm surprised this article doesn't touch at all on the fact that operators are usually the only "blessed" functions in languages to be able to be written in infix form, as I think that's actually where many of the "bene…
Funny the associations we make...
Re: Why Operators Are Useful
#116This is much less confusing than (2), and leads to the observation that the parentheses are redundant, so now we can write "x + y + z" This is a non-problem if you're using Lisp. (+ x y z) accepts an arbitary number of arguments and the operator precedence problem does not exist since there is no operator precedence.
This is a non-problem in every language with variadic functions. "add(x, y, z)" looks good to me.
What are the guarantees on add(a,b,c) versus a+b+c?
If do add(1.0e30, 1.0, -1.0e30) is that the same (aka IEEE fp addition is noncommutative)
Re: Why Operators Are Useful
#117I'm amazed (and horrified) how come such an intelligent mathematician and designer of a beautiful programming language made such an obvious fuckup of using a commutative operator for string concatenation. Really, I hate python just for this single idiotic notation. I mean, it's right there in front of your eyes. He talks about the convenience of using a visually commutative operator like "+" for commutative operation…
I understand the confusion it may cause to a new Python developer who comes from the mathematical background. Does it cause any problems beyond that? For example, does it interfere with some elegant patterns, or result in some bug prone code, etc? FWIW, the single main annoyance I've had with python was its treatment of strings as iterables of single character strings. While not wrong in any obvious theoretical sense…
s[0] == s[0][0][0][0]
Re: Why Operators Are Useful
#118Re: Why Operators Are Useful
#119I've grown to dislike operator overloading quite a bit, and thus developed a general skepticism with regard to operators in general, and I think this article actually reveals why partially. First off, I'm surprised this article doesn't touch at all on the fact that operators are usually the only "blessed" functions in languages to be able to be written in infix form, as I think that's actually where many of the "bene…
The best part is that string concatenation is a perfectly cromulent "multiplication", forms a free monoid, and in line with some notations for concatenation of tuples. Funny the associations we make...