Menu

if/else ternary syntax.

2008-05-05
2013-03-15
  • James Hoskins

    James Hoskins - 2008-05-05

    pydev is marking valid syntax with errors.

    the following line is valid
    return x if y else z

    but pydev does not expect the 'if' to be there. I believe I have the latest version of pydev, shouldn't this be fixed by now?

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2008-05-05

      It should work if you configure your project as python 2.5 (see http://fabioz.com/pydev/manual_101_project_conf2.html for info on how to config that).

      Cheers,

      Fabio

       
      • Pascal CASTRO

        Pascal CASTRO - 2008-05-05

        The Project is configured as python 2.5. I checked 3 times...  :(

         
        • Fabio Zadrozny

          Fabio Zadrozny - 2008-05-05

          Do you have something in your error log? Are you using PyLint? Is your configured interpreter python 2.5?

          Cheers,

          Fabio

           
          • Pascal CASTRO

            Pascal CASTRO - 2008-05-05

            I am not using PyLint.
            Interpreter is set to python 2.5
            log file is there:
            http://www.sendspace.com/file/hgtzl7

            Cheers,
            Pascal

             
        • Pascal CASTRO

          Pascal CASTRO - 2008-05-06

          Oups... Sorry for answering in the wrong Thread. (I was tired last night....)

           
    • David Mischel

      David Mischel - 2008-05-05

      Hi,

      I tested the same code and got the same syntax error. Then I used Fabioz's suggestion to check the project configuration. Sure enough, it was still configured for 2.4 even though I had advanced the interpreter to 2.5. Changing the project config made the syntax error go away.

      Thanks,

      < david

       
    • James Hoskins

      James Hoskins - 2008-05-06

      Thank you for the quick response, I could not find that config screen before. I changed the version and it worked. Thanks!!