Steve D'Aprano wrote:
In "any(v is None for v in values)", "any" probably isn't called until
its argument is (fully) known.
No, its a generator expression, so it provides the values one at a time, as
needed.
Okay, thank you for setting me straight. I'm only about 2 weeks down
this road so
On Wed, 20 Sep 2017 10:07 pm, Steve D'Aprano wrote:
> I'm not sure whether to be surprised or not.
>
> The first one only checks for identity, which should be really fast, while the
> `is` operator tests for equality too,
Oops, that's supposed to be `in`, not `is`.
[...]
> Ah... I see that Ro
On Wed, 20 Sep 2017 06:04 pm, Bill wrote:
> Robin Becker wrote:
>> On 16/09/2017 01:58, Steve D'Aprano wrote:
>>
>>>
>>> If you want to test for None specifically:
>>>
>>> if any(v is None for v in values):
>>> print "at least one value was None"
>>>
>> ...
>>
>> for some reason
Bill wrote:
> Robin Becker wrote:
>> On 16/09/2017 01:58, Steve D'Aprano wrote:
>>
>>>
>>> If you want to test for None specifically:
>>>
>>> if any(v is None for v in values):
>>> print "at least one value was None"
>>>
>> ...
>>
>> for some reason that seems slow on my machine
Robin Becker wrote:
On 16/09/2017 01:58, Steve D'Aprano wrote:
If you want to test for None specifically:
if any(v is None for v in values):
print "at least one value was None"
...
for some reason that seems slow on my machine when compared with
if None in values:
On 16/09/2017 01:58, Steve D'Aprano wrote:
If you want to test for None specifically:
if any(v is None for v in values):
print "at least one value was None"
...
for some reason that seems slow on my machine when compared with
if None in values:
.
C:\usr\share\rob
On Sat, 16 Sep 2017 01:43 am, Ganesh Pal wrote:
> I have a function that return's x variables How do I check if all the the
> values returned are not None/False/0/''
[...]
> value1, value2 , value3 = return_x_values()
>
>
> # check if its not none
>
> # I think this can be better
> if value1
On 09/15/2017 08:43 AM, Ganesh Pal wrote:
I have a function that return's x variables How do I check if all the the
values returned are not None/False/0/''
Here is the same program to demonstrate this , but I felt this can be
better any suggestions ?
# vi file.py
import random
import stri
I have a function that return's x variables How do I check if all the the
values returned are not None/False/0/''
Here is the same program to demonstrate this , but I felt this can be
better any suggestions ?
# vi file.py
import random
import string
def return_x_values():
" returns x