Skip to content

coreygirard/flywrench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flywrench

Build Status
Code style: black

An ultralight drop-in module implementing the flyweight design pattern

Getting started

  • Step 1: install flywrench
pip install flywrench
  • Step 2: import flywrench
from flywrench import Flywrench
  • Step 3: subclass from flywrench
# instead of this
class SomeClass(object):
    def __init__(self, args):
        # more magic
# do this
class SomeClass(Flywrench):
    def __init__(self, args):
        # more magic
  • Step 4: there is no Step 4

ENJOY!

Advanced

tricks and tips

To Do

  • Move
  • Perhaps garbage collection. Keep track of how many links there are to a given object in cache, and when the number of links hits zero, delete it

Releases

No releases published

Packages

No packages published

Languages