Logo

Programming-Idioms

  • Python
  • Lua
point = { x = 123, y = 456 }
from dataclasses import dataclass
@dataclass
class Point:
    x: float
    y: float
from collections import namedtuple
Point = namedtuple("Point", "x y")
point = dict(x=1.2, y=3.4)
class Point:
    def __init__(self, x, y):
        self.x, self.y = x, y
point = {'x': 1.2, 'y': 3.4}
type Point is
   record
      X : Float;
      Y : Float;
   end record;

New implementation...
< >
programming-idioms.org