Josiah Carlson wrote:
What the heck does 'x = 4 $ 6' mean in Python? Oh, that's right, it's a custom infix operator. But where is it defined?
It's not quite as bad as that -- it would be defined by the relevant operator method on one of the operands. But a convention would be needed for mapping arbitary non- alphanumeric sequences to method names, and it's not obvious how to do that. But the main technical problem I see is that of precedence. It would have to be declared somehow, or a declaration imported from another module. If it's imported, then parsing a module can't be done in isolation any more, since it depends on the contents of other modules. Things could get very messy.
Really though, PEP 211 was a perfect example of a k-line function that someone attempted to make syntax that really didn't need to be syntax.
It looks like a case of someone wanting a matrix multiplication operator in numpy, and then hunting around for something to make it mean in Python. I would actually be in favour of adding a matrix multiplication operator, but I would make it mean matrix multiplication in Python as well, operating on anything that can be treated as a 2D sequence. Why matrix multiplication in particular? Because it's the one thing that you do all the time with matrices for which there isn't an available operator. I think this one addition could be justified on the grounds of very wide usage. -- Greg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com