Added nonzero test

This commit is contained in:
Guido van Rossum 1991-05-14 12:05:32 +00:00
parent 50b4ef64eb
commit 0bff015ac3
1 changed files with 8 additions and 0 deletions

View File

@ -328,6 +328,13 @@ int_abs(v)
return int_neg(v);
}
static int
int_nonzero(v)
intobject *v;
{
return v->ob_ival != 0;
}
static number_methods int_as_number = {
int_add, /*nb_add*/
int_sub, /*nb_subtract*/
@ -339,6 +346,7 @@ static number_methods int_as_number = {
int_neg, /*nb_negative*/
int_pos, /*nb_positive*/
int_abs, /*nb_absolute*/
int_nonzero, /*nb_nonzero*/
};
typeobject Inttype = {