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 bytecode compiler 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 virtual machine to allocate memory in RAM for an object:
      • E.g. v: int = 100 and def func(x: int = 100) -> None: ....
    • includes the meaning of declare because for v: int = 100, we only say define but don't say declare, then define.

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)