__bool__() and __nonzero__() of Response

Do you really like this?

```
class Response(...):
    def __bool__(self):
        """Returns true if :attr:`status_code` is 'OK'."""
        return self.ok

    def __nonzero__(self):
        """Returns true if :attr:`status_code` is 'OK'."""
        return self.ok

```

I had this code:

```
def foo(request, response=None):
    ....
    if response:
        do_something_with_response
 ```

It took some time to understand why this did not work like the way I wanted.

I guess you don't want to change the current behaviour since it could break a lot of existing code.

Question: Do you really like this?

Thanks for this report!

In the future, before filing issues against open source projects, please take the time to investigate whether they have seen an issue before. If you had searched "bool" in our issue tracker the first result you'd have seen would have been for #2002, which already tracks this issue. You'll notice that we agree with you that it's bad, and have removed it in our branch for the next major release of Requests. However, it's a breaking change, so we cannot ship it before the 3.0.0 release, which is currently not timetabled.

So, in answer to your question: no, we don't like it. There are many things we don't like, but we have *far* too many users to change these things without a good run-up.

(While we're here: you should use this experience to get comfortable with using `if x is not None:` rather than `if x:`. Because of Python's booleanness rules, when you're checking a Nullable value like this one you should always explicitly look for the `None` singleton rather than rely on the fact that `None` is falsy. Most Python linters will flag this behaviour if they see it.)

I went a little bit overboard when I wrote that. It's totally unnecessary when Resoponse.ok exists.

Sent from my iPhone

> On Nov 28, 2016, at 4:55 AM, Cory Benfield <notifications@github.com> wrote:
> 
> Thanks for this report!
> 
> In the future, before filing issues against open source projects, please take the time to investigate whether they have seen an issue before. If you had searched "bool" in our issue tracker the first result you'd have seen would have been for #2002, which already tracks this issue. You'll notice that we agree with you that it's bad, and have removed it in our branch for the next major release of Requests. However, it's a breaking change, so we cannot ship it before the 3.0.0 release, which is currently not timetabled.
> 
> So, in answer to your question: no, we don't like it. There are many things we don't like, but we have far too many users to change these things without a good run-up.
> 
> (While we're here: you should use this experience to get comfortable with using if x is not None: rather than if x:. Because of Python's booleanness rules, when you're checking a Nullable value like this one you should always explicitly look for the None singleton rather than rely on the fact that None is falsy. Most Python linters will flag this behaviour if they see it.)
> 
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub, or mute the thread.
>