Skip to content

Instantly share code, notes, and snippets.

@tdhopper
Created September 26, 2012 13:16
Show Gist options
  • Save tdhopper/3787974 to your computer and use it in GitHub Desktop.
Save tdhopper/3787974 to your computer and use it in GitHub Desktop.
{
"metadata": {
"name": "Untitled0"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": "class A(object):\n def myclass(self):\n return self.__class__.__name__\nclass B(A):\n bthang = 1",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": "a = A()\na.myclass()",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 6,
"text": "'A'"
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": "b = B()\nb.myclass()",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 9,
"text": "'B'"
}
],
"prompt_number": 9
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment