Author demian.brecht
Recipients BreamoreBoy, demian.brecht, georg.brandl, larry
Date 2015-02-26.07:44:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424936660.09.0.081407403617.issue20408@psf.upfronthosting.co.za>
In-reply-to
Content
> Oddly, memoryview accepts keyword arguments (for its one required value), and the name of the argument is "object", not "obj".

Positional parameters can also be treated as named arguments.

> I think it's plain daft having "object" as a keyword argument.

True, it's not best practice to override builtins with parameter names. In this case because memoryview is implemented in C, it doesn't suffer the same consequences as a Python implementation can. However at the very least, I do agree that it does seem a little odd from a user's standpoint. Also, the docs currently use "obj" rather than "object": https://docs.python.org/3/library/stdtypes.html#memoryview.

I've attached a patch that just changes the name of the parameter. Scanning through Github (primarily numpy and scipy), I wasn't able to find anyone making use of the parameter name.

As this does break backwards compatibility and is more of a cosmetic enhancement than a bug, it should only go into 3.5+.

The other option here, other than to just leave it as is, is to simply use Py_ParseTuple rather than PyArg_ParseTupleAndKeywords, but I'm not sure what the general consensus is on that (it seems to me that the preferred approach is the latter).
History
Date User Action Args
2015-02-26 07:44:20demian.brechtsetrecipients: + demian.brecht, georg.brandl, larry, BreamoreBoy
2015-02-26 07:44:20demian.brechtsetmessageid: <1424936660.09.0.081407403617.issue20408@psf.upfronthosting.co.za>
2015-02-26 07:44:20demian.brechtlinkissue20408 messages
2015-02-26 07:44:19demian.brechtcreate