Skip to main content

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

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for extends, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size extends-0.3.0-py3-none-any.whl (2.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size extends-0.3.0.tar.gz (2.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page