starlark
starlark copied to clipboard
check the type like Python?
trafficstars
For example:
>>> x = 123
>>> type(x) is int
True
>>> type(x) is str
False
>>>
How to do this in Starlark?
In starlark spec starlark, the way to do it is:
type(x) == type(1)
in starlark-rust we have isinstance:
isinstance(x, int)
which I thing might be helpful addition to starlark spec, some basic form, i.e. mandate isinstance should work for builtin constructors like int or list.