Fredrik Lundh wrote:
Well, OK. But, lest people should think the worse of win32all because of my laziness in not finding the exact quote, I should point out that the code I meant to quote actually says:Steve Holden wrote:
It was unfortunate that so many people chose to use that for compatibility, when if they'd used the same code that the win32all extensions did they could have retained backward compatibility even across a change to constants:
try: True except AttributeError: True, False = (1==1), (1!=1)
that doesn't work, though:
$ python2.1 test.py Traceback (most recent call last): File "test.py", line 2, in ? True NameError: name 'True' is not defined
# Pre 2.2.1 compat. try: True, False except NameError: True = 1==1; False = 1==0
I believe this should work for all versions up to 2.4, and would also work with a 2.5 that made True and False constants. But if anyone can prove me wrong it would be you ... :-)
regards Steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/ Holden Web LLC +1 703 861 4237 +1 800 494 3119 -- http://mail.python.org/mailman/listinfo/python-list