PEP 285: Adding a bool type
Martin v. Loewis
martin at v.loewis.de
Sun Mar 31 05:47:11 EST 2002
Peter Hansen <peter at engcorp.com> writes:
> But your point in the message I was replying to was that there
> are 300 functions which have code that says "return 0" or "return 1"
> or "return None" and the change will help users of those functions.
> Didn't that imply those users are not looking at the documentation,
> but are trying to read the source to figure out how the code works?
No. It implied that users read the source of the code; whether or not
they look at the documentation was not implied.
> If the documentation must be changed, why not just make it clear in
> the documentation what it means when a method returns 1 or 0 or
> None?
The documentation already says that. However "If the section in fact
existed, return 1. Otherwise return 0." leads to the question "why
aren't you returning a boolean value?", to which the answer is
"because they are not supported in the language".
> True, False = 1, 0
>
> Or, now that I think of it, will that continue to work as these
> will just be built-ins now hidden by my local definitions?
Indeed, yes.
> If so, my bad for mentioning code breakage.
There still might be code breakage, but it will be much less frequent
than you feared.
Regards,
Martin
More information about the Python-list
mailing list