-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
link to python in some way for arkouda #15
Comments
decorator example: https://realpython.com/primer-on-python-decorators/#syntactic-sugar def my_decorator(func):
def wrapper():
print("Something is happening before the function is called.")
func()
print("Something is happening after the function is called.")
return wrapper
@my_decorator
def say_whee():
print("Whee!") |
get source code example: https://www.adamsmith.haus/python/answers/how-to-get-the-source-code-of-a-function-in-python def f():
x = 1 + 2
return(x)
source_code = inspect.getsource(f)
print(source_code)
OUTPUT
def f():
x = 1 + 2
return(x) |
parse the source_code to get ast: https://greentreesnakes.readthedocs.io/en/latest/tofrom.html >>> tree = ast.parse("print('hello world')")
>>> tree
<_ast.Module object at 0x9e3df6c>
>>> exec(compile(tree, filename="<ast>", mode="exec"))
hello world |
annotations: https://realpython.com/lessons/annotations/#:~:text=Annotations%20were%20introduced%20in%20Python,D. >>> import math
>>> def circumference(radius: float) -> float:
... return 2 * math.pi * radius
...
...
>>> circumference.__annotations__
{'radius': <class 'float'>, 'return': <class 'float'>}
>>> circumference(1.23)
7.728317927830891 |
This was referenced Jul 15, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
investigate a flow which looks like:
The text was updated successfully, but these errors were encountered: