Skip to content

Instantly share code, notes, and snippets.

@17183248569
Created September 4, 2020 16:49
Show Gist options
  • Save 17183248569/f0ccdde65dfbd1e28869ac71bef1f09e to your computer and use it in GitHub Desktop.
Save 17183248569/f0ccdde65dfbd1e28869ac71bef1f09e to your computer and use it in GitHub Desktop.
[] -> ()
def f():
import marshal
tuplis=[]
def ltot(inpl):
if id(inpl) in tuplis:
return b"r"+tuplis.index(id(inpl)).to_bytes(4,"little")
else:
tuplis.append(id(inpl))
ret=b"\xa9"+len(inpl).to_bytes(1,"little")
for i in inpl:
ret+=ltot(i)
return ret
def conv(inpl):
tuplis.clear()
return marshal.loads(ltot(inpl))
return conv
conv=f()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment