Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 413 Bytes

README.md

File metadata and controls

21 lines (15 loc) · 413 Bytes

extends

A simple Python library that adds a decorator which helps extend functionality of classes by new methods without inheriting them

Example

from dataclasses import dataclass
from typing import List
from extends import extends


@dataclass
class Student:
    name: str
    marks: List[int]


@extends(Student)
def avg(self: Student) -> float:
    return sum(self.marks) / len(self.marks)