Something or Nothing^H^H^H^H^H^H^HEmpty

Boris Borcic borcis at geneva-link.ch
Wed Apr 10 06:33:13 EDT 2002


Petr Prikryl wrote:
> 
[...]
>   Operations and built-in functions that have a
>   boolean result always return 0 for false and 1
>   for true, unless otherwise stated. (Important
>   exception: the boolean operations "or" and
>   "and" always return one of their operands.)
> 
> In other words, it says that in the *boolean
> context* the named cases are *converted* to
> *false* or *true* values respectively.  So, there
> is nothing like...

IMO this means everywhere a boolean role is already given
by definition to a function result, 0 or 1 is returned,
as a matter of current design style. IOW the Pep's booleans
already existed, only they were implicit.

To me the shortcut behavior of "or" and "and" and the
way this allows them to return their operands is the
clincher against your theory.

> ::
> 
>   > {} is a dictionary-shaped nothing. [] is a
>   > list-shaped nothing. 0 is an integer-shaped
>   > nothing. 0.0 is a float shaped nothing.
> 
> Again, it only obscures the things.  The students
> should have asked "What do you mean by the
> *shaped nothing*?".  (At least for me, it is far
> more obscure than the simple notion of yes/no or
> true/false.)

Blind spot are shared simultaneously with visions,
that's why arguing from clarity/obscurity is a subtle
matter.

> Compare it with what the documentation already
> says (in different wording):

I don't agree your translation is perfectly faithful.

Regards, Boris



More information about the Python-list mailing list