May i customize basic operator (such as 1==3)?

kanchy kang zzhikang at hotmail.com
Wed Feb 22 01:49:42 EST 2006


Thank you for your suggestions!


>From: Steve Holden <steve at holdenweb.com>
>To: kanchy kang <zzhikang at hotmail.com>
>CC: python-list at python.org
>Subject: Re: May i customize basic operator (such as 1==3)?
>Date: Wed, 22 Feb 2006 01:44:26 -0500
>
>kanchy kang wrote:
>>many people write test cases with python scripts.
>>in these test scripts, there are many validation statements,
>>for example, in unittest, failUnless(a == b),(a/b may be stringType or 
>>intType...)
>>
>>during running test scripts, if there is one exception raised from 
>>failUnless, i still do not know a =?, b= ?... i have to add one statment 
>>"print a" or "print b" again...
>>
>>as i know, there are many validation statements if using python as one 
>>test tool...
>>i think my suggestion or requirement may benefit users greatly...
>>
>A test framework will contain many tests for equality that have nothing to 
>do with the tests themselves. So the real answer to this problem is to have 
>the tests be more explicit when they need to be. A testEqual(a, b) test 
>function would seem to be a more sensible approach than radical surgery on 
>the interpreter. The function can then print its arguments if they turn out 
>to be unequal.
>
>Otherwise there would have to be some *very* selective mechanism to decide 
>when the comparison arguments were printed out.
>
>regards
>  Steve
>--
>Steve Holden       +44 150 684 7255  +1 800 494 3119
>Holden Web LLC                     www.holdenweb.com
>PyCon TX 2006                  www.python.org/pycon/

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/




More information about the Python-list mailing list