Jacl linsert versus Jython list.insert behave differently

The list insert operation for Jacl and Jython scripting language behave differently. The following table provides a scripting example with explanations illustrating the differences between the two scripting languages.
Table 1. The behavior of the list insert operation with respect to the Jacl and Jython scripting language.
Scripting Language Jacl Jython
Scripting Example
wsadmin>set x {1 2 3 4}
1 2 3 4
wsadmin>set y [linsert $x 3 999] 
1 2 3 999 4
wsadmin>puts $x 
1 2 3 4
wsadmin>puts $y 
1 2 3 999 4
wsadmin>x = [1,2,3,4]

wsadmin>y = x.insert(3,999)

wsadmin>print x 
[1, 2, 3, 999, 4]
wsadmin>print y
None
Explanation The Jacl linsert operation leaves the original list unchanged and returns a new list. The Jython list.insert operation changes the original list and does not return an output list.
The following illustrates how the Jacl2Jython program converts the Jacl linsert into the Jython list.insert operation:
JACL: set x {1 2 3}
JACL: set x [linsert $x end 4]
==>
JYTHON: x = [1, 2, 3]
JYTHON: x = x.insert( len(x), 4 )  #?PROBLEM? (jacl 123) Jython \
                                   #list.insert does not produce
                                   #any output value ('None') 
The following is an example of running the preliminary converted Jython script:
JYTHON:  x = [1, 2, 3]
JYTHON:  x = x.insert( len(x), 4 )
JYTHON:  print x
None
The problem is the Jython list.insert does not produce any output value. In this scripting example, the x.insert( len(x), 4 ) returns a NONE value and becomes assigned to the left value of x. To correct the problem you need to remove this extra assignment statement. The manually corrected list.insert statement for the Jython script is as follows:
JYTHON: x = [1, 2, 3]
JYTHON: x.insert( len(x), 4 ) #manually corrected

The following is an example of running the manually corrected Jython script:

JYTHON: x = [1, 2, 3]
JYTHON: x.insert( len(x), 4 )
JYTHON: print x
[1, 2, 3, 4]

Feedback