Skip to content

Instantly share code, notes, and snippets.

@cpcloud
Created February 23, 2018 22:22
Show Gist options
  • Save cpcloud/45a5a2af59443218063c78510bd2c625 to your computer and use it in GitHub Desktop.
Save cpcloud/45a5a2af59443218063c78510bd2c625 to your computer and use it in GitHub Desktop.
Goofing off
In [6]: from slumba.miniast import *
In [7]: from slumba.source import sourcify
In [8]: myfunc = def_.silly_func(arg.a)(
...: if_(
...: load.a == 1,
...: return_(load.a + 2),
...: return_('Foo')
...: )
...: )
In [9]: print(sourcify(myfunc))
def silly_func(a):
if a == 1:
return a + 2
else:
return 'Foo'
@cpcloud
Copy link
Author

cpcloud commented Feb 23, 2018

Here's what classes look like:

    myklass = class_.Yuge(load.object, metaclass=load.object)(
        def_.method1(arg.self, arg.a)(
            if_(load.a == 1, return_(load.a + 1), return_(1))
        )
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment