Skip to content

Bunch-of-cells/pytrait

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traits in Python

Create a new trait

from trait import Trait, implemented, private_impl

class MyTrait(Trait):
    def my_func(self):
        ...

    @implemented
    def default(self):
        print("This is the default implementation")

    @private_impl
    def personal_method(self):
        print("This is a personal method, cannot be accessed by anyone")

How Impl a Trait

class MyClass:
    pass

class Impl(MyTrait, MyClass):
    def my_func(self):
        print("This is the implementation of my_func")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages