Skip to content

A python package to proxy existing classes, and delegates calls, etc. Useful for immutable types (i.e. int)

Notifications You must be signed in to change notification settings

pyprogrammer/pyranoid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 

Repository files navigation

pyranoid

A python package to proxy existing classes to create class-level proxied-object factories instead of standard object-level proxying.

Example:

import Pyranoid

IntProxy = Pyranoid.BaseProxy(int)

myint = IntProxy(3) #creates a new mutableint

def f(x):
  x += 3
  
f(3) #myint is now 6

other uses:

a = b = IntProxy(10)
a += 10
print(a,b) #20 20

as opposed to

a = b = 10
a += 10
print(a,b) #20 10

class TestClass:
  def hello(self):
    return 'hello world'
    
TestAspect = AspectProxy(TestClass)
TestAspect.before('hello', print)
TestAspect().hello()

#<object TestAspect at #######>
#'hello world'

About

A python package to proxy existing classes, and delegates calls, etc. Useful for immutable types (i.e. int)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages