On Mon, Mar 23, 2015 at 2:41 PM, Cameron Simpson <cs@zip.com.au> wrote:
But it scales very badly; what of a 4 way if etc? It moves from a bit less readable to a nightmare.

in python one particular type or None is a very common idiom -- well worth special casing. Somethign that could take or return 4 different types is a far less usual case, we can be more verbose there.

Note that Cython and Pyrex default to "or NOne", and you have to do

func( int x not None)

if you don't want to allow the None. That's because None as a not-set-yet value is so common. In this case, it's a mistake to make it the default, as Cython does not generate checks later for None, so it can get ugly if you don't specifically test for it in your code. None the less, it's very useful.

-Chris






--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov