Changes between Version 123 and Version 124 of j2p
- Timestamp:
- 09/05/24 12:58:08 (3 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
j2p
v123 v124 382 382 ||I get an error {{{UnboundLocalError: local variable ... referenced before assignment}}} (where ... is a variable name)||Usually this happens if the variable has a name that collides with a method name or library in python, eg "list". Rename the variable so that it is not colliding|| 383 383 ||I get "Python can not handle overloaded methods that use type vars"||This happens if you overloaded a method (you have two or more methods with the same method name) and one of them uses a type var (you have <T> and use T in the method declaration). Python does not support overloading. none of the existing libraries to add this functionality can handle type variables.|| 384 ||It seems the python code uses the wrong values in my lambda expression||There is a subtle but essential scoping difference between java and python. In python, a local variable continues living even if it goes outside of scope and can be changed. If such a change happen, the lambda will use the changed value. Python only keeps the current value if a new variable is created, eg by a method call||384 ||It seems the python code uses the wrong values in my lambda expression||There is a subtle but essential scoping difference between java and python. In python, a local variable continues living even if it goes outside of scope and can be changed. The lambda will use the latest value assigned to the variable. To copy the current value, consider creating the lambda in a dedicated method||