Suppose there's a set of class Map1,Map2,Map3,... all extended from BaseMap, and I use some reflection mechanism to get the child Map's instance. I want to dynamically get an instance of one of these classes and store it in a variable m
, and have pydev recognize the type as BaseMap so I can use word completion on it.
I found one solution is to add the code
if False:
m = BaseMap(0,0,0)
after assigning m
and before using it. The line inside the if condition would never be executed, but it declares m
is a BaseMap type object.
This may look silly, but it did work. Is there any other way to do it?