Skip to content

Instantly share code, notes, and snippets.

@punchagan
Created July 15, 2014 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save punchagan/22967f4662fbd0f035b3 to your computer and use it in GitHub Desktop.
Save punchagan/22967f4662fbd0f035b3 to your computer and use it in GitHub Desktop.
cinspect presentation IPython notebook
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:f8fb9627b328101ce79e5b07ffed704f9f4976f3b63c843e5847ee81d418d4cb"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Inspection for C code in CPython"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def hello():\n",
" \"\"\" This function greets Hacker Schoolers. \"\"\"\n",
" print 'Hello, Hacker Schoolers!'"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"hello?"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"hello??"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"hello()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Hello, Hacker Schoolers!\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"teams = ['Argentina', 'Germany', 'Brazil', 'Netherlands']"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"teams.pop(-1)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"text": [
"'Netherlands'"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"teams.pop??"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.display import HTML\n",
"HTML(\"\"\"<blockquote class=\"twitter-tweet\" lang=\"en\"><p>I have pry show-method envy. Are there any Python projects for finding c source of a CPython builtin function or object? cc <a href=\"https://twitter.com/IPythonDev\">@IPythonDev</a></p>&mdash; Thomas Ballinger (@ballingt) <a href=\"https://twitter.com/ballingt/statuses/483394809411825665\">June 29, 2014</a></blockquote>\n",
"<script async src=\"//platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>\"\"\")"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"<blockquote class=\"twitter-tweet\" lang=\"en\"><p>I have pry show-method envy. Are there any Python projects for finding c source of a CPython builtin function or object? cc <a href=\"https://twitter.com/IPythonDev\">@IPythonDev</a></p>&mdash; Thomas Ballinger (@ballingt) <a href=\"https://twitter.com/ballingt/statuses/483394809411825665\">June 29, 2014</a></blockquote>\n",
"<script async src=\"//platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
"text": [
"<IPython.core.display.HTML object>"
]
}
],
"prompt_number": 8
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[Source code is on GitHub](https://github.com/punchagan/cinspect)"
]
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment