First time here? Check out the FAQ!
1

Object as param. introspection

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

philippecmartin's avatar
11
philippecmartin
asked 2020-06-03 10:15:40 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2020-06-04 15:11:34 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

Will try - thanks

philippecmartin's avatar
11
philippecmartin
answered 2020-06-04 18:55:12 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

Type hints can be added to help Wing's source code analysis. Please see https://wingware.com/doc/edit/analysi...

Wingware Support's avatar
4k
Wingware Support
answered 2020-06-04 09:19:50 -0500
edit flag offensive 0 remove flag delete link

Comments

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?

Regards.

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
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer