All Questions
6 questions
3
votes
5
answers
1k
views
When to extract boolean conditions into their own function?
I commonly use a boolean condition/variable when it's something too big or complicated and takes too much space by itself inside ifs - basically to avoid repeatability and thus improve readability. E....
-6
votes
1
answer
411
views
While loop definition in python
My question is about a use of while loops that seems very abstract to me. I understand a while loop like the first one (one which has a clearly defined statement):
num = 1
while num<1:
...
2
votes
1
answer
2k
views
How to generate random Boolean functions in Algebraic Normal Form in Python?
I am looking at A SAT-based Public Key Cryptography Scheme and got inspired to challenge myself to write an implementation of this Cryptography Scheme on Python.
A part of the cipher encoding would ...
3
votes
1
answer
164
views
Tests for emptiness vs tests for nothingness
Is there any consensus between languages how tests for emptiness are distinct from tests for noneness? In python the following expression is false:
{} is {}
However this expression evaluates to True
...
3
votes
5
answers
1k
views
The rationale behind Falsy values [closed]
I'm wondering what the arguments for/against Falsy values are. On what principles would you decide to add or exclude them from a language? Are there any problems you could see them causing off-hand?
...
21
votes
4
answers
29k
views
Returning a boolean when success or failure is the sole concern
I often find myself returning a boolean from a method, that's used in multiple locations, in order to contain all the logic around that method in a single place. All the (internal) calling method ...