DEV Community

Super Kai (Kazuya Ito)
Super Kai (Kazuya Ito)

Posted on • Edited on

D - Glossary (Python)

Buy Me a Coffee

declare

  • means to tell a name existence to BC so no memory allocation happens because an object isn't created:
    • E.g. v: int and def func(x: int) -> None: ....

define

  • means to declare, then to ask VM to allocate memory in RAM for an object:
    • E.g. v: int = 100 and def func(x: int = 100) -> None: ....
    • define includes the meaning of declare because for v: int = 100, we say only define but not declare, then define.

dynamic type

  • is the implicit type always inferred by VM at rtime.
  • 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)