[IronPython] False? with Unit Test

Davy Mitchell daftspaniel at gmail.com
Sun Apr 6 14:55:35 CEST 2008


Thanks for all that. Surprised it got so complicated.

Wondering if you guys ever sleep!! :-)

Davy

On Sun, Apr 6, 2008 at 12:24 AM, Curt Hagenlocher <curt at hagenlocher.org>
wrote:

> On Sat, Apr 5, 2008 at 10:21 AM, Michael Foord
> <fuzzyman at voidspace.org.uk> wrote:
> >
> > As bool inherits from int, calling 'sys.exit' with False ought to be
> > exactly the equivalent of calling it with 0. (False == 0, True == 1).
>
> SystemExitException.GetExitCode calls TypeCache.Int32.IsInstanceOfType
> with the argument to the exit function, and this function returns
> false when the type of the argument is System.Boolean.
>
> In other words, this discrepancy happens because
> TypeCache.Int32.IsInstanceOfType(false) == false
> TypeCache.Int32.IsInstanceOfType(4) == true
>
> Interestingly, a user-defined type that derives from "int" produces
> the correct response.
>
> --
> Curt Hagenlocher
> curt at hagenlocher.org
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080406/91cdeb9a/attachment.html>


More information about the Ironpython-users mailing list