#534 Anonymous Class Variable Undefined

1.3.7
closed-works-for-me
5
2008-01-04
2007-07-19
tbhimdi
No

Windows XP SP2
Eclipse 3.2.2
PyDev 1.3.8
PyDev Ext 1.3.8
Python 2.4.4

-----------

I'm using a class (attached, it's a 2 line Class) so that I can use literals instead of identifiers (e.g. foo.bar instead of foo["bar"]). It runs fine, but in Eclipse I get an error in the editor:
"Undefined variable from import: bar"

To use the class:

>>> globals = Struct(answer=42, linelen = 80, font='courier')
>>> globals.answer
42

"answer" will give the undefined variable error in this case in Eclipse.

Discussion

  • tbhimdi
    tbhimdi
    2007-07-19

    Anonymous Class

     
    Attachments
  • Fabio Zadrozny
    Fabio Zadrozny
    2008-01-04

    • status: open --> closed-works-for-me
     
  • Fabio Zadrozny
    Fabio Zadrozny
    2008-01-04

    Logged In: YES
    user_id=617340
    Originator: NO

    It should work if you add the @DynamicAttrs flag to the docstring.

    See http://www.fabioz.com/pydev/manual_adv_code_analysis.html (Passing info to code-analysis) for details.