New submission from Jon Parise <j...@indelible.org>:

I've sometimes found it useful to define a convenience macro named
Py_RETURN_BOOL(x) which is essentially:

#define Py_RETURN_BOOL(x) if (x) Py_RETURN_TRUE; else Py_RETURN_FALSE

It's useful for implementing functions which return Boolean values based
on simple conditions.

I think it's readable and doesn't detract from regular program flow,
although it does hide the condition behind a macro, which detracts a bit
from the code's debug-ability.

----------
components: Interpreter Core
files: Py_RETURN_BOOL.patch
keywords: patch
messages: 93164
nosy: jon
severity: normal
status: open
title: Py_RETURN_BOOL() convenience macro
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file14982/Py_RETURN_BOOL.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7004>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to