Last active
December 20, 2017 01:57
-
-
Save 1st1/5746f8662d938e3cadf30474eea1e25e to your computer and use it in GitHub Desktop.
sd.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import singledispatch | |
@singledispatch | |
def repr_png(arg): | |
if hasattr(type(arg), '__repr_png__'): | |
return type(arg).__repr_png__(arg) | |
raise | |
@repr_png.register(int) | |
def _(i): | |
# render an int |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment