True inconsistency in Python

Ben Finney bignose-hates-spam at and-benfinney-does-too.id.au
Tue Nov 18 02:22:01 EST 2003


On Tue, 18 Nov 2003 07:15:01 GMT, Ron Adam wrote:
> I believe the words 'True' and 'False' need to be treated the same as
> the digits 1, 2, 3, ...  The values of the digits do not change.   We
> depend on them not changing.

Possibly so.  For myself, I think it's good that they exist at all now.
Incremental improvement toward a canonical Boolean type is good.

  - We now have a separate 'bool' type.
  - We now hove True and False singleton objects of type 'bool'.
  - Boolean expressions now evaluate to one of these two objects.

These are all quite recent in Python.  Perhaps immutable Boolean values
will be in a future Python version.  However, I don't see that it's a
pressing need.

Assigning a new value to None is possible (until recently, it didn't
even generate a warning).  How much Python code does this break?  How
many potential errors does it cause?  My guess would be few.  Same for
the True and False values (and the numbers, if they were mutable).

There are many ways to shoot yourself in the foot in Python, if you try
hard enough.  This is one of them.  Acknowledge its existence,
acknowledge that you'd be crazy to do it, and move on.

-- 
 \     "Yesterday I parked my car in a tow-away zone. When I came back |
  `\                   the entire area was missing."  -- Steven Wright |
_o__)                                                                  |
Ben Finney <http://bignose.squidly.org/>




More information about the Python-list mailing list