Vincent Legoll wrote: > On Tue, Nov 25, 2008 at 11:27 AM, Stephen Kennedy <[EMAIL PROTECTED]> 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 _______________________________________________ meld-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/meld-list
