Author larry
Recipients Mark.Shannon, docs@python, georg.brandl, larry, loewis
Date 2013-03-31.19:39:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364758755.79.0.998719447408.issue17589@psf.upfronthosting.co.za>
In-reply-to
Content
CPython API "functions" implemented as macros can expand into either
rvalues or statements.  Most expand into statements (often using the
do {} while (0) syntactic sugar trick), but occasionally they're legal
as rvalues.

As of this writing Py_INCREF works as an rvalue.  But discussion on
another tracker issue (#17206) proposes changing the implementation
in such a way that it will only be usable as a statement.  Although
it's mildly unlikely, it's certainly possible that this will break
somebody's code.

I propose that the documentation make an explicit ruling on whether
macros are usable as rvalues or as statements.  Perhaps a blanket
statement would suffice, "all macros are only supported for use as
statements except where explicitly noted", then annotate specific
macros that are supported for use as rvalues.  Though that raises the
question of acknowledging in the documentation that some things are
macros--I think the documentation glosses over that fact right now.

Note: I added you three (Georg, Mark, Martin) as I thought you might
have an opinion on this one way or the other.  If you're not interested,
my apologies.
History
Date User Action Args
2013-03-31 19:39:15larrysetrecipients: + larry, loewis, georg.brandl, docs@python, Mark.Shannon
2013-03-31 19:39:15larrysetmessageid: <1364758755.79.0.998719447408.issue17589@psf.upfronthosting.co.za>
2013-03-31 19:39:15larrylinkissue17589 messages
2013-03-31 19:39:15larrycreate