declare
- means to tell a name existence to bytecode compiler so no memory allocation happens because an object isn't created:
- E.g.
v: intanddef func(x: int) -> None: .... define
- means to declare, then to ask virtual machine to allocate memory in RAM for an object:
- E.g.
v: int = 100anddef func(x: int = 100) -> None: ....
- E.g.
- includes the meaning of declare because for
v: int = 100, we only say define but don't say declare, then define.
- E.g.
dynamic type
- is an implicit type always inferred by virtual machine at runtime.
- can be called runtime type but I use dynamic type because it's completely opposite to static type, which is more intuitive.
Top comments (0)