Have you ever run into a problem where your favorite Python IDE can't determine the type of a variable, and thus you get no auto-completion? There is a built-in function in Python called isInstance(your_variable, type_of_variable) that is designed to compare a variable to a class type, and return true or false. However, just the presence of this function will give many IDEs all the information they need to determine the type of your variable, and thus give you better auto-completion.
For example, imagine you had a function that returned a gtk.Window.
MyWindow = GetMyWindow()
Most IDEs would not correctly determine the type of MyWindow. To solve this, try the following code:
MyWindow = GetMyWindow()
isInstance(MyWindow, gtk.Window)
There are many articles that point out the dangers of using isInstance, however if you are simply using it like my example, it shouldn't cause any problems.
,
















August 17, 2008 12:57 PM
Just found your blog and it's so good to know I'm not alone. Yes - Linux needs a decent NLE and no, Cinelerra is not good enough. If we're going to have the linux alternative for Final Cut or Vegas I'm going to be one very happy camper.