[Python-checkins] CVS: python/dist/src/Objects boolobject.c,NONE,1.1

Neal Norwitz neal@metaslash.com
Wed, 03 Apr 2002 18:34:09 -0500


> --- NEW FILE: boolobject.c ---
> /* Boolean type, a subtype of int */
> 
> #include "Python.h"
> 
> /* We need to define bool_print to override int_print */
> 
> static int
> bool_print(PyBoolObject *self, FILE *fp, int flags)
> {
>         if (flags & Py_PRINT_RAW) {
>                 if (self->ob_ival == 0)
>                         fputs("False", fp);
>                 else
>                         fputs("True", fp);
>         }
>         else {
>                 if (self->ob_ival == 0)
>                         fputs("False", fp);
>                 else
>                         fputs("True", fp);
>         }
>         return 0;
> }

Am I missing something or does the body collapse to:

{
	fputs(self->ob_ival == 0 ? "False" : "True", fp);
	return 0;
}

Neal