[IronPython] False? with Unit Test
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!! :-)
On Sun, Apr 6, 2008 at 12:24 AM, Curt Hagenlocher <curt at hagenlocher.org>
> 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
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...
More information about the Ironpython-users