New “dataclass” class decorator in Python3.7

from dataclasses import dataclass@dataclass
class Vector:
x: float # type annotation
y: float # type annotation
# way to use
v = Vector(3.4, 5.5)
# most useful operation :P
person = Person(4, 4)
print( # prints 4




Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Robus Gauli

Robus Gauli

More from Medium

How To Access PostgreSQL Globally in Windows

Dissecting VSCode Python extension by a dumb approach

[Python] Custom sort

An Intro To HTTPX