[wingide-users] Using isinstance() to assist analysis

Wingware Support support at wingware.com
Wed Apr 6 09:17:31 MDT 2011


On 4/6/11 11:11 AM, Mitchell Model wrote:
> The documentation says: "One way to inform the code analysis facility of the type of a variable is to add an isinstance call in your code.  An example is assert isinstance(obj, CMyClass).  The code analyzer will pick up on these and present more complete information for the asserted values." If I want to do this for an instance variable used in many methods of a class, I would have to do it in each method in which I want the type of the instance variable to be known, correct? No way to do it for the instance variable's appearance (e.g., self._model) in the entire class?

A single 'isinstance(self._model, SomeType)' should be enough so that 
Wing knows the type of self._model in all places it's referenced.

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list