Menu

#838 py3k dictionary/set comprehensions not supported

1.4.2
closed-fixed
None
5
2009-01-21
2009-01-21
No

This is legal python 3.0 code:

s = {1, 2, 3}
print(s)
s = {x + 1 for x in s} # pydev reports error here
print(s)
s = {x : x * 2 for x in s} # pydev reports error here
print(s)

However, pydev 1.4.2 (on eclipse ganymede/winXP, with pydev extension) doesn't recoginize this syntax, reporting various meaningless errors from 'undeclared variable x' to 'Encountered "for" at bla bla, was expecting [lots of stuff]'.

There is no separate PEPs on this features, refer to http://docs.python.org/3.0/reference/expressions.html#set-displays and around.

Discussion

  • Fabio Zadrozny

    Fabio Zadrozny - 2009-01-21
    • milestone: --> 1.4.2
    • assigned_to: nobody --> fabioz
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-01-21

    Reminders:

    It just doesn't support

    {x + 1 for x in s}

    If that construct is removed, the parsing works -- and it works as {x for x in s}, so, apparently it's not supporting the correct construct as the 1st part of the set comprehension.

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-01-21

    Fixed for 1.4.3 (svn: 2497)

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-01-21
    • status: open --> closed-fixed