problem with 'global'

Duncan Booth duncan.booth at invalid.invalid
Mon Jan 21 20:36:29 CET 2008


Marc 'BlackJack' Rintsch <bj_666 at gmx.net> wrote:

> On Mon, 21 Jan 2008 17:08:46 -0200, Gabriel Genellina wrote:
> 
>> The future statement is another example, even worse:
>> 
>> if 0:
>>      from __future__ import with_statement
>> 
>> with open("xxx") as f:
>>      print f
> 
> In Python >=2.5 it's a compile time error if that import is not the very
> first statement in a source file.
> 
That doesn't appear to be the case. With Python 2.5.1 the example 
Gabriel quoted will compile and run.





More information about the Python-list mailing list