Contents of this page:
Additional
Subroutines are converted to Python functions with no return statement. Local variables in the VB subroutine are also local in the Python version. If a module global is used on the left hand side of an assignment then a Python global statement will be inserted at the head of the function. Project globals will be replaced by their fully-qualified versions.
VB | Python |
---|---|
|
|
Optional arguments which are not supplied and have no defaults are initialized with the VBMissingArgument object. This object can be detected by the vbfunctions.IsMissing function to provide initialization of missing arguments within the body of the subroutine. This functionality is transparent under normal conditions, but if the subroutine manually assigns a value to the missing parameter prior to the IsMissing call then the behaviour may not match that of VB, since the vbfunctions.IsMissing function has no way to detect that the parameter was not supplied.
VB | Python |
---|---|
|
|
VB has two argument passing schemes,
Although Python's argument passing semantics are often refered to as pass-by-reference, the actual behaviour does not always match VB's ByRef because of immutable object types and name re-binding. Although there are technical solutions for these issues, the current version of vb2Py does not make any attempt to match behaviours.
This means that the following code, although converted, does not behave the same in the Python version
VB | Python |
---|---|
|
|
There are no options specific to the Sub statement.