B.3 CS+ Python Function/Class/Property/Event

This section describes CS+ Python functions, classes, and properties.

Below is a list of CS+ Python functions, classes, and properties.

 

CS+ Python functions have the following rules.

 

-

If a parameter has a default value, then the [Specification format] parameter is described in the form "parameter-name=default-value". You can also specify parameters by value only.

Example

If the [Specification format] is "function(arg1, arg2 = 1, arg3 = True)", then arg1 has no default value; arg2 has a default value of 1; and arg3 has a default value of "True".
The parameters can be specified as follows: "function("main", 1, True)".

 

-

Parameters with default values can be omitted.
This is only possible, however, if the parameter can be determined.

Example

If the [Specification format] is "function(arg1, arg2 = 1, arg3 = True)"

>>>function("main")         : It is assumed that "function("main", 1, True)"
>>>function("main", 2)      : It is assumed that "function("main", 2, True)"
>>>function("main", arg3 = False)   : It is assumed that "function("main", 1, False)"
>>>function("main", False)  : NG because it is assumed that "arg1 = False, arg2 = "main", arg3 = 3"

 

-

You can change the order in which parameters are specified by using the format "parameter-name=default-value".

Example

If the [Specification format] is "function(arg1, arg2 = 1, arg3 = True)"

>>>function(arg3 = False, arg1 = "main", arg2 = 3)      ...OK
>>>function(False, "main", 3) : NG because it is assumed that "arg1 = False, arg2 = "main", arg3 = 3"

 

-

You should be careful when you describe a path for a folder or file as parameters.
IronPython recognizes the backslash character (\) as a control character. For example, if a folder or file name starts with a "t", then the sequence "\t" will be recognized as a tab character. Do the following to avoid this.

Example 1.

In a quoted string (""), prepend the letter "r" to make IronPython recognize the string as a path.

r"C:\test\test.py"

 

Example 2.

Use a forward slash (/) instead of a backslash (\).

"C:/test/test.py"

 

A slash (/) is used in this document.