🔒 Final classes for Python3!
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.editorconfig Initial Jul 11, 2018
.gitignore Initial Jul 11, 2018
.travis.yml Version 0.1.1 release Jul 11, 2018
CONTRIBUTING.md
LICENSE
README.md
final_class.py Version 0.1.1 release Jul 11, 2018
pyproject.lock Version 0.1.0 Jul 11, 2018
pyproject.toml
setup.cfg Initial Jul 11, 2018

README.md

final_class

wemake.services Build Status

Final classes for python3.6+.

Features

  • No metaclass conflicts
  • No runtime overhead
  • No dependencies
  • Type hints included
  • Designed to be as simple as possible

Why?

In languages like java we have a nice way to restrict subclassing any class by making it final:

public final class SomeClass {
  // ...
}

In python we don't have such feature out of the box. That's where final_class library comes in!

Installation

pip install final_class

Usage

from final_class import final


@final
class Example(object):  # You won't be able to subclass it!
    ...


class Error(Example):  # Raises `TypeError`
    ...

License

MIT.