#1076 Type injected into __builtin__ seen as undefined variable

1.4.7
closed-works-for-me
Editor (491)
5
2010-02-24
2010-02-23
No

When making a new "global type" like this in an init script::

from utility.struct import struct
__builtins__["struct"] = Struct

and then using the 'struct' type like this without any explicit import::

test = struct(a=123, b="test", c=(1,2,3))

... works in Python, but PyDev marks line as an error,reporting that name "struct" is an undefined variable.

Discussion

  • Fabio Zadrozny

    Fabio Zadrozny - 2010-02-24
    • status: open --> closed-works-for-me
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2010-02-24

    That's actually expected. You have to add 'Struct' to window > preferences > pydev > editor > code analysis > undefined > 'consider the following names as globals'.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks