Dictionary comprehension is only in Python 2.7 and some flavors of 3.

Converting this to

sv2av = dict( [ (j,i) for i,j in enumerate(arg_indices) ] )

would be fine in other versions with only slightly more clutter in the notation.



On Oct 1, 2013, at 12:41 PM, Garth N. Wells wrote:

> I'm getting an error with Uflacs and Python 2.6:
> 
>        sv2av = { j:i for i,j in enumerate(arg_indices) }
>                    ^
>    SyntaxError: invalid syntax
> 
> Seems ok with Python 2.7/
> 
> Garth
> 
> 
> On 30 September 2013 10:36, Johan Hake <[email protected]> wrote:
>> I am not sure actually. I think that some of the tests uses 2.6 features.
>> 
>> Note also that the string formatting is different in 2.6 and 2.7. Most note
>> worthy IMO is that you cannot write:
>> 
>>  "func({})".format(4)
>> 
>> but need to include the positional too:
>> 
>>  "func({0})".format(4)
>> 
>> which can become quite tedious for longer statements.
>> 
>> BTW: if we settle on have 2.6 as the minimum requirement, which I think is
>> fine, we need to check that at compile time, which I am pretty sure we do
>> not do today.
>> 
>> Johan
>> 
>> 
>> 
>> On Mon, Sep 30, 2013 at 11:14 AM, Martin Sandve Alnæs <[email protected]>
>> wrote:
>>> 
>>> We do require at least python 2.6 now, right?
>>> 
>>> I'd like to gradually start using the new string formatting.
>>> 
>>> Martin
>>> 
>>> _______________________________________________
>>> fenics mailing list
>>> [email protected]
>>> http://fenicsproject.org/mailman/listinfo/fenics
>>> 
>> 
>> 
>> _______________________________________________
>> fenics mailing list
>> [email protected]
>> http://fenicsproject.org/mailman/listinfo/fenics
>> 
> 
> 
> 
> -- 
> Garth N. Wells
> Department of Engineering, University of Cambridge
> http://www.eng.cam.ac.uk/~gnw20
> _______________________________________________
> fenics mailing list
> [email protected]
> http://fenicsproject.org/mailman/listinfo/fenics

_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to