Re:Python 3.5 to Ship with Matrix Multiplication Operator
by dragonwriter on Tuesday April 08, 2014 @12:54PM
(#7554587)
> For the `@` operator I will be trying it as an "at" operator for accessing objects from a game map
I suppose you could use it for that that, but wouldn't that be a canonical case for indexing with []?
Re:Python 3.5 to Ship with Matrix Multiplication Operator
by BoppreH on Wednesday April 09, 2014 @12:32AM
(#7557649)
A little late, but I think the reply is worth it.
`[]` is for discrete elements. That's perfect for a tile game.
My idea with `@` is a sort of collision detection for continuous maps. `map @ (115.2, 23.5)` should return the object under that position.
This operation is useful on all sorts of interactions: "can I move there?", "what did the mouse click?", "do I have a line of sight?", etc.
I'm still thinking on how to chain those operations.
And the benefit of overloading is still readability, when carefully used and in a different domain. And sparingly. For the `@` operator I will be trying it as an "at" operator for accessing objects from a game map, or some sort of translation. If it performs well I may start using it in my pet projects. If it changes my life and enlightens everyone who gazes upon it, I may start using in production.
I do understand your worry and I promise to be extra careful.