Pro implements a suite of auto-editing operations that take care of
editing tasks. Last week
we looked at creating and
managing blocks in Python code.
In part two of this Wing Tips series on Wing Pro's
auto-editing feature we
turn to auto-invocation, which makes writing Python code that calls
functions and methods
easier and less prone to errors.
Note: If you have Wing Personal, you don't have these
features. Please bear with
us through this and the next installment in this series. We'll return
to features that
are also present in Wing Personal after that. Or try Wing Pro on a free trial.
Auto-Enter Invocation Args
When an invocation is typed in Wing Pro, for example getattr(, the editor
inserts all the arguments for getattr
and enters a data entry mode in which the
Tab key can be used to
move between the arguments and default values. When the caret
moves out of the argument list, data entry mode ends and any unchanged
above: Type "self.a" followed by Tab for completion, Tab five times to
reach the last argument value, and then "Fa" followed by tab for
completion; after leaving the invocation, unchanged default arguments
In cases like the above, where locals are named
the same as the required arguments, very
little extra work is needed to complete the invocation. In other cases,
you may just want
to overtype what Wing enters, which is easy to do since the all the
Auto-invocation and many of Wing Pro's other features rely on the IDE's
analysis of your
source code and the modules that you import. This only works if Wing
Python you are using and where to look for modules. In most cases,
setting PythonExecutable in ProjectProperties from
the Project menu is
all you'll need.
This should be set to the value of sys.executable
(after importsys) in the
target Python installation. In some cases you may also need to add to PythonPath
in ProjectProperties, so all the modules you import can be
Auto-Entering Overridden Methods
A similar auto-editing operation enters an overridden method's
arguments, when defining a
method that overrides a method in an inherited class.
above: Type "def A" followed by Tab for completion, and then ``:`` to
move into the method body; method arguments are auto-entered based on
the overridden method in class CNewsPage.
Nested invocations are also supported, for cases where another
invocation is made
within an outer invocation.
above: Type "d = join(" to start invocation, press Tab to move to first
argument, enter "convert(" to start recursive invocation, enter
arguments for "convert" by tabbing between them, Tab to return to and
complete invocation of "join".
That's it for now. In the
next and last part of this 3-part Wing Tips series
on Wing Pro's auto-editing features we'll be looking at auto-spacing,
PEP 8, and a few