On 2016-09-29 09:14, Steven D'Aprano wrote:
On Thursday 29 September 2016 16:47, Rustom Mody wrote:

On Thursday, September 15, 2016 at 1:43:05 AM UTC+5:30, Terry Reedy wrote:
[...]
Python make no such nonsense claim.  By default, Python objects are truthy.

 >>> bool(object())
True

Because True is the default, object need not and at least in CPython
does not have a __bool__ (or __len__) method.  Classes with no falsey
objects, such as functions, generators, and codes, need not do anything
either.  In the absence of an override function, the internal bool code
returns True.

Not sure what you are trying to say Terry...
Your English suggests you disagree with me
Your example is exactly what I am saying; if a type has a behavior in which
all values are always True (true-ish) its a rather strange kind of
bool-nature.

In what way do you think it is "rather strange"?

This suggests that you believe that all types must have distinct truthy values
and falsey values, or else that type's values shouldn't be usable in a truth
context at all. Is that what you mean?

My view is somewhat different. I see truthiness as an abstraction. Like all
abstractions, it may leak -- I make no apologies for the fact that Python
doesn't have syntactic support for Keene three-value logic or other multi-
valued logics, nor do I make any apologies for the (hypothetical, rare) object
which doesn't fit well into this truthy abstraction. All abstractions leak
somewhere, and this abstraction is proven to work well in practice, not
withstanding the rare glitch.

[snip]
When re.search or re.match succeed, they return a match object, which is truey; when they fail, then return None, which is falsey. That's convenient.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to