Skip to content

Instantly share code, notes, and snippets.

View obernardocosta's full-sized avatar
👨‍💻
It's all about data and maths

Bernardo Costa obernardocosta

👨‍💻
It's all about data and maths
View GitHub Profile
@obernardocosta
obernardocosta / Vector.py
Created March 5, 2020 16:04
Dunder (or Magic) Methods in Python (Implementing a Vector class)
class Vector(dict):
def __init__(self, a, b):
import uuid
self._load(a, b)
self.id = uuid.uuid4()
self.__name__ = 'Vector:'
def _build(self, a, b):
return Vector(a, b)
def _load(self, a, b):