Ask Your Question

Object as param. introspection

asked 2020-06-03 10:15:40 -0500

philippecmartin's avatar

updated 2020-06-04 15:11:34 -0500

Hi, example: I have a method that takes two objects as constructor param (class0.__init__ (class1.obj1, class2.obj2)

Before debugging class0.method1 the editor finds one (ex: typing class1.obj1. will popup a list of possibilities).

However the second object (class2.ob2) will only be "known" when debugging the method.

What I do for now is clear a local var in class0.method1 which instantiate a bogus object for class1 or class2 then change it to point to the actual object before running. Works but tedious.

What should I be looking for to fix this ?

Regards, Philippe

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-06-04 09:19:50 -0500

Type hints can be added to help Wing's source code analysis. Please see

edit flag offensive delete link more


On the above doc, at the bottom, it told the following example code:

    if 0:
      import othermodule
      isinstance(obj, othermodule.CMyClass)

But I'm still confusing on the if 0: used here. 0 == False, so when the code will be executed?


hongyi-zhao's avatar hongyi-zhao  ( 2020-06-05 18:10:40 -0500 )edit

The hint is for Wing's code analyzer which does not execute code. The if 0: is used to intentionally add code that won't be executed but that Wing's code analyzer will see

Wingware Support's avatar Wingware Support  ( 2020-06-08 10:33:25 -0500 )edit

answered 2020-06-04 18:55:12 -0500

philippecmartin's avatar

Will try - thanks

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-06-03 10:15:40 -0500

Seen: 313 times

Last updated: Jun 04 '20