Skip to content

Instantly share code, notes, and snippets.

@earwig
Last active August 29, 2015 14:09
Show Gist options
  • Save earwig/edc13f04f871c110eea6 to your computer and use it in GitHub Desktop.
Save earwig/edc13f04f871c110eea6 to your computer and use it in GitHub Desktop.
DOT files for "Replacing Objects in Python"
digraph {
rankdir=LR fontname=Courier
node [fontname=Courier penwidth=0.5]
edge [arrowsize=0.75 penwidth=0.5 minlen=2]
subgraph objects {
node [shape=box fontsize=10]
obj [label="[1, 2, 3, 4]"]
}
subgraph names {
node [fontsize=14]
a
}
a -> obj
}
digraph {
rankdir=LR fontname=Courier
node [fontname=Courier penwidth=0.5]
edge [arrowsize=0.75 penwidth=0.5 minlen=2]
subgraph objects {
node [shape=box fontsize=10]
obj [label="[1, 2, 3, 4]"]
}
subgraph names {
node [fontsize=14]
a
b
c [label="c.data"]
}
subgraph cluster0 {
penwidth=0.5
label="d"
L
}
a -> obj
b -> obj
c -> obj
L -> obj
}
digraph {
rankdir=LR fontname=Courier
node [fontname=Courier penwidth=0.5]
edge [arrowsize=0.75 penwidth=0.5 minlen=2]
subgraph objects {
node [shape=box fontsize=10]
obj [label="<__main__.A object at 0xdeadbeef>"]
}
subgraph cluster {
label=PyMethodObject labelloc=b penwidth=0
node [fontsize=14]
struct[shape=plaintext label=<
<TABLE BORDER="0" CELLBORDER="1" CELLPADDING="2" CELLSPACING="0">
# Note that the border should be changed to 0.5 after generation
<TR><TD ALIGN="LEFT" BGCOLOR="#EEEEEE"><FONT COLOR="#888888">struct _object* </FONT><FONT FACE="Courier-Oblique" COLOR="#666666">_ob_next</FONT></TD></TR>
<TR><TD ALIGN="LEFT" BGCOLOR="#EEEEEE"><FONT COLOR="#888888">struct _object* </FONT><FONT FACE="Courier-Oblique" COLOR="#666666">_ob_prev</FONT></TD></TR>
<TR><TD ALIGN="LEFT" BGCOLOR="#EEEEEE"><FONT COLOR="#888888">Py_ssize_t </FONT>ob_refcnt</TD></TR>
<TR><TD ALIGN="LEFT" BGCOLOR="#EEEEEE"><FONT COLOR="#888888">struct _typeobject* </FONT>ob_type</TD></TR>
<TR><TD ALIGN="LEFT"><FONT COLOR="#888888">PyObject* </FONT>im_func</TD></TR>
<TR><TD ALIGN="LEFT" PORT="f"><FONT COLOR="#888888">PyObject* </FONT>im_self</TD></TR>
<TR><TD ALIGN="LEFT"><FONT COLOR="#888888">PyObject* </FONT>im_class</TD></TR>
<TR><TD ALIGN="LEFT"><FONT COLOR="#888888">PyObject* </FONT>im_weakreflist</TD></TR>
</TABLE>
>];
}
struct:f -> obj
}
digraph {
rankdir=LR fontname=Courier
node [fontname=Courier penwidth=0.5]
edge [arrowsize=0.75 penwidth=0.5 minlen=2]
subgraph objects {
node [shape=box fontsize=10]
obj [label="<__main__.A object at 0xdeadbeef>"]
}
subgraph cluster {
label=PyCFunctionObject labelloc=b penwidth=0
node [fontsize=14]
struct[shape=plaintext label=<
<TABLE BORDER="0" CELLBORDER="1" CELLPADDING="2" CELLSPACING="0">
# Note that the border should be changed to 0.5 after generation
<TR><TD ALIGN="LEFT" BGCOLOR="#EEEEEE"><FONT COLOR="#888888">struct _object* </FONT><FONT FACE="Courier-Oblique" COLOR="#666666">_ob_next</FONT></TD></TR>
<TR><TD ALIGN="LEFT" BGCOLOR="#EEEEEE"><FONT COLOR="#888888">struct _object* </FONT><FONT FACE="Courier-Oblique" COLOR="#666666">_ob_prev</FONT></TD></TR>
<TR><TD ALIGN="LEFT" BGCOLOR="#EEEEEE"><FONT COLOR="#888888">Py_ssize_t </FONT>ob_refcnt</TD></TR>
<TR><TD ALIGN="LEFT" BGCOLOR="#EEEEEE"><FONT COLOR="#888888">struct _typeobject* </FONT>ob_type</TD></TR>
<TR><TD ALIGN="LEFT"><FONT COLOR="#888888">PyMethodDef* </FONT>m_ml</TD></TR>
<TR><TD ALIGN="LEFT" PORT="f"><FONT COLOR="#888888">PyObject* </FONT>m_self</TD></TR>
<TR><TD ALIGN="LEFT"><FONT COLOR="#888888">PyObject* </FONT>m_module</TD></TR>
</TABLE>
>];
}
struct:f -> obj
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment