forked from metacall/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
48 lines (39 loc) · 1.08 KB
/
example.py
File metadata and controls
48 lines (39 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
def dont_load_this_function(left, right):
# This function will be loaded anyway because ducktype is supported now
result = left * right
print(left, ' * ', right, ' = ', result)
return result
def multiply(left: int, right: int) -> int:
result = left * right
print(left, ' * ', right, ' = ', result)
return result
def divide(left: float, right: float) -> float:
if right != 0.0:
result = left / right
print(left, ' / ', right, ' = ', result)
else:
print('Invalid right operand: ', right)
return result
def sum(left: int, right: int) -> int:
result = left + right
print(left, ' + ', right, ' = ', result)
return result
def hello():
print('Hello World from Python!!')
return
def strcat(left: str, right: str) -> str:
result = left + right
print(left, ' + ', right, ' = ', result)
return result
def bytebuff(input: bytes) -> bytes:
print(input)
print('Input length: ', len(input))
buffer = b'abcd'
print(buffer)
print('Output length: ', len(buffer))
return buffer
def return_array():
return list([1, 2, 3])
def return_same_array(arr):
return arr