Skip to content

Instantly share code, notes, and snippets.

@ericdill
Created April 23, 2015 14:57
Show Gist options
  • Save ericdill/6e60d09a058f8abe15a5 to your computer and use it in GitHub Desktop.
Save ericdill/6e60d09a058f8abe15a5 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"collapsed": true,
"trusted": true
},
"cell_type": "code",
"source": "from atom.api import ContainerList, Atom",
"execution_count": 2,
"outputs": []
},
{
"metadata": {
"collapsed": true,
"trusted": true
},
"cell_type": "code",
"source": "class Foo(Atom):\n cl = ContainerList()\n ",
"execution_count": 3,
"outputs": []
},
{
"metadata": {
"collapsed": true,
"trusted": true
},
"cell_type": "code",
"source": "def printer(changed):\n print changed",
"execution_count": 11,
"outputs": []
},
{
"metadata": {
"collapsed": true,
"trusted": true
},
"cell_type": "code",
"source": "f = Foo()",
"execution_count": 12,
"outputs": []
},
{
"metadata": {
"collapsed": true,
"trusted": true
},
"cell_type": "code",
"source": "f.observe('cl', printer)",
"execution_count": 13,
"outputs": []
},
{
"metadata": {
"collapsed": false,
"trusted": true
},
"cell_type": "code",
"source": "f.cl.append(2)",
"execution_count": 14,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "{'object': <__main__.Foo object at 0x7f6d38052908>, 'type': 'create', 'name': 'cl', 'value': []}\n{'name': 'cl', 'object': <__main__.Foo object at 0x7f6d38052908>, 'value': [2], 'item': 2, 'operation': 'append', 'type': 'container'}\n"
}
]
},
{
"metadata": {
"collapsed": true,
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "python2",
"display_name": "Python 2",
"language": "python"
},
"language_info": {
"mimetype": "text/x-python",
"nbconvert_exporter": "python",
"name": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9",
"file_extension": ".py",
"codemirror_mode": {
"version": 2,
"name": "ipython"
}
},
"gist_id": "6e60d09a058f8abe15a5"
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment