[Tutor] question about glob.glob() implementation
Bruce Sass
bsass@freenet.edmonton.ab.ca
Fri, 16 Feb 2001 13:47:58 -0700 (MST)
On Fri, 16 Feb 2001, D-Man wrote:
> On Fri, Feb 16, 2001 at 01:19:31AM -0700, Bruce Sass wrote:
> | On Thu, 15 Feb 2001, Sean 'Shaleh' Perry wrote:
> [snip]
>
> |
> | b d action
> | - - ------
> | 0 0 skip
> | 0 1 do
> | 1 0 do
> | 1 1 do
> |
> | Since it can't be simplified, both terms are necessary.
> |
>
> Couldn't it be reduced to
>
> if (not b) and (not d) :
> skip
> else :
> do
Ya, but it is not a reduction or simplification.
You could rewrite as...
if not ((not b) and (not d)):
do
else:
skip
simply by reversing the sense of the test; applying a couple of the
"rules of replacement" (I'll use Boolean algebra syntax, 'cause
it's shorter)[1]...
(b'*d')' ---------> b''+d'' -------> b+d
DeMorgan Double
Negation
So, it is the same logically, but requires 4 operators instead of 1.
> or
>
> if b or d :
> do
> else :
> skip
This is what is there already; "else: skip" == "", right.
- Bruce
[1] Boolean Algebra words others
--------------- ----- ------
+ or v, |
* and &
' not ~
A couple of replacement rules, expressed in yet another logic system
(just to confuse you ;)...
DeMorgan's Theorem: ~(P&Q)::~Pv~Q
Double Negation: P::~~P