[Python-Dev] Checking for the -3 flag from Python code

Nick Coghlan ncoghlan at gmail.com
Thu Mar 20 18:36:38 CET 2008


Steven Bethard wrote:
> On Wed, Mar 19, 2008 at 5:51 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> This flag is exposed to python code as sys.flags.py3k_warning
>>
>>  So the hack added to some of the test code that I saw go by on
>>  python-checkins isn't needed :)
> 
> Excellent.  I asked around at the sprints and everyone thought it was
> unexposed.  If no one else has already done it, I'll remove the hacks
> from test_py3kwarn and the regrtest skipping mechanism.

Brett's subsequent checkin pointed out that that particular flag is 
exposed even more directly as sys.py3kwarning, in addition to being 
accessible via the general 'command line flags' object.

The downside of the module level attribute is that it gives the illusion 
of being writable without actually having any effect when writing to it. 
The inconsistent spelling between sys.py3kwarning and 
sys.flags.py3k_warning is also a minor irritation - are we actually 
gaining anything by having both mechanisms for accessing the flag value?

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list