Re: Execution error on Meld 1.2.1



Vincent Legoll wrote:
> On Tue, Nov 25, 2008 at 11:27 AM, Stephen Kennedy <stevek gnome org> wrote:
>> Looks like a python2.4/2.5 parser difference.
>>
>> You can always assign to a temporary
>>     idx = 1 if len(files) >= 2 else 0
>>     self.textview[idx].grab_focus()

a) This doesn't work with python 2.4.0 (same parse error)

> maybe even better if it's the ternary operator that's the problem would be :
> 
> if len(files) >= 2:
>   idx = 1
> else:
>   idx = 0
> self.textview[idx].grab_focus()

b) I tried in python 2.4.0 and this is the only change needed.

> or for the C-backgrounder:
> self.textview[int(len(files) >= 2)].grab_focus()
> 
> Which assumes int(<Boolean>) will stay stable accross future revisions...
> 
> this should work even with Python-1.5:

c) Well, this certainly works too, but it also makes code harder to read.

I would go with b) option ...

-- 
Best Regards / S pozdravom,

Pavol RUSNAK                                       SUSE LINUX, s.r.o
Package Maintainer                                Lihovarska 1060/12
PGP 0xA6917144                                     19000 Praha 9, CR
prusnak[at]suse.cz                                http://www.suse.cz


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]