Skip to main content

Inner Method Dispatch for Python

Project description

Pyta = Python + Beta

Inspired by: http://www.cs.utah.edu/plt/publications/oopsla04-gff.pdf

Usage

Inner dispatch is used to guarantee pre- and post-conditions without using auxiliary methods.

Full example:

from pyta import inner, BetaMetaclass

class A(object):
    def foo(self):
        print "world!"

class B(A): # Can inherit from regular classes
    __metaclass__ = BetaMetaclass

    def foo(self):
        inner(B, self).foo()
        super(B, self).foo()

class C(B):
    def foo(self):
        print "Hello, "

Caveats

Naively checks the source of the method to see if it calls <inner>. Currently, it does <’inner(’ in src>, so it will detect things like ‘winner(’ as well. Will be fixed in a later release.

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

pyta-0.1.0.tar.gz (16.4 kB view hashes)

Uploaded Source

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