[Python-ideas] PEP 335: Another use case

Antoine Pitrou solipsis at pitrou.net
Wed Oct 5 15:19:25 CEST 2011


On Wed, 5 Oct 2011 09:13:20 -0400
Gerald Britton <gerald.britton at gmail.com>
wrote:
> >I've received the following comments concerning another>potential use case for PEP 335.>>-------- Original Message -------->Subject: 	PEP 335 and NumPy NA>Date: 	Tue, 4 Oct 2011 15:42:50 -0700>From: 	Mark Wiebe <mwwiebe at gmail.com>>To: 	Gregory Ewing <greg at cosc.canterbury.ac.nz>>>Hi Greg,>>I took a glance at the python-ideas list, and saw that you're proposing>an update to PEP 335. I recently did a short internship at Enthought>where they asked me to look into the "missing data" problem for NumPy,>and I believe the work from that provides further motivation for the>PEP. Basically, the approach to allow good handling of missing data is>emulating the R programming language by introducing a new value called>NA, similar to the built-in None. For an NA with a boolean type, you get>a three
>  -valued logic, as described>in http://en.wikipedia.org/wiki/Three-valued_logic#Kleene_logic. In the>NA I added to NumPy, this truth table cannot be satisfied because of the>issue PEP 335 add
>  resses:
> 
> Interesting!  Kinda like SQL, I think, which has True, False and Null
> (similar to NA in R).
> Weird to think SQL "solved" this problem 40 years ago!

I wouldn't agree SQL's NULL has solved anything.
The rules around NULL calculations are a PITA to use (or work around)
and they don't really make sense in any situation I've encountered.
Python's None is much saner.

I think that, if you want some alternative logic system, you generally
use some rule engine of some sort. Mixing two different logics in the
same programming language sounds like a recipe for confusion, because
the semantics of control flow become context-dependant.

Regards

Antoine.





More information about the Python-ideas mailing list