notes about optional parameter value
This commit is contained in:
parent
e7839efdc0
commit
16b427d0e9
11
README.md
11
README.md
@ -51,6 +51,17 @@ class Foo(EnvExperiment):
|
|||||||
* No implicit coercion, require implicit cast. Integers are int32 by default,
|
* No implicit coercion, require implicit cast. Integers are int32 by default,
|
||||||
floating point numbers are double by default.
|
floating point numbers are double by default.
|
||||||
* RPCs: optional parameter type signature, require return type signature.
|
* RPCs: optional parameter type signature, require return type signature.
|
||||||
|
* Value of the optional parameter would be created by the caller, and
|
||||||
|
independent between different invokations. The following code would always
|
||||||
|
output 2 `1`, instead of `1` and `2` for actual Python:
|
||||||
|
```py
|
||||||
|
def test(a = [1]):
|
||||||
|
print(a)
|
||||||
|
a[0] += 1
|
||||||
|
|
||||||
|
test()
|
||||||
|
test()
|
||||||
|
```
|
||||||
|
|
||||||
## Generics
|
## Generics
|
||||||
We use [type variable](https://docs.python.org/3/library/typing.html#typing.TypeVar) for denoting generics.
|
We use [type variable](https://docs.python.org/3/library/typing.html#typing.TypeVar) for denoting generics.
|
||||||
|
Loading…
Reference in New Issue
Block a user