Skip to content

Instantly share code, notes, and snippets.

@Lyxal
Created Aug 3, 2021
Embed
What would you like to do?
Testing the implicits library (works well btw)
from implicits import implicits
@implicits("ctx")
def pop(stack, n=1, *, ctx):
ret = [stack.pop() for i in range(n)]
if ctx.reverse_arguments: ret = ret[::-1]
return ret
# Simulate main.py
from implicits import implicits
import elements
class Context:
def __init__(self):
self.reverse_arguments = False
ctx = Context()
ctx.reverse_arguments = False
lst = [1, 2, 3, 4]
print(lst)
x = elements.pop(lst, 2)
print(x, lst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment