[IronPython] [python] Difference in 1.1 and 2.0 with Dialog Result

Michael Foord fuzzyman at voidspace.org.uk
Sun Dec 23 09:05:05 PST 2007


Davy Mitchell wrote:
> import clr
> clr.AddReference('System.Windows.Forms')
> from System.Windows.Forms import DialogResult
> if DialogResult.OK:
>     print "Boo!"
>
> The above prints Boo! in 1.1 and early 2.0 Alphas i.e. DialogResult.OK
> resolves to TRUE.
>
> A6 and A7 (didn't try any others!) nothing is printed i.e.
> DialogResult.OK resolves to FALSE.
>
> Now, I am changing my dialog code anyway but is this a deliberate change?
>
>   

Hmm.. (IP2.0 A7)

 >>> import clr
 >>> clr.AddReference('System.Windows.Forms')
 >>> from System.Windows.Forms import DialogResult
 >>> bool(DialogResult.OK)
False
 >>> DialogResult.OK.value__
1

Odd.

Of course the right thing to be doing is:

if result == DialogResult.OK:

but it is still odd that this enumeration now evaluates to False.

Michael
http://www.manning.com/foord
> Cheers,
> Davy
>
>   



More information about the Users mailing list