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.

Source Distribution

extends-0.3.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

extends-0.3.0-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file extends-0.3.0.tar.gz.

File metadata

  • Download URL: extends-0.3.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.2 CPython/3.8.0 Windows/10

File hashes

Hashes for extends-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4b7a5bd1476b0ef1c541decc1b90407e9315548eb11c8aea987eba69d123b5cc
MD5 53a751c1b9381ad7d94f72cf9cb9a25b
BLAKE2b-256 d9f80203dd66cd49021e7817c01977290e87314bf42ebcc1507cff2c076fef01

See more details on using hashes here.

File details

Details for the file extends-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: extends-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.2 CPython/3.8.0 Windows/10

File hashes

Hashes for extends-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b98319e21217d128c1ec4a935579c0cde429f2de7774bafdbc528b3d01314f29
MD5 9af6455a6916c86e03047ffabc80e785
BLAKE2b-256 91a8ee3b075a3cde69bd55f7679641d668321af669842f767c6092e4ddf14335

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page