A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/020819.html below:

[Python-Dev] For review: PEP 285: Adding a bool type

[Python-Dev] For review: PEP 285: Adding a bool type [Python-Dev] For review: PEP 285: Adding a bool typeDavid Abrahams David Abrahams" <david.abrahams@rcn.com
Sat, 9 Mar 2002 07:43:38 -0500
----- Original Message -----
From: "Tim Peters" <tim.one@comcast.net>


> [David Abrahams]
> > In general, I can change my doctests to use assert rather than
looking
> > for 1 or 0.
>
> If you want x-version doctests, you could change
>
> """
> >>> boolean_expect_true
> 1
> >>> boolean_expect_false
> 0
> """
>
> to, e.g.,
>
> """
> >>> boolean_expect_true and 1
> 1
> >>> boolean_expect_false or 0
> 0
> """
>
> Then you won't get hosed by -O (as an assert would do).

...I guess I can see why you're really intending that

    >>> 0 or False
    False

but

    >>> False or 0
    0

This sure rubs all my expectations for a bool the wrong way, though. I
think I'd better just write my own assertion routine, as Guido
suggested. I don't like non-obvious language constructs for something so
simple (I'd mention ?: here but I don't need the bruises).


> You may not run
> doctests with -O today, but the more -O does over time the more
important it
> will become to do so.

Yes.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4