Re: [Tutor] If/else in Python 2.6.5 vs. Python 2.4.3

2010-10-11 Thread Dave Angel
On 2:59 PM, aenea...@priest.com wrote: Hi, I have code that works fine when I run it on Python 2.6.5, but I get an "invalid syntax" error in Python 2.4.3. I'm hoping you can help me fix it. The line in question splits a chunk of semi-colon separated words into separate elements. rgenre = re

Re: [Tutor] If/else in Python 2.6.5 vs. Python 2.4.3

2010-10-11 Thread Wayne Werner
On Mon, Oct 11, 2010 at 12:10 PM, wrote: > > > rgenre = re.split(r';', rf.info["genre"] if "genre" in rf.info else [] > > I get a syntax error at "if" in 2.4.3. > That's because you're using the ternary operator that was not available in 2.4: http://www.python.org/dev/peps/pep-0308/ > > I tr

[Tutor] If/else in Python 2.6.5 vs. Python 2.4.3

2010-10-11 Thread aeneas24
Hi, I have code that works fine when I run it on Python 2.6.5, but I get an "invalid syntax" error in Python 2.4.3. I'm hoping you can help me fix it. The line in question splits a chunk of semi-colon separated words into separate elements. rgenre = re.split(r';', rf.info["genre"] if "genre"