[issue32957] distutils.command.install checks truthiness of .ext_modules instead of calling .has_ext_modules()

2021-02-03 Thread Steve Dower


Steve Dower  added the comment:

Distutils is now deprecated (see PEP 632) and all tagged issues are being 
closed. From now until removal, only release blocking issues will be considered 
for distutils.

If this issue does not relate to distutils, please remove the component and 
reopen it. If you believe it still requires a fix, most likely the issue should 
be re-reported at https://github.com/pypa/setuptools

--
nosy: +steve.dower
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32957] distutils.command.install checks truthiness of .ext_modules instead of calling .has_ext_modules()

2018-02-26 Thread Korijn Van Golen

Change by Korijn Van Golen :


--
keywords: +patch
pull_requests: +5679
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32957] distutils.command.install checks truthiness of .ext_modules instead of calling .has_ext_modules()

2018-02-26 Thread Korijn Van Golen

New submission from Korijn Van Golen <k.vango...@clinicalgraphics.com>:

distutils' Distribution class has a method has_ext_modules() that is used to 
determine if any extension modules are included in a distribution. There 
remains a call site in distutils.command.install where 
self.distribution.ext_modules is directly tested for truthiness, rather than 
calling has_ext_modules. This causes inconsistent behavior, e.g. when 
overriding has_ext_modules in a Distribution subclass.

--
components: Distutils
messages: 312932
nosy: Korijn Van Golen, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: distutils.command.install checks truthiness of .ext_modules instead of 
calling .has_ext_modules()
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32957>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Truthiness

2014-10-23 Thread Simon Kennedy
Just out of academic interest, is there somewhere in the Python docs where the 
following is explained?

 3 == True
False
 if 3:
