added builtin types section
This commit is contained in:
parent
31c688b4c8
commit
effe9434ab
26
README.md
26
README.md
@ -55,6 +55,32 @@ class Foo(EnvExperiment):
|
||||
would not be kept across kernel calls, and that is a potential source of
|
||||
confusion.
|
||||
|
||||
## Built-in Types
|
||||
* Primitive types include:
|
||||
* `bool`
|
||||
* `int32`
|
||||
* `int64`
|
||||
* `float`
|
||||
* `str` (note: fixed length, provide builtin methods?)
|
||||
* `bytes`
|
||||
* Collections include:
|
||||
* `list`: homogeneous (elements must be of the same type) fixed-size (no
|
||||
append) list.
|
||||
* `tuple`: inhomogeneous fixed-size list, only pattern
|
||||
matching (e.g. `a, b, c = (1, True, 1.2)`) and constant indexing
|
||||
is supported:
|
||||
```
|
||||
t = (1, True)
|
||||
# OK
|
||||
a, b = t
|
||||
# OK
|
||||
a = t[0]
|
||||
# Not OK
|
||||
i = 0
|
||||
a = t[i]
|
||||
```
|
||||
* `range` (over `int32`, `int64`, `float`)
|
||||
|
||||
## 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