-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement matrix multiplication operator (PEP 465) #65375
Comments
[Nathaniel Smith at numpy-discussion] Guido just formally accepted PEP-465: Yay. The next step is to implement it, in CPython and in numpy. I have time The todo list for CPython is here: |
Here's a first patch. It works, but needs more tests (associativity, precedence, __rmatmul__, etc...) and also docs. I can work on that tomorrow. |
Here are changes to the operator module... |
I've got to the point where I can do >>> import ast
>>> ast.dump(ast.parse('a @ b'))
"Module(body=[Expr(value=BinOp(left=Name(id='a', ctx=Load()), op=MatMult(), right=Name(id='b', ctx=Load())))])" I'll post a link to my bitbucket clone shortly. |
Here is a nearly complete patch... |
Wow! That was quick. And I am still fighting with bitbucket. Maybe I should stop duplicating the effort at this point. |
On Mon, Apr 7, 2014, at 22:09, Alexander Belopolsky wrote:
Sorry about that. I only saw the first message, where Nathaniel invites |
Thanks for stepping in. From a quick look at your patch I don't see anything that I would do much differently. I noticed some whitespace issues in Include/token.h: -#define AT 49
-#define RARROW 50
-#define ELLIPSIS 51
+#define AT 49
+#define ATEQUAL 50
+#define RARROW 51
+#define ELLIPSIS 52 (Are you sure you want to re-enumerate RARROW and ELLIPSIS? Why not just give ATEQUAL the value of 52?) |
+ .. versionadded:: 3.4 Are you planning to use the time machine? :-) |
On Mon, Apr 7, 2014, at 22:23, Alexander Belopolsky wrote:
I thought it would be nicer if ATEQUAL was right after AT. |
On Mon, Apr 7, 2014, at 22:25, Alexander Belopolsky wrote:
Good catch. :) |
Here's my latest and greatest version. I'll finish up after some sleep. |
Here's what I consider a complete patch. |
I think this patch is fairly straightforward, and I don't want it to rot, so here we go... |
New changeset c553d8f72d65 by Benjamin Peterson in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: