Comparisons and sorting of a numeric class....

Rustom Mody rustompmody at
Fri Jan 16 12:22:22 CET 2015

On Friday, January 16, 2015 at 7:20:13 AM UTC+5:30, Andrew Robinson wrote:
<snipped 542 lines>

1. Ive not really read the above 542 lines and earlier
2. I am not a fan of OOP

Still some thoughts...

Electrical engineering (EE) and computer science (CS) may seem related
but are quite different disciplines. In fact there is some amount of
'client-supplier' in this relation - you folks make the machines we use.

Now one of the basic things that needs to be effected to make this transition
is the so-called digital abstraction

To start with we say (say) that 0V is 0-logic, 3.3V is 1-logic.
But that's hardly enough, we need margins, forbidden regions, Postel's law
etc.  This mapping is hardly straightforward. And that is still the

When time comes in we need to deal with the fact that when a gate
switches it will willy-nilly go through the forbidden region.  From here
we have to go through/into clock disciplines, delay insensitie circuits etc.

Should CS-ists deal with all this??
If you say yes then what are you EE-guys doing?
If no then you are agreeing with all the others here.

In some more detail:
You seem to want a multi-valued logic. How many values?
There are quite a few answers:

- 4 -- {0,1,Z,X} -
- 9 -- above + weak drives

And probably half a dozen others.

You say you REALLY NEED these in your work.
Yes, many people need many things, eg.

1. Mars orbiter was lost due to a mismatch of MKS and FPS systems

Does that make a case for building in units into programming languages?

2. C.A.R Hoare said the invention of the null-pointer was a billion-dollar
mistake. Do C programmers agree with him?

3. He also considered exception handling as a terrible disaster since it
confuses flow of control.  Are python (or most modern language) users likely
to agree?

All these are instances of a basic principle that Niklaus Wirth enunciated:
The most important decision of a language designer are what to leave out
of the language.

Finally in python 3.4 onwards there are enums. You can do this

>>> from enum import IntEnum

>>> class Bool4(IntEnum):
...   F=0
...   T=1
...   Z=2
...   X=3

More information about the Python-list mailing list