print(It's Twue)

It's Twue

i.e. in the if statement 3 is True but not in the first
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Truthiness

2014-10-23 Thread Ian Kelly
On Thu, Oct 23, 2014 at 8:30 AM, Simon Kennedy sffjun...@gmail.com wrote:
 Just out of academic interest, is there somewhere in the Python docs where 
 the following is explained?

https://docs.python.org/3/reference/expressions.html#booleans

 3 == True
 False
 if 3:
 print(It's Twue)

 It's Twue

 i.e. in the if statement 3 is True but not in the first

No, 3 is merely true, not True.  True is just the name of a particular
singleton object that is also true.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Truthiness

2014-10-23 Thread Wolfgang Maier

On 10/23/2014 04:30 PM, Simon Kennedy wrote:

Just out of academic interest, is there somewhere in the Python docs where the 
following is explained?



https://docs.python.org/3/library/stdtypes.html#truth-value-testing


3 == True

False


as opposed to:

https://docs.python.org/3/library/stdtypes.html#comparisons


if 3:

print(It's Twue)

It's Twue

i.e. in the if statement 3 is True but not in the first



Here is the misunderstanding: it is not true that 3 is True in the if 
example, but it's evaluated as True in a boolean context. Illustration:


 3 == True
False

 bool(3) == True
True

 bool(3) is True
True

If you combine if and a comparison, it behaves like in your first example:


if 3 == True:
print('True')
else:
print('False')

False


--
https://mail.python.org/mailman/listinfo/python-list


Re: Truthiness

2014-10-23 Thread Alain Ketterlin
Simon Kennedy sffjun...@gmail.com writes:

 Just out of academic interest, is there somewhere in the Python docs where 
 the following is explained?

 3 == True
 False
 if 3:
   print(It's Twue)
   
 It's Twue

 i.e. in the if statement 3 is True but not in the first

https://docs.python.org/2/reference/compound_stmts.html#the-if-statement

says: The if statement [...] selects exactly one of the suites by
evaluating the expressions one by one until one is found to be true (see
section Boolean operations for the definition of true and false)

and then:

https://docs.python.org/2/reference/expressions.html#booleans

says: In the context of Boolean operations, and also when expressions
are used by control flow statements, the following values are
interpreted as false: False, None, numeric zero of all types, and empty
strings and containers (including strings, tuples, lists, dictionaries,
sets and frozensets). All other values are interpreted as true.

(links are to the 2.7 version of the reference manual, I think not much
has changed in 3.* versions.)

-- Alain.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Truthiness

2014-10-23 Thread Skip Montanaro
On Thu, Oct 23, 2014 at 9:30 AM, Simon Kennedy sffjun...@gmail.com wrote:

 Just out of academic interest, is there somewhere in the Python docs where
 the following is explained?


Yes:

https://docs.python.org/3/library/stdtypes.html#truth-value-testing
https://docs.python.org/2.7/library/stdtypes.html#truth-value-testing

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Truthiness

2014-10-23 Thread Simon Kennedy
Thanks everyone. That's a thorough enough explanation for me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Truthiness

2014-10-23 Thread Wolfgang Maier

On 10/23/2014 04:47 PM, Alain Ketterlin wrote:

Simon Kennedy sffjun...@gmail.com writes:


Just out of academic interest, is there somewhere in the Python docs where the 
following is explained?


3 == True

False

if 3:

print(It's Twue)

It's Twue

i.e. in the if statement 3 is True but not in the first


https://docs.python.org/2/reference/compound_stmts.html#the-if-statement

says: The if statement [...] selects exactly one of the suites by
evaluating the expressions one by one until one is found to be true (see
section Boolean operations for the definition of true and false)



Exactly, but in

if 3 == True:

the expression is 3==True , in which 3 and True compare unequal, thus, 
the expression is false.

On the other hand, in

if 3:

the expression to evaluate is just the int object and the rules below apply.


and then:

https://docs.python.org/2/reference/expressions.html#booleans

says: In the context of Boolean operations, and also when expressions
are used by control flow statements, the following values are
interpreted as false: False, None, numeric zero of all types, and empty
strings and containers (including strings, tuples, lists, dictionaries,
sets and frozensets). All other values are interpreted as true.

(links are to the 2.7 version of the reference manual, I think not much
has changed in 3.* versions.)

-- Alain.



--
https://mail.python.org/mailman/listinfo/python-list


Re: Truthiness

2014-10-23 Thread random832
On Thu, Oct 23, 2014, at 10:56, Simon Kennedy wrote:
 Thanks everyone. That's a thorough enough explanation for me.

You should know, though, that numeric values equal to 1 (and 0 for
False) _are_ == True. This works for dictionary keys, array indexes,
etc. The bool type is actually a subclass of int. Mathematical
operations on it will simply return an int, or float for division -
logical operations and bitwise and/or/xor return bool (bitwise not
returns an int because it returns the values -1 and -2)

So checking if something is == True is the same as checking if it's ==
1, and checking if it's == False is the same as checking if it's == 0.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Truthiness

2014-10-23 Thread Denis McMahon
On Thu, 23 Oct 2014 16:47:27 +0200, Alain Ketterlin wrote:

 says: In the context of Boolean operations, and also when expressions
 are used by control flow statements, the following values are
 interpreted as false: False, None, numeric zero of all types, and empty
 strings and containers (including strings, tuples, lists, dictionaries,
 sets and frozensets). All other values are interpreted as true.

Yep, and I expect this to bite S4H shortly, when he can't understand why 
the following are not all of the same truthiness:

0 (falsey - numeric 0)
[] (falsey - empty set)
 (falsey - empty string)
[] (truthy - non empty set)
[0] (truthy - non empty set)

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Truthiness

2014-10-23 Thread Steven D'Aprano
Ian Kelly wrote:

 No, 3 is merely true, not True.  True is just the name of a particular
 singleton object that is also true.

Sometimes I distinguish between true and True, where True is the
canonical boolean true object, but I prefer to refer
to true-like, true-ish, or truthy objects as a shorthand
for evaluates the same as True in a boolean context

Likewise for false-like, false-ish, falsey for objects which evaluate the
same as False in a boolean context.

It should also be pointed out that, for built-ins and the standard library
at least, a good distinction to make is that representations of Nothing
(e.g. None, empty string, empty list, zero, empty set, etc.) are falsey,
while representations of Something (e.g. non-empty strings, non-empty
lists, numbers other than zero, non-empty sets, etc.) are truthy.


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list