Skip to content

Instantly share code, notes, and snippets.

@niccokunzmann
Created February 17, 2013 15:43
Show Gist options
  • Save niccokunzmann/4971938 to your computer and use it in GitHub Desktop.
Save niccokunzmann/4971938 to your computer and use it in GitHub Desktop.
Coming closer to my goal of subjective programming
# see https://github.com/niccokunzmann/wwp
from relative import roleOf, useRoles
@roleOf(int)
class NaturalNumber:
@property
def successor(self):
return self + 1
@useRoles
def test():
# this is possible if we recompile the code objects
i = 1
assert i.successor == 2
if __name__ == '__main__':
test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment