"0 in [True,False]" returns True

Grant Edwards grante at visi.com
Fri Dec 16 14:47:00 CET 2005

On 2005-12-16, Antoon Pardon <apardon at forel.vub.ac.be> wrote:

>> Your examples are still both very different from the NaN
>> example.  A NaN is a floating point operation that supports all
>> the same operations as all other floating point operations.  In
>> your example an integer object of -2 does not support the same
>> "operations" that a "real" GTK identifier does.  They are two
>> different types.
> I think the disctinction you are making is based on which level
> you look at things.

Of course.  I was looking at things from a Python point of view
since this is c.l.p.

> For you floats are something you use, you see NaN as just a
> floats because the details of implementation have been
> abstracted out for you.

That goes without saying for anything in computer science or
electronics: it's all just quantum physics whose details of
implimentation have been abstracted out for me.

> But look at it from the level of someone who has to implement
> floating point numbers. He can't just take two floats and put
> them into his general add_float algorithm. If he did that the
> result of working with a NaN could result in a regular number.
> So he has to test for special values like NaN is his 'code'
> too.
> Of course we tend to forget this because in this case the
> abstraction is usually done at the hardware level. But I don't
> think that is such an important disctinction here.

The distinction is in regards to readability and
maintainability of _Python_ code.  This is comp.lang.python.

Grant Edwards                   grante             Yow!  does your DRESSING
                                  at               ROOM have enough ASPARAGUS?

More information about the Python-list mailing list