From effe9434abcf900a3668b43de145ca70bbd43666 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Thu, 17 Dec 2020 10:22:46 +0800 Subject: [PATCH] added builtin types section --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index f093706..963aa67 100644 --- a/README.md +++ b/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.