{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 3. IPython \uc18c\uac1c\n", "\n", "## About me\n", "\n", "\n", "\n", "- Security + \ube45 \ub370\uc774\ud130 \uc811\ubaa9 **\uc0bd\uc9c8\uc911**\n", "- [\uc73c\uc73c\ub9ac \ub9ac\ubc84\uc2f1 \ud30c\uc73c\ub9ac\uc36c \uc6b4\uc601\uc790](https://www.facebook.com/groups/1512856868944848/): \ub9ac\ubc84\uc2f1, \ud30c\uc774\uc36c \uc911\uc810\uc801\uc73c\ub85c \uac15\uc758. \uc870\ub9cc\uac04 \uc6f9\ud574\ud0b9 \ubd80\ubd84\ub3c4 \ucd94\uac00\ud558\ub824\uace0 \ud568\n", "- \ud30c\uc774\uc36c \ucd08\ubcf4\uac15\uc0ac\n", "\n", "## [2014\ub144 6\uc6d4 \ud30c\uc774\uc36c \uc138\ubbf8\ub098 \ubc1c\ud45c](https://www.facebook.com/groups/pythonkorea/permalink/647607191989112/)\n", "\n", "- [Python data for analysis](https://github.com/re4lfl0w/ipython/tree/master/python_data_analysis): \uc774 \ucc45\uc758 3\uc7a5(IPython) \uacf5\ubd80\ud55c \ub0b4\uc6a9\uc744 \uc911\uc810\uc801\uc73c\ub85c \uc124\uba85\n", "- \ub0b4\uac00 IPython Notebook \uc744 \ud65c\uc6a9\ud558\uba74\uc11c \uacaa\uc5c8\ub358 \ubb38\uc81c\ub098 \ud65c\uc6a9\ud301\n", "- \uae30\uc2b9\uc804**'\ud30c\uc774\ucc38'** \uc774\uc5c8\ub358 \uc138\ubbf8\ub098\n", "- \uc2dc\uac04\uc774 30\ubd84 \ubc16\uc5d0 \uc5c6\uc5b4\uc11c \ub4b7\ubd80\ubd84\uc740 \ud6c4\ub2e4\ub2e5 \ud588\ub358 \uae30\uc5b5..\n", "- \ub2e4\ub4e4 \uc54c\ub85d\ub2ec\ub85d\ud55c \uc258\uc744 \uc0ac\uc6a9\ud558\uace0 \uc788\ub2e4\ub294 \uac78 \ub290\ub08c(\uc5ec\ucb64\ubcf8 \uacb0\uacfc [fish shell](http://fishshell.com/)\uc744 \uc0ac\uc6a9\ud558\uace0 \uc788\uace0 \uc0c8\ub85c \uc2dc\uc791\ud55c\ub2e4\uba74 [z shell](http://www.zsh.org/)\uc744 \ucd94\ucc9c\ud55c\ub2e4\uace0 \ud558\uc2ec.\n", "- \uc5ed\uc2dc \uac1c\ubc1c\uc790\ub4e4\uc740 \uacf5\ud1b5\uc801\uc73c\ub85c \uadc0\ucc28\ub2c8\uc998\uc774 \uc2ec\ud558\ub2e4\ub294 \uac78 \ub290\ub07c\uac8c \ub428. \uadf8\ub798\uc11c \uc790\ub3d9\ud654\ub97c \uc88b\uc544\ud568. \uacf5\uac10\ub418\ub294 1\uc778\n", "- \ub9ce\uc740 \uace0\uc218\ubd84\ub4e4\uc758 \ub2e4\uc591\ud55c \uacbd\ud5d8\uc744 \ub4e4\uc5b4\uc11c \uc88b\uc558\uc74c.\n", "- 3\uc2dc \ub118\uc5b4\uc11c \ucc38\uc11d\ud55c\uac8c \uc544\uc26c\uc6c0. \uadf8 \uc774\uc804 \ubc1c\ud45c\ub3c4 \ub4e4\uc5c8\uc73c\uba74 \uc88b\uc558\uaca0\uc9c0\ub9cc ppt\ub97c \ubcf4\uba74\uc11c \ub530\ub85c \uacf5\ubd80\ud574\uc57c\uaca0\uc74c.\n", "- Emacs\uac00 \uac00\uc7a5 \uad81\uae08\ud588\uc5c8\uc74c. \uc544\uc27d\uac8c\ub3c4 \ubc1c\ud45c\ud560 \ub178\ud2b8\ubd81\uc744 \uc5c4\uccad \uc624\ub798\ub41c(?) \ub178\ud2b8\ubd81\uc744 \ub4e4\uace0\uc624\uc154\uc11c d-sub \ucf00\uc774\ube14 \uc5f0\uacb0\uc774 \uc81c\ub300\ub85c \uc548\ub410\uc74c. \uc624\ub798\ub41c \ub178\ud2b8\ubd81\uc73c\ub85c\ub3c4 Emacs\uac00 \ub3cc\uc544\uac04\ub2e4\ub294\uac78 \ubcf4\uc5ec\uc8fc\uc2dc\ub824\uace0 \ud558\uc168\uc74c. \uac70\uae30\uc5d0 \ucda9\uaca9\uacfc \uacf5\ud3ec. Emacs is my life.\n", "- Emacs\uc5d0\ub3c4 odd\uc600\ub098? IPython Notebook\uacfc \ube44\uc2b7\ud55c \uac83\uc774 \uc788\ub2e4\uace0 \ud568. \uc544\ub9c8 Emacs\uc5d0\uc11c \uac00\uc838\uc628 \uac1c\ub150\uc774 \uc544\ub2d0\ub7f0\uc9c0..?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### \uc5b4\ub5a4 \ud658\uacbd\uc5d0\uc11c \uac1c\ubc1c\ud558\ub098?\n", "\n", "- IPython\uacfc PyCharm\n", "\n", "### IPython \uc124\uacc4 \uc774\ub150\n", "\n", "- \ub300\ud654\ud615 \ucef4\ud4e8\ud305\n", "- \uc18c\ud504\ud2b8\uc6e8\uc5b4 \uac1c\ubc1c\n", "- \ucd5c\uc801\uc758 \uc0dd\uc0b0\uc131\uc744 \uc5bb\ub3c4\ub85d \uc124\uacc4\n", "- \ud3b8\uc9d1-\ucef4\ud30c\uc77c-\uc2e4\ud589 \ubc29\uc2dd\ubcf4\ub2e4 **\uc2e4\ud589-\ud0d0\uc0c9** \ubc29\uc2dd \uc7a5\ub824\n", "- \uc6b4\uc601\uccb4\uc81c\uc758 \uc258 \ud30c\uc77c \uc2dc\uc2a4\ud15c\uacfc \uc798 \ud1b5\ud569(vi\uc640 \uac19\uc774 \ubc14\ub85c \uc2dc\uc2a4\ud15c \uc258 \uba85\ub839\uc5b4\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc5b4 \uad49\uc7a5\ud788 \ud3b8\ud558\ub2e4)\n", "- \uc774\ub7f0 \ud2b9\uc9d5 \ub355\ubd84\uc5d0 \ub370\uc774\ud130 \ubd84\uc11d \ud504\ub85c\uadf8\ub798\ubc0d\uc5d0\uc11c \ub9ce\uc740 \ubd80\ubd84\uc744 \ucc28\uc9c0\ud558\ub294 \ub370\uc774\ud130 \ud0d0\uc0c9, \uc2e4\ud5d8, \uc624\ub958 \ud310\ub3c5, \ubc18\ubcf5 \ub4f1\uc744 \ube60\ub974\uac8c \ucc98\ub9ac\n", "- IPython \ud504\ub85c\uc81d\ud2b8\ub294 \uc9c4\ubcf4\ub41c \ub300\ud654\ud615 \ud30c\uc774\uc36c \uc258 \uadf8 \uc774\uc0c1\n", "- GUI \ucf58\uc194\uc5d0\uc11c \ubc14\ub85c \ud655\uc778\ud560 \uc218 \uc788\ub294 \ud45c\uc640 \uc6f9 \uae30\ubc18\uc758 \ub300\ud654\ud615 \ub178\ud2b8\ubd81 \ud615\uc2dd\n", "- \uac00\ubccd\uace0 \ube60\ub978 \ubcd1\ub82c \ucef4\ud4e8\ud305 \uc5d4\uc9c4\n", "- \uac1c\ubc1c\uc790\ub97c \uc704\ud55c \ub2e4\ub978 \ub3c4\uad6c\uc640 \ub9c8\ucc2c\uac00\uc9c0\ub85c \uac1c\uc778\ud654(\ucee4\uc2a4\ud130\ub9c8\uc774\uc9d5) \uac00\ub2a5\n", "\n", "### Vim \uc775\ud790\ub54c\ucc98\ub7fc \uc9c1\uc811 IPython\ub3c4 \uc0ac\uc6a9\ud574\ubd10\uc57c \uace0\uc218\uac00 \ub420 \uc218 \uc788\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## IPython Install\n", "\n", "- [Installing IPython](http://ipython.org/install.html)\n", "- [\uc708\ub3c4\uc6b0\uc5d0\uc11c python3 & ipython notebook install](http://hoon038.tistory.com/20): python 2.7.x\ub97c \uc0ac\uc6a9\ud558\uc2dc\uae38 \ucd94\ucc9c\n", "- [\uc708\ub3c4\uc6b0\uc5d0\uc11c easy_install, pip \uc0ac\uc6a9\ud558\uae30](http://amornatura.tistory.com/95)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "-------\n", "#### \ub0b4\uac00 IPython Notebook\uc744 \uc88b\uc544\ud558\ub294 5\uac00\uc9c0 \uc774\uc720\n", "\n", "1. **\uc18c\uc2a4 \ucf54\ub4dc \uc791\uc131**\ud558\uace0 **\ud14c\uc2a4\ud2b8**\ub97c \ubc14\ub85c \ud574\ubcfc \uc218 \uc788\uace0 \ub530\ub85c **\ubb38\uc11c\ud654**\ub97c \ud558\uc9c0 \uc54a\uc544\ub3c4 \ub41c\ub2e4. \uc989, \uacf5\ubd80 + \uc815\ub9ac\uac00 \ud55c \ubc88\uc5d0 \ub418\ubbc0\ub85c 2\ub9c8\ub9ac \ud1a0\ub07c\ub97c \ud55c \ubc88\uc5d0 \uc7a1\uc744 \uc218 \uc788\ub2e4.\n", "2. **Input, Output**\uc744 \uba85\ud655\ud788 \ubcf4\uc5ec\uc8fc\uae30 \ub54c\ubb38\uc5d0 \ub530\ub85c \ubb38\uc11c\ub97c \ubcfc \ub54c input\uc774 \ubb50\uc9c0 \uc704\ub85c \uc2a4\ud06c\ub864 \uc62c\ub9ac\uc9c0 \uc54a\uc544\ub3c4 \ub41c\ub2e4.\n", "3. \ubb38\uc11c\ud654 \uae30\ub2a5\uc774 \uc544\uc8fc \uac15\ub825\ud558\ub2e4. \uc544\uc8fc \uc9e7\uc740 **\uc2a4\ub2c8\ud3ab \ucf54\ub4dc**\ub3c4 IPython Notebook\uc73c\ub85c \uad00\ub9ac\ud558\uba74 \uae68\ub057\ud558\uac8c \uc815\ub9ac\ud560 \uc218 \uc788\ub2e4.\n", "4. github\uc5d0 \uc62c\ub9ac\uace0 nbviewer\ub9cc \uc55e\uc5d0 \ubd99\uc5ec\uc8fc\uba74 \ubc14\ub85c \uc6f9\uc73c\ub85c \ubcfc \uc218 \uc788\uae30 \ub54c\ubb38\uc5d0 **\uacf5\uc720** \uae30\ub2a5\uc774 \uc9f1!\n", "5. \ucc45\uc744 \ubcf4\uace0 \ud14c\uc2a4\ud2b8 \ud560 \ub54c \uad81\uae08\ud55c \uc0ac\ud56d\uc744 \ubc14\ub85c \ucf54\ub4dc \uc704\ub098 \uc544\ub798\uc5d0 \ub123\uace0 \ud14c\uc2a4\ud2b8 \ud574\ubcfc \uc218 \uc788\ub2e4. \uc774 \ucf54\ub4dc\ub294 \ud14c\uc2a4\ud2b8 \ucf54\ub4dc\ub77c\uace0 \uc4f8 \uc218 \uc788\ub294 \ubb38\uc11c \uae30\ub2a5\uae4c\uc9c0 \uc788\uc73c\ub2c8 \ucd5c\uace0!\n", "6. gitst\ub294 \ub2e8\ud3b8\ud654 \ub41c \uc18c\uc2a4\ub9cc \uc62c\ub9b4 \uc218 \uc788\uace0 github\ub294 \uc6b0\ub9ac\uac00 \uc798 \uc54c\uace0 \uc788\ub294 git\uc744 \uc0ac\uc6a9\ud560 \ub54c \uc4f0\ub294 \uc0ac\uc774\ud2b8\ub77c\uace0 \uc774\ud574\ud558\uba74 \ub418\uaca0\ub2e4.\n", "\n", "#### IPython Notebook \uc0ac\uc804 \uc9c0\uc2dd\n", "\n", "1. **Markdown** \uac1c\ub150\n", "2. **\ub2e8\ucd95\ud0a4**\uac00 \ub2a5\uc218\ub2a5\ub780\ud574\uc57c \ubb38\uc11c \ud3b8\uc9d1\uc2dc \ud750\ub984\uc774 \ub04a\uae30\ub294 \ud604\uc0c1 \ubc1c\uc0dd \ubc29\uc9c0(Help - Keyboard Shortcuts\uc744 \ubcf4\uba74 \uc5b4\ub5a4 \ub2e8\ucd95\ud0a4\ub4e4\uc774 \uc788\ub294\uc9c0 \ud655\uc778\ud560 \uc218 \uc788\uc73c\ub2c8 \ucc38\uace0)\n", "- [Markdown CheatSheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)\n", "\n", "- [Markdown syntax](http://daringfireball.net/projects/markdown/syntax)\n", "----------" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---------\n", "### \ub370\uc774\ud130 \ubd84\uc11d\uc5d0\uc11c \uc804\ucc98\ub9ac\uac00 \ucc28\uc9c0\ud558\ub294 \ube44\uc728\n", "\n", "- [\ucc45:Data Mining Concepts and Techniques/\ub370\uc774\ud130 \uc804\ucc98\ub9ac](http://www.potatogim.net/wiki/%EC%B1%85:Data_Mining_Concepts_and_Techniques/%EB%8D%B0%EC%9D%B4%ED%84%B0_%EC%A0%84%EC%B2%98%EB%A6%AC)\n", "- [2. \ubaa8\ub378\ub9c1\uacfc \ub370\uc774\ud130\uc758 \uc804\ucc98\ub9ac](http://www.openwith.net/?p=606)\n", "- [\ub370\uc774\ud130 \ucc98\ub9ac\uc758 \uc0c8\ub85c\uc6b4 \uac15\uc790, dblyr \ud328\ud0a4\uc9c0](http://wsyang.com/2014/02/introduction-to-dplyr/): \ub370\uc774\ud130 \ubd84\uc11d\uc5d0\uc11c \uac00\uc7a5 \ub9ce\uc740 \uc2dc\uac04\uc744 \ucc28\uc9c0\ud558\ub294 \uac83\uc740 \ub370\uc774\ud130\ub97c \ubd84\uc11d\uc5d0 \ud544\uc694\ud55c \ud615\ud0dc\ub85c \ub9cc\ub4dc\ub294 \ub370\uc774\ud130 \uc804\ucc98\ub9ac \uacfc\uc815\uc785\ub2c8\ub2e4. \uc6b0\ub9ac\uac00 \uacf5\ubd80\ud558\uba74\uc11c \ubcf4\uac8c \ub418\ub294 \ucc45\uc5d0 \uc788\ub294 \uc608\uc81c\ub294 \ub9d0 \uadf8\ub300\ub85c \uc608\uc81c\uc77c \ubfd0\uc774\uc9c0 \uc2e4\uc81c \ub370\uc774\ud130 \ubd84\uc11d \uc5c5\ubb34\uc5d0\uc11c\ub294 \ubc14\ub85c \ubaa8\ub378\ub9c1\uc774\ub098 \uc2dc\uac01\ud654\uc5d0 \uc801\ud569\ud55c \ud615\ud0dc\uc758 \ub370\uc774\ud130\ub97c \uc5bb\uae30 \uc704\ud574\uc11c\ub294 \uc9c0\ub8e8\ud558\uace0 \ubcf5\uc7a1\ud55c \uacfc\uc815\uc744 \uac70\uce58\uac8c \ub429\ub2c8\ub2e4. \ub370\uc774\ud130 \ubd84\uc11d \ud504\ub85c\uc81d\ud2b8\uc5d0 \uac78\ub9ac\ub294 \uc2dc\uac04\uc758 \uc808\ubc18 \uc774\uc0c1\uc740 \ub370\uc774\ud130\uc758 \uc804\ucc98\ub9ac, \ubcc0\ud658, \ud544\ud130\ub9c1\uc774 \ucc28\uc9c0\ud558\uac8c \ub418\ub294 \uac83\uc774 \ubcf4\ud1b5\uc785\ub2c8\ub2e4.\n", "\n", "----------" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3.1 IPython \uae30\ubcf8" ] }, { "cell_type": "code", "collapsed": false, "input": [ "a = 5" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "a" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 2, "text": [ "5" ] } ], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy.random import randn" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "data = {i: randn() for i in range(7)}" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "data" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 5, "text": [ "{0: -0.8743012242606852,\n", " 1: -0.3503569994726426,\n", " 2: -1.8293256174042911,\n", " 3: -0.3581748222027181,\n", " 4: 0.4674303701518697,\n", " 5: 1.2963689779051482,\n", " 6: -0.35058273321522254}" ] } ], "prompt_number": 5 }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Python \uc258\uc5d0\uc11c\ub3c4 IPython\ucc98\ub7fc print\uc2dc \uc77d\uae30 \ud3b8\ud55c \ud615\ud0dc\ub85c \ubcf4\uae30\n", "\n", "- \ub300\ubd80\ubd84\uc758 \ud30c\uc774\uc120 \uac1d\uccb4\ub294 print\ub97c \uc774\uc6a9\ud55c \ubcf4\ud1b5\uc758 \ucd9c\ub825 \uacb0\uacfc\uc640\ub294 \ub2ec\ub9ac \uc880 \ub354 \uc77d\uae30 \ud3b8\ud558\uac70\ub098 \ubcf4\uae30 \uc88b\uc740 \ud615\ud0dc\ub85c \ucd9c\ub825\ub41c\ub2e4.\n", "- \uae30\ubcf8 \ud30c\uc774\uc36c\uc5d0\uc11c\ub294 \uc544\ub798\uc640 \uac19\uc774 \uc77d\uae30 \uc5b4\ub835\uac8c \ucd9c\ub825\ub41c\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " >>> from numpy.random import randn\n", " >>> data = {i: randn() for i in range(7)}\n", " >>> data\n", " {0: 0.15704031900582283, 1: 1.4572292651930963, 2: 0.670018652279804, 3: -0.28682608547409777, 4: 0.848409943727261, 5: -1.3015998921226193, 6: 0.2741861195113033}\n", " >>> " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc774\uac83\uc744 IPython \ucc98\ub7fc \uc608\uc058\uac8c \ubcf4\uae30 \uc704\ud574\uc11c\ub294 pprint\ub97c \uc0ac\uc6a9\ud558\uba74 \ub41c\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " >>> from pprint import pprint\n", " >>> pprint(data)\n", " {0: 0.15704031900582283,\n", " 1: 1.4572292651930963,\n", " 2: 0.670018652279804,\n", " 3: -0.28682608547409777,\n", " 4: 0.848409943727261,\n", " 5: -1.3015998921226193,\n", " 6: 0.2741861195113033}\n", " >>> " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1.1 \ud0ed \uc790\ub3d9 \uc644\uc131\n", "\n", "- \uac89\uc73c\ub85c \ubcf4\uae30\uc5d0 IPython\uc740 \ub300\ud654\ud615 \ud30c\uc774\uc36c \uc778\ud130\ud504\ub9ac\ud130\uc640\ub294 \uc870\uae08 \ub2e4\ub974\ub2e4. \n", "- Mathematica \uc0ac\uc6a9\uc790\ub77c\uba74 \ubc88\ud638\uac00 \ubd99\uc5b4\uc788\ub294 \uc785\u2219\ucd9c\ub825 \ud504\ub86c\ud504\ud2b8\uac00 \uce5c\uc219\ud558\uac8c \ub290\uaef4\uc9c8 \uac83\uc774\ub2e4.\n", "- \uc258\uc5d0\uc11c \uc785\ub825\uc744 \ud558\ub294 \ub3d9\uc548 Tab \uc744 \ub204\ub974\uba74 \ub124\uc784\uc2a4\ud398\uc774\uc2a4\uc5d0\uc11c \uadf8 \uc2dc\uc810\uae4c\uc9c0 \uc785\ub825\ud55c \ub0b4\uc6a9\uacfc \ub9de\uc544\ub5a8\uc5b4\uc9c0\ub294 \ubcc0\uc218(\uac1d\uccb4, \ud568\uc218 \ub4f1)\ub97c \uc790\ub3d9\uc73c\ub85c \ucc3e\uc544\uc900\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "an_applet = 27" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "an_example = 42" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "markdown", "metadata": {}, "source": [ " In [3]: an\n", " an_applet an_example and any " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc608\uc81c\uc5d0\uc11c \ud30c\uc774\uc36c \uc608\uc57d\uc5b4\uc778 and, \ub0b4\uc7a5 \ud568\uc218\uc778 any\uc640 \ud568\uaed8 \uc704\ud574\uc11c \ub530\ub85c \uc815\uc758\ud55c \ub450 \ubcc0\uc218(an_apple, an_example)\ub3c4 \ubcf4\uc5ec\uc8fc\ub294 \uac83 \ud655\uc778\n", "- \ub2f9\uc5f0\ud788 \uc5b4\ub5a4 \uac1d\uccb4\uc758 \uba54\uc11c\ub4dc\ub098 \uc18d\uc131 \ub4a4\uc5d0 \ub9c8\uce68\ud45c\ub97c \uc785\ub825\ud55c \ud6c4 \uc790\ub3d9 \uc644\uc131 \uae30\ub2a5\uc744 \ud65c\uc6a9" ] }, { "cell_type": "code", "collapsed": false, "input": [ "b = [1, 2, 3]" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 8 }, { "cell_type": "markdown", "metadata": {}, "source": [ " In [6]: b\n", " %%bash %bookmark b basestring bin bool break buffer bytearray bytes " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \ubaa8\ub4c8\ub3c4 \ub611\uac19\uc774 \uc791\ub3d9" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import datetime" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 9 }, { "cell_type": "markdown", "metadata": {}, "source": [ " In [8]: datetime.\n", " datetime.MAXYEAR datetime.MINYEAR\n", " datetime.date datetime.datetime\n", " datetime.datetime_CAPI datetime.time\n", " datetime.timedelta datetime.tzinfo" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc774\uac83\uc758 \uac00\uc7a5 \uc88b\uc740 \uc7a5\uc810\uc740 \ubaa8\ub4c8\uc774\ub984\ub9cc \uc54c\uace0 \uc788\uc73c\uba74 \ub530\ub85c \ub808\ud37c\ub7f0\uc2a4 \ubb38\uc11c\ub97c \ucc3e\uc544\ubcf4\uc9c0 \uc54a\uc544\ub3c4 \uc5b4\ub5a4 \uae30\ub2a5\ub4e4\uc774 \uc788\ub294\uc9c0 \ubc14\ub85c \ud655\uc778\ud560 \uc218 \uc788\uc5b4 \uc2dc\uac04 \uc808\uc57d\ud558\uae30\uc5d0 \uad49\uc7a5\ud788 \uc88b\ub2e4.\n", "- < Tab >\uc744 \ub20c\ub800\uc744 \ub54c \ud654\uba74\uc5d0 \ucd9c\ub825 \uacb0\uacfc\uac00 \ub108\ubb34 \ub9ce\uc73c\uba74 \ucd08\ubcf4\uc790\ub294 \ud5f7\uac08\ub9b4 \uc218 \uc788\ub294\ub370, IPython\uc740 \uc544\uc608 _\ub85c \uc2dc\uc791\ud558\ub294 \ub0b4\ubd80 \uba54\uc11c\ub4dc\uc640 \uc18d\uc131\uc744 \uc81c\uc678\uc2dc\ud0a4\uace0 \ubcf4\uc5ec\uc900\ub2e4. \ubb3c\ub860 \uba3c\uc800 _\ub97c \uc785\ub825\ud558\uba74 \ud574\ub2f9 \uba54\uc11c\ub4dc\uc640 \uc18d\uc131\uc744 \uc120\ud0dd\ud560 \uc218 \uc788\ub2e4. \uae30\ubcf8\uc73c\ub85c \uc774\ub7f0 \uba54\uc11c\ub4dc\ub97c \ud0ed \uc790\ub3d9 \uc644\uc131\uc5d0 \ub123\uace0 \uc2f6\ub2e4\uba74 IPython \ud658\uacbd \uc124\uc815\uc5d0\uc11c \uc124\uc815 \uac00\ub2a5\n", "- \ud0ed \uc790\ub3d9 \uc644\uc131\uc740 \ub300\ud654\ud615 \ub124\uc784\uc2a4\ud398\uc774\uc2a4 \uac80\uc0c9\uacfc \uac1d\uccb4 \ubc0f \ubaa8\ub4c8 \uc18d\uc131\uc758 \uc790\ub3d9 \uc644\uc131\ubfd0\ub9cc \uc544\ub2c8\ub77c \ud30c\uc77c \uacbd\ub85c(\ud30c\uc774\uc36c \ubb38\uc790\uc5f4 \uc548\uc5d0\uc11c\ub3c4)\ub97c \uc785\ub825\ud55c \ud6c4 Tab\uc744 \ub204\ub974\uba74 \uc785\ub825\ud55c \ubb38\uc790\uc5f4\uc5d0 \ub9de\ub294 \ud30c\uc77c \uacbd\ub85c\ub97c \ucef4\ud4e8\ud130\uc758 \ud30c\uc77c \uc2dc\uc2a4\ud15c \uc548\uc5d0\uc11c \ucc3e\uc544\uc11c \ubcf4\uc5ec\uc900\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " In [9]: /tmp/\n", " /tmp/20140502022711/ /tmp/launch-cDn23Q/ /tmp/launch-sQsfKG/ /tmp/launchd-20363.VsYelO/ /tmp/launchd-64061.uaO30n/ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " In [9]: path = '/tmp/\n", " /tmp/20140502022711/ /tmp/launch-cDn23Q/ /tmp/launch-sQsfKG/ /tmp/launchd-20363.VsYelO/ /tmp/launchd-64061.uaO30n/ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \ub098\uc911\uc5d0 \uc0b4\ud3b4\ubcfc %run \uba85\ub839\uc5b4\uc640 \ud568\uaed8 \uc870\ud569\ud574\uc11c \uc0ac\uc6a9\ud558\uba74 \ud0a4 \uc785\ub825\uc744 \ub300\ud3ed \uc904\uc784\n", "- \ub610\ud55c \uc790\ub3d9 \uc644\uc131 \uae30\ub2a5\uc744 \uc0ac\uc6a9\ud558\uba74 \ud568\uc218\uc5d0\uc11c \uc774\ub984\uc744 \uac00\uc9c4 \uc778\uc790\ub3c4 = \uae30\ud638\uae4c\uc9c0 \ud3ec\ud568\ud574\uc11c \ubcf4\uc5ec\uc900\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1.2 \uc790\uae30\uad00\ucc30\n", "\n", "- \ubcc0\uc218 \uc774\ub984 \uc55e\uc774\ub098 \ub4a4\uc5d0 ? \uae30\ud638\ub97c \ubd99\uc774\uba74 \uadf8 \uac1d\uccb4\uc5d0 \ub300\ud55c \uc77c\ubc18 \uc815\ubcf4\ub97c \ucd9c\ub825" ] }, { "cell_type": "code", "collapsed": false, "input": [ "b = [1,2,3]" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [ "b?" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 9 }, { "cell_type": "markdown", "metadata": {}, "source": [ " Type: list\n", " String form: [1, 2, 3]\n", " Length: 3\n", " Docstring:\n", " list() -> new empty list\n", " list(iterable) -> new list initialized from iterable's items" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc774 \uae30\ub2a5\uc740 \uac1d\uccb4\uc758 \uc790\uae30\uad00\ucc30(Introspection) \uc774\ub77c\uace0 \ud558\ub294\ub370, \ub9cc\uc57d \uac1d\uccb4\uac00 \ud568\uc218\uac70\ub098 \uc778\uc2a4\ud134\uc2a4 \uba54\uc11c\ub4dc\ub77c\uba74 \uc815\uc758\ub418\uc5b4 \uc788\ub294 \ubb38\uc11c(docstring)\uc744 \ucd9c\ub825" ] }, { "cell_type": "code", "collapsed": false, "input": [ "def add_numbers(a, b):\n", " \"\"\"\n", " Add two numbers together\n", " \n", " Returns\n", " -------\n", " the_sum : type of arguments\n", " \"\"\"\n", " return a + b" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 11 }, { "cell_type": "code", "collapsed": false, "input": [ "add_numbers?" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 13 }, { "cell_type": "markdown", "metadata": {}, "source": [ " Type: function\n", " String form: \n", " File: SPSE/\n", " Definition: add_numbers(a, b)\n", " Docstring:\n", " Add two numbers together\n", "\n", " Returns\n", " -------\n", " the_sum : type of arguments" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "----\n", "\n", "#### SPSE \ub514\ub809\ud1a0\ub9ac \uc774\uc57c\uae30\n", "\n", "- github\uc5d0 \uc62c\ub9ac\uae30 \uc804 \uc784\uc2dc\ub85c SPSE \ub514\ub809\ud1a0\ub9ac\uc5d0 \uc815\ub9ac\ub97c \ud588\ub2e4.\n", "- github\uc5d0 \uc62c\ub9b0 \ub4a4\ub85c\ub294 ipython/python_data_analysis \ub85c \uc815\ub9ac\ud588\ub2e4.\n", "- \uadf8\ub7ec\ub2c8 \ud639\uc2dc \ub514\ub809\ud1a0\ub9ac \uc774\ub984\uc774 \ub2e4\ub978 \uacbd\uc6b0\uac00 \uc788\uc744 \uc218 \uc788\uc73c\ub2c8 \ucc38\uace0\ud558\uae30 \ubc14\ub780\ub2e4.\n", "\n", "----" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- ??\ub97c \uc0ac\uc6a9\ud558\uba74 \ud568\uc218\uc758 \uc18c\uc2a4\ucf54\ub4dc\ub97c \ubcf4\uc5ec\uc900\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "add_numbers??" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 14 }, { "cell_type": "markdown", "metadata": {}, "source": [ " Type: function\n", " String form: \n", " File: /Users/re4lfl0w/Documents/SPSE/\n", " Definition: add_numbers(a, b)\n", " Source:\n", " def add_numbers(a, b):\n", " \"\"\"\n", " Add two numbers together\n", "\n", " Returns\n", " -------\n", " the_sum : type of arguments\n", " \"\"\"\n", " return a + b" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### \ud2b9\uc218\ubb38\uc790 ?\uc640 *\uc758 \uc758\ubbf8\n", "\n", "- \ucef4\uacf5\ucabd\uc5d0\uc11c\ub294 [\uc640\uc77c\ub4dc \uce74\ub4dc](http://mirror.enha.kr/wiki/%EC%99%80%EC%9D%BC%EB%93%9C%EC%B9%B4%EB%93%9C)\ub77c\uace0 \ud55c\ub2e4.\n", "- ?\ub294 0, 1\n", "- *\ub294 0, 1, 1+\n", "- \ud55c \ubc88\uc5d0 \uc774\ud574\ud558\uae30\ub294 \uc5b4\ub824\uc6b0\ub2c8 \uc608\uc81c\ub97c \uc0b4\ud3b4\ubcf4\uba74\uc11c \uc774\ud574\ud558\uc790." ] }, { "cell_type": "code", "collapsed": false, "input": [ "import numpy as np" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 14 }, { "cell_type": "code", "collapsed": false, "input": [ "np.*load*?" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 15 }, { "cell_type": "raw", "metadata": {}, "source": [ "In [12]: np.*load*?\n", "np.load\n", "np.loads\n", "np.loadtxt\n", "np.pkgload" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- np.*: np \ubaa8\ub4c8\uc758 \uc55e\uc5d0 \uc5b4\ub5a4 \uae00\uc790\uac00 \uc640\ub3c4 \uc0c1\uad00\uc774 \uc5c6\uace0 \n", "- load: \uc911\uac04\uc740 load\uac00 \ubc18\ub4dc\uc2dc \ub4e4\uc5b4\uac00\uc57c \ud558\uba70 \n", "- *?: load \ub4a4\uc5d0 \uc5ec\ub7ec \ubb38\uc790\uac00 \uc788\uc5b4\ub3c4 \ub418\uace0 \uc5c6\uc5b4\ub3c4 \ub41c\ub2e4.\n", "\n", "- np.load: 1\ubc88\uc9f8*, 2\ubc88\uc9f8 *, 3\ubc88\uc9f8 ?\uc5d0 \uc758\ud574 \ubaa8\ub450 \uc0dd\ub7b5\ub420 \uc218 \uc788\ub2e4. \ub2e8, load\ub294 \uaf2d \ub4e4\uc5b4\uac00\uc57c \ud55c\ub2e4.\n", "- np.loads: 2\ubc88\uc9f8 *, 3\ubc88\uc9f8 ?\uc5d0 \uc758\ud574 load \ub4a4\uc5d0 s\uac00 \ucca8\ubd80\ub41c \uac83\ub3c4 \ucc3e\uc744 \uc218 \uc788\ub2e4.\n", "- np.loadtxt: 2\ubc88\uc9f8 *, 3\ubc88\uc9f8 ?\uc5d0 \uc758\ud574 load \ub4a4\uc5d0 txt\uac00 \ucca8\ubd80\ub41c \uac83\ub3c4 \ucc3e\uc744 \uc218 \uc788\ub2e4.\n", "- np.pkgload: 1\ubc88\uc9f8 *\uc5d0 \uc758\ud574 load \uc55e\uc5d0 pkg\uac00 \ub4e4\uc5b4\uac04 \uac83\ub3c4 \ucc3e\uc744 \uc218 \uc788\ub2e4.\n", "\n", "#### \uc774\ud574\ud558\uae30 \uc5b4\ub835\ub2e4\uba74 \uc77c\ub2e8\uc740 \uadf8\ub0e5 \ub118\uc5b4\uac00\ub77c. \uc774\uac83\uc740 \uc815\uaddc\ud45c\ud604\uc2dd \ubd80\ubd84\uc744 \uacf5\ubd80\ud574\uc57c \uc774\ud574\ud558\uae30 \ud3b8\ud55c \ubd80\ubd84\uc774\ub2e4. \ucd08\ubcf4\uc790\ub294 \uadf8\ub0e5 \uc774\ub7f0\uac83\uc774 \uc788\ub2e4\ub77c\uace0 \uc0dd\uac01\ub9cc \ud558\uace0 skip" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1.3 %run \uba85\ub839\uc5b4" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- %run \uba85\ub839\uc5b4\ub97c \uc0ac\uc6a9\ud558\uba74 IPython \uc138\uc158 \uc548\uc5d0\uc11c \ud30c\uc774\uc36c \ud504\ub85c\uadf8\ub7a8\uc744 \ubd88\ub7ec\uc640 \uc2e4\ud589 \uac00\ub2a5" ] }, { "cell_type": "code", "collapsed": false, "input": [ "!pwd" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "/Users/re4lfl0w/Documents/ipython/python_data_analysis\r\n" ] } ], "prompt_number": 19 }, { "cell_type": "markdown", "metadata": {}, "source": [ "----\n", "\n", "#### writefile \uc0ac\uc6a9\ud560 \ub54c \uc8fc\uc758\uc0ac\ud56d\n", "\n", "- \uc8fc\uc11d\uc5d0 \ud55c\uae00\uc774 \ud3ec\ud568\ub420 \uc2dc \uaf2d \uc55e\uc5d0 2\uc904\uc744 \ubd99\uc5ec\uc8fc\uc790.\n", "\n", "- \\# !/usr/bin/python\n", "- \\# -*- coding: utf-8\n", "\n", "\n", "- 2\uc904\uc774 \uc5c6\uc744\uc2dc\uc5d0 \uc774\ub7f0 \uc5d0\ub7ec\ub97c \ud655\uc778\ud560 \uc218 \uc788\ub2e4.\n", "\n", "----" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " > File \"/Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/ipython_script_test.py\", line 2\n", " # writefile \uc774\ub77c\ub294 \ub9e4\uc9c1 \ub9f9\ub839\uc5b4\ub85c Notebook\uc5d0\uc11c \ub514\uc2a4\ud06c\uc5d0 \ud30c\uc77c\uc744 \uc800\uc7a5\ud560 \uc218\ub3c4 \uc788\ub2e4.\n", " ^\n", " SyntaxError: Non-ASCII character '\\xec' in file /Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/ipython_script_test.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%writefile ch03/ipython_script_test.py\n", "# !/usr/bin/python\n", "# -*- coding: utf-8\n", "# writefile \uc774\ub77c\ub294 \ub9e4\uc9c1 \ub9f9\ub839\uc5b4\ub85c Notebook\uc5d0\uc11c \ub514\uc2a4\ud06c\uc5d0 \ud30c\uc77c\uc744 \uc800\uc7a5\ud560 \uc218\ub3c4 \uc788\ub2e4.\n", "# \ucc45\uc5d0\uc11c \ud30c\uc77c\uc774 \uc788\ub2e4\uace0 \uac00\uc815\ud558\uc790\uace0 \ud574\uc11c \ub9cc\ub4e4\uc5b4 \ubd24\ub2e4.\n", "\n", "def f(x, y, z):\n", " return (x + y) / z\n", "\n", "a = 5\n", "b = 6\n", "c = 7.5\n", "\n", "result = f(a, b, c)\n", "print result" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Overwriting ch03/ipython_script_test.py\n" ] } ], "prompt_number": 30 }, { "cell_type": "code", "collapsed": false, "input": [ "%run ch03/ipython_script_test.py" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "1.46666666667\n" ] } ], "prompt_number": 31 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc2a4\ud06c\ub9bd\ud2b8 \ud30c\uc77c\uc740 \ube48 \ub124\uc784\uc2a4\ud398\uc774\uc2a4(\ub2e4\ub978 \ubcc0\uc218\uac00 \uc120\uc5b8\ub418\uc5c8\uac70\ub098 \uc544\ubb34\uac83\ub3c4 import \ub418\uc9c0 \uc54a\uc740 \uc0c1\ud0dc)\uc5d0\uc11c \uc2e4\ud589\ub418\ubbc0\ub85c \uba85\ub839\ud589\uc5d0\uc11c python script.py \uba85\ub839\uc73c\ub85c \uc2e4\ud589\ud55c \uac83\uacfc \ub3d9\uc77c\ud558\uac8c \ub3d9\uc791\n", "- \uc2a4\ud06c\ub9bd\ud2b8 \ud30c\uc77c\uc5d0\uc11c \uc815\uc758\ub41c \ubaa8\ub4e0 \ubcc0\uc218(import, \ud568\uc218, \uc804\uc5ed\ubcc0\uc218)\ub294 \uc2e4\ud589\ub41c \ud6c4\uc5d0 IPython\uc5d0\uc11c \uc811\uadfc \uac00\ub2a5" ] }, { "cell_type": "code", "collapsed": false, "input": [ "c" ], "language": "python", "metadata": { "slideshow": { "slide_type": "skip" } }, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 18, "text": [ "7.5" ] } ], "prompt_number": 18 }, { "cell_type": "code", "collapsed": false, "input": [ "result" ], "language": "python", "metadata": { "slideshow": { "slide_type": "slide" } }, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 19, "text": [ "1.4666666666666666" ] } ], "prompt_number": 19 }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "- \ub9cc\uc57d\uc5d0 \ud30c\uc774\uc36c \uc2a4\ud06c\ub9bd\ud2b8\uc5d0 \uba85\ub839\ud589 \uc778\uc790(sys.argv\uc5d0 \uc800\uc7a5\ub418\ub294)\ub97c \ub118\uaca8\uc918\uc57c \ud55c\ub2e4\uba74 \uba85\ub839\ud589\uc5d0\uc11c \uc2e4\ud589\ud558\ub294 \uac83\ucc98\ub7fc \ud30c\uc77c \uacbd\ub85c \ub2e4\uc74c\uc5d0 \ud544\uc694\ud55c \uc778\uc790\ub97c \ub118\uaca8\uc8fc\uba74 \ub41c\ub2e4.\n", "- \uc2e4\ud589\uc2dc\ud0a4\ub824\ub294 \uc2a4\ud06c\ub9bd\ud2b8 \ud30c\uc77c\uc5d0\uc11c IPython \ub124\uc784\uc2a4\ud398\uc774\uc2a4\uc5d0 \ubbf8\ub9ac \uc120\uc5b8\ub41c \ubcc0\uc218\uc5d0 \uc811\uadfc\ud574\uc57c \ud55c\ub2e4\uba74 %run \ub300\uc2e0 %run -i \uba85\ub839\uc744 \uc0ac\uc6a9\ud558\uc790." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "### \uc2e4\ud589 \uc911\uc778 \ucf54\ub4dc \uc911\uc9c0\ud558\uae30\n", "\n", "- Ctrl+C\ub97c \ub204\ub974\uba74 KeyboardInterrupt \uc608\uc678\ub97c \ubc1c\uc0dd\uc2dc\ucf1c \ud504\ub85c\uadf8\ub7a8\uc774 \uc911\uc9c0\ub41c\ub2e4.\n", "- \uac00\ub054 Ctrl+C\ub97c \ub20c\ub7ec\ub3c4 \uc548\ub420 \ub54c\uac00 \uc788\ub294\ub370 \uc774\ub54c\ub294 \ud30c\uc774\uc36c \ud504\ub85c\uc138\uc2a4\ub97c \uac15\uc81c \uc885\ub8cc\ud558\uc790." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1.4 \ud074\ub9bd\ubcf4\ub4dc\uc5d0 \uc788\ub294 \ucf54\ub4dc \uc2e4\ud589\ud558\uae30\n", "\n", "- \ud074\ub9bd\ubcf4\ub4dc\uc5d0 \uc788\ub294 \ub0b4\uc6a9\uc744 IPython \uc258\uc5d0 \ubd99\uc5ec\ub123\uae30 \ud560 \ub54c \uc8fc\uc758\ud560 \uc810\uc740, \uc904 \ubc14\uafc8\uc744 return\uc73c\ub85c \ucc98\ub9ac\ud55c\ub2e4. \uc774 \ub54c\ubb38\uc5d0 \ub4e4\uc5ec\uc4f0\uae30 \ub41c \ube14\ub85d \uc548\uc758 \ube48 \uc904\uc744 IPython\uc740 \ube14\ub85d\uc774 \ub05d\ub09c \uac83\uc73c\ub85c \uc778\uc2dd\ud55c\ub2e4.\n", "- \uc774\uac83\uc744 \ubc29\uc9c0\ud558\uae30 \uc704\ud574\uc11c\ub294 %paste \uba85\ub839\uc744 \uc368\uc8fc\uba74 \ub41c\ub2e4.\n", "- %paste\ub294 \ud074\ub9bd\ubcf4\ub4dc\uc5d0 \uc788\ub294 \ub0b4\uc6a9\uc744 \ubd99\uc5ec\ub123\uae30\ud558\uace0 \ubc14\ub85c \ub05d\ub0b8\ub2e4.\n", "- %cpaste\ub294 \ubd99\uc5ec\ub123\uae30 \ud560 \uc218 \uc788\ub294 \uacf5\uac04\uc744 \uc5f4\uc5b4\uc900\ub2e4\uace0 \ubcf4\uba74\ub41c\ub2e4. \uc0ac\uc6a9\uc790\uac00 --\ub97c \ud574\uc8fc\uae30 \uc804\uae4c\uc9c0 \uc785\ub825\uac12\uc744 \uc885\ub8cc\ud558\uc9c0 \uc54a\ub294\ub2e4. \uc2e4\ud589\ud574 \ubcf4\uae30 \uc804\uc5d0 \ub9c8\uc74c\uaecf \ubd99\uc5ec\ub123\uae30 \ud574\ubcfc \uc218 \uc788\ub2e4\ub294 \uac83\uc744 \ub73b\ud55c\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " x = 5\n", " y = 7\n", " if x > 5:\n", " x += 1\n", "\n", " y = 8" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " In [25]: %paste\n", " x = 5\n", " y = 7\n", " if x > 5:\n", " x += 1\n", "\n", " y = 8\n", "\n", " ## -- End pasted text --" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " In [26]: %cpaste\n", " Pasting code; enter '--' alone on the line to stop or use Ctrl-D.\n", " :x = 5\n", " :y = 7\n", " :if x > 5:\n", " : x += 1\n", " : \n", " : y = 8\n", " :\n", " :--\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### IDE, \ud3b8\uc9d1\uae30\uc640 \ud568\uaed8 IPython \uc0ac\uc6a9\ud558\uae30\n", "\n", "- \uc774\ub9e5\uc2a4\ub098 vim \uac19\uc740 \uba87\uba87 \ud3b8\uc9d1\uae30\ub294 \uc11c\ub4dc\ud30c\ud2f0 \ud655\uc7a5\uc744 \ud1b5\ud574 \uc2e4\ud589\uc911\uc778 IPython \uc73c\ub85c \ucf54\ub4dc \ube14\ub85d\uc744 \uc9c1\uc811 \ubcf4\ub0bc \uc218 \uc788\ub2e4. IPython \uc6f9\uc0ac\uc774\ud2b8\ub098 \uc778\ud130\ub137 \uac80\uc0c9\uc744 \ud1b5\ud574 \uc880 \ub354 \ub9ce\uc740 [\uc815\ubcf4](http://ipython.org/ipython-doc/rel-1.1.0/config/editors.html)\ub97c \uc5bb\uc744 \uc218 \uc788\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1.5 \ud0a4\ubcf4\ub4dc \ub2e8\ucd95\ud0a4\n", "\n", "- IPython\uc740 \uc774\ub9e5\uc2a4 \ud3b8\uc9d1\uae30\ub098 \uc720\ub2c9\uc2a4 Bash \uc0ac\uc6a9\uc790\uc5d0\uac8c \uce5c\uc219\ud55c \ud504\ub86c\ud504\ud2b8 \uc774\ub3d9 \ub2e8\ucd95\ud0a4 \uc81c\uacf5\n", "- \uc774\uc804\uc5d0 \uc785\ub825\ud55c \uc258\uc758 \uba85\ub839\uc5b4 \ud788\uc2a4\ud1a0\ub9ac \uc0ac\uc6a9 \uac00\ub2a5\n", "- \uac70\uc758 Bash \uc258\uacfc \ube44\uc2b7\ud558\ub2e4\uace0 \ubcf4\uba74 \ub41c\ub2e4. \uc774\uc804\uc5d0 \uc258 \uacf5\ubd80\ud558\uc2e0 \ubd84\ub4e4\uc740 \uac70\uc758 \ub611\uac19\uc73c\ub2c8 \uae08\ubc29 \uc775\ud790 \uc218 \uc788\ub2e4.\n", "- [GNU Readline Library 1.2.1 Readline Bare Essentials](http://cnswww.cns.cwru.edu/php/chet/readline/rluserman.html)\n", "- \ub0b4\uac00 \uc790\uc8fc \uc0ac\uc6a9\ud558\ub294 \uac83\uc740 \uc704 \ud654\uc0b4\ud45c, \uc544\ub798 \ud654\uc0b4\ud45c\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1.6 \uc608\uc678\uc640 \ud2b8\ub808\uc774\uc2a4\ubc31" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- %run \uba85\ub839\uc744 \uc0ac\uc6a9\ud558\uba74 \uc2a4\ud06c\ub9bd\ud2b8\ub098 \uc77c\ubc18 \ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \uc2e4\ud589\ud558\ub294 \uc911\uc5d0 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc744 \ub54c \uc804\uccb4 \uc2a4\ud0dd \uc815\ubcf4\ub97c \uac01 \uc704\uce58\ubcc4 \ubb38\ub9e5 \uc815\ubcf4\uc640 \ud568\uaed8 \ubcfc \uc218 \uc788\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "# %run ch03/ipython_bug.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ " ---------------------------------------------------------------------------\n", " AssertionError Traceback (most recent call last)\n", " /Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/ipython_bug.py in ()\n", " 13 throws_an_exception()\n", " 14 \n", " ---> 15 calling_things()\n", "\n", " /Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/ipython_bug.py in calling_things()\n", " 11 def calling_things():\n", " 12 works_fine()\n", " ---> 13 throws_an_exception()\n", " 14 \n", " 15 calling_things()\n", "\n", " /Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/ipython_bug.py in throws_an_exception()\n", " 7 a = 5\n", " 8 b = 6\n", " ----> 9 assert(a + b == 10)\n", " 10 \n", " 11 def calling_things():\n", "\n", " AssertionError: " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc77c\ubc18 \ud30c\uc774\uc36c \uc778\ud130\ud504\ub9ac\ud130\uc5d0\uc11c\ub294 \ucd94\uac00 \ubb38\ub9e5 \uc815\ubcf4\ub97c \uc81c\uacf5\ud558\uc9c0 \uc54a\uc9c0\ub9cc IPython\uc5d0\uc11c\ub294 \ucd94\uac00 \uc815\ubcf4 \uc81c\uacf5\n", "- %xmode \ub9e4\uc9c1 \uba85\ub839\uc5b4\ub97c \uc774\uc6a9\ud574\uc11c \ud45c\uc2dc\ub418\ub294 \ubb38\ub9e5 \uc815\ubcf4\uc758 \uc591\uc744 \uc870\uc808\ud560 \uc218 \uc788\ub294\ub370 \uc791\uac8c\ub294 \uc77c\ubc18 \ud30c\uc774\uc36c \uc778\ud130\ud504\ub9ac\ud130 \uc218\uc900\n", "- \ub9cc\ud5e5\ub294 \ud568\uc218\uc758 \uc778\uc790 \uac12\uacfc \uadf8 \uc774\uc0c1\uc758 \uc815\ubcf4\ub97c \ubcf4\uc5ec\uc8fc\ub3c4\ub85d \uc124\uc815 \uac00\ub2a5\n", "- \uc624\ub958\uac00 \ubc1c\uc0dd\ud55c \uc9c1\ud6c4 \ub300\ud654\ud615 \ub514\ubc84\uac70 \uc0ac\uc6a9\uc744 \uc704\ud574 %debug\ub098 %pdb \ub9e4\uc9c1 \uba85\ub839\uc5b4\ub97c \uc774\uc6a9\ud574\uc11c \uc2a4\ud0dd \uc548\uc744 \uc0b4\ud3b4\ubcfc \uc218\ub3c4 \uc788\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1.7 \ub9e4\uc9c1 \uba85\ub839\uc5b4\n", "\n", "- IPython\uc740 '\ub9e4\uc9c1' \uba85\ub839\uc5b4\ub77c\uace0 \ud558\ub294 \uc5ec\ub7ec \uac00\uc9c0 \ud2b9\uc218\ud55c \uba85\ub839\uc5b4\ub97c \ud3ec\ud568\ud558\uace0 \uc788\ub294\ub370, \uc774\ub294 \uc77c\ubc18\uc801\uc778 \uc791\uc5c5\uc774\ub098 IPython \uc2dc\uc2a4\ud15c \ub3d9\uc791\uc744 \uc27d\uac8c \uc81c\uc5b4\ud560 \uc218 \uc788\ub3c4\ub85d \uc124\uacc4\ub41c \ud2b9\uc218\ud55c \uba85\ub839\uc5b4\n", "- \ub9e4\uc9c1 \uba85\ub839\uc5b4\ub294 \uc55e\uc5d0 % \uae30\ud638\ub97c \ubd99\uc774\ub294 \ud615\uc2dd\n", "- \uc608\ub97c \ub4e4\uc5b4 IPython\uc5d0\uc11c \ud589\ub82c \uacf1\uc148 \uac19\uc740 \ucf54\ub4dc\uac00 \uc2e4\ud589\ub41c \uc2dc\uac04\uc744 \uce21\uc815\ud558\uace0 \uc2f6\uc744 \ub54c %timeit \ub9e4\uc9c1 \ud568\uc218\ub97c \uc774\uc6a9\ud574\uc11c \uac12\uc744 \uc5bb\uc5b4\uc62c \uc218 \uc788\ub2e4.\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "a = np.random.randn(100, 100)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 32 }, { "cell_type": "code", "collapsed": false, "input": [ "a" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 33, "text": [ "array([[-1.24795852, 1.54416008, 0.33070124, ..., 0.78562341,\n", " 0.09254828, 0.8429892 ],\n", " [-0.68266363, 0.4380124 , 1.04945737, ..., 1.71421051,\n", " -2.10686509, -0.26068562],\n", " [-1.44114179, -0.58686428, 2.04138524, ..., 0.08009878,\n", " 0.73308772, -2.6788362 ],\n", " ..., \n", " [-1.19584095, -0.04156138, -2.40651689, ..., -0.93047556,\n", " 0.74903251, -0.69777648],\n", " [ 0.52452989, 1.36099329, 0.33302706, ..., 0.88645082,\n", " 1.44052124, 1.28476217],\n", " [ 0.60878216, 1.09719752, -0.51406306, ..., -0.19358492,\n", " -0.04897423, -0.85155121]])" ] } ], "prompt_number": 33 }, { "cell_type": "code", "collapsed": false, "input": [ "%timeit np.dot(a, a)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "10000 loops, best of 3: 95.8 \u00b5s per loop\n" ] } ], "prompt_number": 34 }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### timeit\uc758 loops \ud69f\uc218\uc5d0 \ub300\ud55c \uc0dd\uac01\n", "\n", "- loops\ub294 \uac70\uc758 \ube44\uc2b7\ud55c \uc2dc\uac04\uc774 \uac78\ub9ac\ub3c4\ub85d loops \ud69f\uc218\ub97c IPython\uc5d0\uc11c \uc870\uc808\ud558\ub294 \uac83\uc73c\ub85c \ud310\ub2e8\ub41c\ub2e4.\n", "- \ucc45\uacfc \uc0c1\uc774\ud55c loops \ud69f\uc218\ub97c \ubcf4\uc774\ub294 \uacf3\uc774 \uac00\ub054 \uc788\uc73c\ub2c8 \uc774\ub7f0 \uac83\uc774 \uc788\ub2e4 \uc815\ub3c4\ub9cc \uc778\uc2dd\ud558\uace0 \ub118\uc5b4\uac00\uc790." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \ub9e4\uc9c1 \uba85\ub839\uc5b4\ub294 IPython \uc2dc\uc2a4\ud15c \uc548\uc5d0\uc11c \uc2e4\ud589\ub418\ub294 \uba85\ub839\ud589 \ud504\ub85c\uadf8\ub7a8\n", "- \ub9e4\uc9c1 \uba85\ub839\uc5b4\ub4e4\uc740 \ucd94\uac00\uc801\uc778 \uc635\uc158\uc744 \ud544\uc694\ub85c \ud558\uba70 ?\ub97c \uc774\uc6a9\ud574\uc11c \uc804\uccb4 \uc635\uc158 \ubcf4\uae30 \uac00\ub2a5" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%reset?" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 35 }, { "cell_type": "markdown", "metadata": {}, "source": [ " Type: Magic function\n", " String form: >\n", " Namespace: IPython internal\n", " File: /Library/Python/2.7/site-packages/IPython/core/magics/namespace.py\n", " Definition: %reset(self, parameter_s='')\n", " Docstring:\n", " Resets the namespace by removing all names defined by the user, if\n", " called without arguments, or by removing some types of objects, such\n", " as everything currently in IPython's In[] and Out[] containers (see\n", " the parameters for details).\n", "\n", " Parameters\n", " ----------\n", " -f : force reset without asking for confirmation.\n", "\n", " -s : 'Soft' reset: Only clears your namespace, leaving history intact.\n", " References to objects may be kept. By default (without this option),\n", " we do a 'hard' reset, giving you a new session and removing all\n", " references to objects from the current session.\n", "\n", " in : reset input history\n", "\n", " out : reset output history\n", "\n", " dhist : reset directory history\n", "\n", " array : reset only variables that are NumPy arrays\n", "\n", " See Also\n", " --------\n", " reset_selective : invoked as ``%reset_selective``\n", "\n", " Examples\n", " --------\n", " ::\n", "\n", " In [6]: a = 1\n", "\n", " In [7]: a\n", " Out[7]: 1\n", "\n", " In [8]: 'a' in _ip.user_ns\n", " Out[8]: True\n", "\n", " In [9]: %reset -f\n", "\n", " In [1]: 'a' in _ip.user_ns\n", " Out[1]: False\n", "\n", " In [2]: %reset -f in\n", " Flushing input history\n", "\n", " In [3]: %reset -f dhist in\n", " Flushing directory history\n", " Flushing input history\n", "\n", " Notes\n", " -----\n", " Calling this magic from clients that do not implement standard input,\n", " such as the ipython notebook interface, will reset the namespace\n", " without confirmation." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \ub9e4\uc9c1 \ud568\uc218\uc640 \uac19\uc740 \uc774\ub984\uc758 \ubcc0\uc218\uac00 \uc120\uc5b8\ub418\uc9c0 \uc54a\uc558\ub2e4\uba74 \uae30\ubcf8\uc801\uc73c\ub85c % \uae30\ud638 \uc5c6\uc774\ub3c4 \ub9e4\uc9c1 \ud568\uc218\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub2e4. \uc774\ub97c \uc624\ud1a0\ub9e4\uc9c1(Automagic) \uc774\ub77c\uace0 \ud558\ub294\ub370, %automatic\uc744 \uc774\uc6a9\ud574\uc11c \uc774 \uae30\ub2a5\uc744 \ucf1c\uac70\ub098 \ub04c \uc218 \uc788\ub2e4.\n", "- %quickref\ub098 %magic \uba85\ub839\uc744 \ud1b5\ud574\uc11c \uc0ac\uc6a9 \uac00\ub2a5\ud55c \ubaa8\ub4e0 \ud2b9\uc218 \uba85\ub839\uc5b4\ub97c \uc0b4\ud3b4\ubd10\ub450\ub294 \uac83\uc774 \uc88b\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### \uc790\uc8fc \uc0ac\uc6a9\ud558\ub294 IPython \ub9e4\uc9c1 \uba85\ub839\uc5b4" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%writefile ch03/data.csv\n", "Command/ Comment\n", "%quickref/ IPython\uc758 \ube60\ub978 \ub3c4\uc6c0\ub9d0 \ud45c\uc2dc\n", "%magic/ \ubaa8\ub4e0 \ub9e4\uc9c1 \ud568\uc218\uc5d0 \ub300\ud55c \uc0c1\uc138 \ub3c4\uc6c0\ub9d0 \ucd9c\ub825\n", "%debug/ \ucd5c\uadfc \uc608\uc678 \ud2b8\ub808\uc774\uc2a4\ubc31\uc758 \ud558\ub2e8\uc5d0\uc11c \ub300\ud654\ud615 \ub514\ubc84\uac70\ub85c \uc9c4\uc785\n", "%hist/ \uba85\ub839\uc5b4 \uc785\ub825(\uadf8\ub9ac\uace0 \uc120\ud0dd\uc801\uc73c\ub85c \ucd9c\ub825) \ud788\uc2a4\ud1a0\ub9ac \ucd9c\ub825\n", "%pdb/ \uc608\uc678\uac00 \ubc1c\uc0dd\ud558\uba74 \uc790\ub3d9\uc801\uc73c\ub85c \ub514\ubc84\uac70\ub85c \uc9c4\uc785\n", "%paste/ \ud074\ub9bd\ubcf4\ub4dc\uc5d0\uc11c \ub4e4\uc5ec\uc4f0\uae30\uac00 \ub41c \ucc44\ub85c \ud30c\uc774\uc36c \ucf54\ub4dc \uac00\uc838\uc624\uae30\n", "%cpaste/ \uc2e4\ud589 \ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \uc218\ub3d9\uc73c\ub85c \ubd99\uc5ec\ub123\uc744 \uc218 \uc788\ub294 \ud504\ub86c\ud504\ud2b8 \ud45c\uc2dc\n", "%reset/ \ub300\ud654\ud615 \ub124\uc784\uc2a4\ud398\uc774\uc2a4\uc5d0\uc11c \uc815\uc758\ub41c \ubaa8\ub4e0 \ubcc0\uc218\uc640 \uc774\ub984\uc744 \uc0ad\uc81c\n", "%page/ OBJECT \uac1d\uccb4\ub97c pager\ub97c \ud1b5\ud574 \ubcf4\uae30 \uc88b\uac8c \ucd9c\ub825\n", "%run script.py/ IPython \ub0b4\uc5d0\uc11c \ud30c\uc774\uc36c \uc2a4\ud06c\ub9bd\ud2b8 \uc2e4\ud589\n", "%prun statement/ cProfile\uc744 \ud1b5\ud574 statement\ub97c \uc2e4\ud589\ud558\uace0 \ud504\ub85c\ud30c\uc77c\ub9c1 \uacb0\uacfc\ub97c \ucd9c\ub825\n", "%time statement/ \ub2e8\uc77c statement \uc2e4\ud589 \uc2dc\uac04\uc744 \ucd9c\ub825\n", "%timeit statement/ statement\ub97c \uc5ec\ub7ec \ucc28\ub840 \uc2e4\ud589\ud55c \ud6c4 \ud3c9\uade0 \uc2e4\ud589 \uc2dc\uac04\uc744 \ucd9c\ub825. \n", " / \ub9e4\uc6b0 \uc9e7\uc740 \uc2dc\uac04 \uc548\uc5d0 \ub05d\ub098\ub294 \ucf54\ub4dc\uc758 \uc2dc\uac04\uc744 \uce21\uc815\ud560 \ub54c \uc720\uc6a9\n", "%who, %who_ls, %whos/ \ub300\ud654\ud615 \ub124\uc784\uc2a4\ud398\uc774\uc2a4 \ub0b4\uc5d0\uc11c \uc815\uc758\ub41c \ubcc0\uc218\ub97c \ub2e4\uc591\ud55c \ubc29\ubc95\uc73c\ub85c \ud45c\uc2dc\n", "%xdel variable/ variable\uc744 \uc0ad\uc81c\ud558\uace0 IPython \ub0b4\ubd80\uc801\uc73c\ub85c \ud574\ub2f9 \uac1d\uccb4\uc5d0 \ub300\ud55c \ubaa8\ub4e0 \ucc38\uc870\ub97c \uc81c\uac70" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Overwriting ch03/data.csv\n" ] } ], "prompt_number": 25 }, { "cell_type": "code", "collapsed": false, "input": [ "import pandas as pd" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 26 }, { "cell_type": "code", "collapsed": false, "input": [ "pd.core.format.set_printoptions(notebook_repr_html=True)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stderr", "text": [ "/Library/Python/2.7/site-packages/pandas-0.12.0_307_g3a2fe0b-py2.7-macosx-10.8-intel.egg/pandas/core/format.py:1656: FutureWarning: set_printoptions is deprecated, use set_option instead\n", " FutureWarning)\n" ] } ], "prompt_number": 27 }, { "cell_type": "code", "collapsed": false, "input": [ "df = pd.read_csv('ch03/data.csv', delimiter='/')" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 28 }, { "cell_type": "markdown", "metadata": {}, "source": [ "num | Command | Comment\n", "--- | --- | ---\n", "1 | nice | good\n", "2 | aaaa | bbb" ] }, { "cell_type": "code", "collapsed": false, "input": [ "df" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Command Comment
0 %quickref IPython\uc758 \ube60\ub978 \ub3c4\uc6c0\ub9d0 \ud45c\uc2dc
1 %magic \ubaa8\ub4e0 \ub9e4\uc9c1 \ud568\uc218\uc5d0 \ub300\ud55c \uc0c1\uc138 \ub3c4\uc6c0\ub9d0 \ucd9c\ub825
2 %debug \ucd5c\uadfc \uc608\uc678 \ud2b8\ub808\uc774\uc2a4\ubc31\uc758 \ud558\ub2e8\uc5d0\uc11c \ub300\ud654\ud615 \ub514\ubc84\uac70\ub85c \uc9c4\uc785
3 %hist \uba85\ub839\uc5b4 \uc785\ub825(\uadf8\ub9ac\uace0 \uc120\ud0dd\uc801\uc73c\ub85c \ucd9c\ub825) \ud788\uc2a4\ud1a0\ub9ac \ucd9c\ub825
4 %pdb \uc608\uc678\uac00 \ubc1c\uc0dd\ud558\uba74 \uc790\ub3d9\uc801\uc73c\ub85c \ub514\ubc84\uac70\ub85c \uc9c4\uc785
5 %paste \ud074\ub9bd\ubcf4\ub4dc\uc5d0\uc11c \ub4e4\uc5ec\uc4f0\uae30\uac00 \ub41c \ucc44\ub85c \ud30c\uc774\uc36c \ucf54\ub4dc \uac00\uc838\uc624\uae30
6 %cpaste \uc2e4\ud589 \ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \uc218\ub3d9\uc73c\ub85c \ubd99\uc5ec\ub123\uc744 \uc218 \uc788\ub294 \ud504\ub86c\ud504\ud2b8 \ud45c\uc2dc
7 %reset \ub300\ud654\ud615 \ub124\uc784\uc2a4\ud398\uc774\uc2a4\uc5d0\uc11c \uc815\uc758\ub41c \ubaa8\ub4e0 \ubcc0\uc218\uc640 \uc774\ub984\uc744 \uc0ad\uc81c
8 %page OBJECT \uac1d\uccb4\ub97c pager\ub97c \ud1b5\ud574 \ubcf4\uae30 \uc88b\uac8c \ucd9c\ub825
9 %run script.py IPython \ub0b4\uc5d0\uc11c \ud30c\uc774\uc36c \uc2a4\ud06c\ub9bd\ud2b8 \uc2e4\ud589
10 %prun statement cProfile\uc744 \ud1b5\ud574 statement\ub97c \uc2e4\ud589\ud558\uace0 \ud504\ub85c\ud30c\uc77c\ub9c1 \uacb0\uacfc\ub97c \ucd9c\ub825
11 %time statement \ub2e8\uc77c statement \uc2e4\ud589 \uc2dc\uac04\uc744 \ucd9c\ub825
12 %timeit statement statement\ub97c \uc5ec\ub7ec \ucc28\ub840 \uc2e4\ud589\ud55c \ud6c4 \ud3c9\uade0 \uc2e4\ud589 \uc2dc\uac04\uc744 \ucd9c\ub825.
13 \ub9e4\uc6b0 \uc9e7\uc740 \uc2dc\uac04 \uc548\uc5d0 \ub05d\ub098\ub294 \ucf54\ub4dc\uc758 \uc2dc\uac04\uc744 \uce21\uc815\ud560 \ub54c \uc720\uc6a9
14 %who, %who_ls, %whos \ub300\ud654\ud615 \ub124\uc784\uc2a4\ud398\uc774\uc2a4 \ub0b4\uc5d0\uc11c \uc815\uc758\ub41c \ubcc0\uc218\ub97c \ub2e4\uc591\ud55c \ubc29\ubc95\uc73c\ub85c \ud45c\uc2dc
15 %xdel variable variable\uc744 \uc0ad\uc81c\ud558\uace0 IPython \ub0b4\ubd80\uc801\uc73c\ub85c \ud574\ub2f9 \uac1d\uccb4\uc5d0 \ub300\ud55c \ubaa8\ub4e0 \ucc38\uc870\ub97c \uc81c\uac70
\n", "
" ], "metadata": {}, "output_type": "pyout", "prompt_number": 29, "text": [ " Command Comment\n", "0 %quickref IPython\uc758 \ube60\ub978 \ub3c4\uc6c0\ub9d0 \ud45c\uc2dc\n", "1 %magic \ubaa8\ub4e0 \ub9e4\uc9c1 \ud568\uc218\uc5d0 \ub300\ud55c \uc0c1\uc138 \ub3c4\uc6c0\ub9d0 \ucd9c\ub825\n", "2 %debug \ucd5c\uadfc \uc608\uc678 \ud2b8\ub808\uc774\uc2a4\ubc31\uc758 \ud558\ub2e8\uc5d0\uc11c \ub300\ud654\ud615 \ub514\ubc84\uac70\ub85c \uc9c4\uc785\n", "3 %hist \uba85\ub839\uc5b4 \uc785\ub825(\uadf8\ub9ac\uace0 \uc120\ud0dd\uc801\uc73c\ub85c \ucd9c\ub825) \ud788\uc2a4\ud1a0\ub9ac \ucd9c\ub825\n", "4 %pdb \uc608\uc678\uac00 \ubc1c\uc0dd\ud558\uba74 \uc790\ub3d9\uc801\uc73c\ub85c \ub514\ubc84\uac70\ub85c \uc9c4\uc785\n", "5 %paste \ud074\ub9bd\ubcf4\ub4dc\uc5d0\uc11c \ub4e4\uc5ec\uc4f0\uae30\uac00 \ub41c \ucc44\ub85c \ud30c\uc774\uc36c \ucf54\ub4dc \uac00\uc838\uc624\uae30\n", "6 %cpaste \uc2e4\ud589 \ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \uc218\ub3d9\uc73c\ub85c \ubd99\uc5ec\ub123\uc744 \uc218 \uc788\ub294 \ud504\ub86c\ud504\ud2b8 \ud45c\uc2dc\n", "7 %reset \ub300\ud654\ud615 \ub124\uc784\uc2a4\ud398\uc774\uc2a4\uc5d0\uc11c \uc815\uc758\ub41c \ubaa8\ub4e0 \ubcc0\uc218\uc640 \uc774\ub984\uc744 \uc0ad\uc81c\n", "8 %page OBJECT \uac1d\uccb4\ub97c pager\ub97c \ud1b5\ud574 \ubcf4\uae30 \uc88b\uac8c \ucd9c\ub825\n", "9 %run script.py IPython \ub0b4\uc5d0\uc11c \ud30c\uc774\uc36c \uc2a4\ud06c\ub9bd\ud2b8 \uc2e4\ud589\n", "10 %prun statement cProfile\uc744 \ud1b5\ud574 statement\ub97c \uc2e4\ud589\ud558\uace0 \ud504\ub85c\ud30c\uc77c\ub9c1 \uacb0\uacfc\ub97c \ucd9c\ub825\n", "11 %time statement \ub2e8\uc77c statement \uc2e4\ud589 \uc2dc\uac04\uc744 \ucd9c\ub825\n", "12 %timeit statement statement\ub97c \uc5ec\ub7ec \ucc28\ub840 \uc2e4\ud589\ud55c \ud6c4 \ud3c9\uade0 \uc2e4\ud589 \uc2dc\uac04\uc744 \ucd9c\ub825. \n", "13 \ub9e4\uc6b0 \uc9e7\uc740 \uc2dc\uac04 \uc548\uc5d0 \ub05d\ub098\ub294 \ucf54\ub4dc\uc758 \uc2dc\uac04\uc744 \uce21\uc815\ud560 \ub54c \uc720\uc6a9\n", "14 %who, %who_ls, %whos \ub300\ud654\ud615 \ub124\uc784\uc2a4\ud398\uc774\uc2a4 \ub0b4\uc5d0\uc11c \uc815\uc758\ub41c \ubcc0\uc218\ub97c \ub2e4\uc591\ud55c \ubc29\ubc95\uc73c\ub85c \ud45c\uc2dc\n", "15 %xdel variable variable\uc744 \uc0ad\uc81c\ud558\uace0 IPython \ub0b4\ubd80\uc801\uc73c\ub85c \ud574\ub2f9 \uac1d\uccb4\uc5d0 \ub300\ud55c \ubaa8\ub4e0 \ucc38\uc870\ub97c \uc81c\uac70" ] } ], "prompt_number": 29 }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1.8 Qt \uae30\ubc18\uc758 GUI \ucf58\uc194\n", "\n", "- \ud130\ub2c8\ub110 \uc804\uc6a9 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc5d0 \uadf8\ub9bc\uc744 \uc0bd\uc785\ud558\uac70\ub098 \uc5ec\ub7ec \uc904\uc744 \ud3b8\uc9d1\ud558\uac70\ub098 \ubb38\ubc95\uc744 \ub3cb\ubcf4\uc774\uac8c \ud558\ub294 \ub4f1\uc758 \ub9ac\uce58 \ud14d\uc2a4\ud2b8 \uc704\uc82f \uae30\ub2a5\uc744 \ucd94\uac00\ud558\uae30 \uc704\ud574 Qt \ud504\ub808\uc784\uc6cc\ud06c \uae30\ubc18\uc758 GUI \ucf58\uc194 \uac1c\ubc1c\n", "\n", "#### IPython\uc5d0\uc11c \uadf8\ub798\ud504 \uae30\ub2a5 \ub0b4\uc7a5\ud558\uc5ec \uc2e4\ud589 \ubc29\ubc95\n", "\n", "- \uc804\uc81c \uc870\uac74: PyQt\ub098 PySide\uac00 \uc124\uce58\ub418\uc5b4 \uc788\uc5b4\uc57c \ud55c\ub2e4.\n", "> $ ipython qtconsole --pyalb=inline\n", "\n", "- Qt \ucf58\uc194\uc5d0\uc11c\ub294 \uc5ec\ub7ec \uac1c\uc758 IPython \ud504\ub85c\uc138\uc2a4\ub97c \ud0ed\uc73c\ub85c \uad6c\ubd84\ud574\uc11c \uc2e4\ud589\n", "- IPython HTML \ub178\ud2b8\ubd81 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uacfc\ub3c4 \ud568\uaed8 \uc0ac\uc6a9(\ud604\uc7ac \uc774 \ubb38\uc11c\ub97c \uc791\uc131\ud55c \uac83)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.1.9 Pylab \ubaa8\ub4dc\uc640 Matplotlib \ud1b5\ud569\n", "\n", "- IPython\uc774 \uacfc\ud559\uacc4\uc0b0 \ucef4\ud4e8\ud305 \uc601\uc5ed\uc5d0\uc11c \ub110\ub9ac \uc0ac\uc6a9\ub418\uace0 \uc788\ub294 \uc774\uc720: matplotlib \ubc0f \ub2e4\ub978 GUI \ud234\ud0b7 \uac19\uc740 \ub77c\uc774\ube0c\ub7ec\ub9ac\uc640 \ud568\uaed8 \uc0ac\uc6a9\ud558\uae30 \uc27d\ub2e4\ub294 \uc810\n", "- \uc77c\ubc18 \ud30c\uc774\uc36c\uc5d0\uc11c matplotlib\uc744 \uc774\uc6a9\ud574\uc11c \uadf8\ub798\ud504 \uc708\ub3c4\uc6b0\ub97c \ub9cc\ub4e0\ub2e4\uba74 GUI \uc774\ubca4\ud2b8 \ub8e8\ud504\uac00 \uadf8\ub798\ud504 \uc708\ub3c4\uc6b0\uac00 \ub2eb\ud790 \ub54c\uae4c\uc9c0 \ud30c\uc774\uc36c \uc138\uc158\uc758 \uc81c\uc5b4\uad8c\uc744 \uac00\ub85c\ucc48\ub2e4. But Ipython\uc740 \uac01\uac01\uc758 GUI \ud504\ub808\uc784\uc6cc\ud06c\ub97c \uc798 \uc774\uc6a9\ud574\uc11c \ub0b4\ubd80\uc5d0\uc11c\ub3c4 \uba48\ucd94\uc9c0 \uc54a\uace0 \uc791\uc5c5\uc744 \uacc4\uc18d\ud560 \uc218 \uc788\ub3c4\ub85d \uad6c\ud604\n", "\n", "#### IPython\uc744 matplotlib\uc640 \ud568\uaed8 \uc0ac\uc6a9\ud558\ub824\uba74 --pylab \uc635\uc158 \uc124\uc815\ud558\uace0 \uc2e4\ud589\n", "\n", ">$ ipython --pylab\n", "\n", "- \uc774\ub807\uac8c \uc2e4\ud589\ud558\uba74 IPython\uc740 \uae30\ubcf8 GUI \ubc31\uc5d4\ub4dc\uc640 \ud1b5\ud569\ub418\uc5b4 matplotlib \uadf8\ub798\ud504 \uc708\ub3c4\uc6b0\uac00 \ubb38\uc81c\uc5c6\uc774 \uc2e4\ud589\n", "- %gui \uba85\ub839\uc744 \uc774\uc6a9\ud574 \ub300\ud654\ud615 \ucef4\ud4e8\ud305 \ud658\uacbd \uc124\uc815 \uac00\ub2a5" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3.2 \uba85\ub839\uc5b4 \ud788\uc2a4\ud1a0\ub9ac \uc0ac\uc6a9\ud558\uae30\n", "\n", "- \uac80\uc0c9, \uc790\ub3d9 \uc644\uc131, \ucd5c\uc18c\ud55c\uc758 \uc785\ub825\uc73c\ub85c \uc774\uc804\uc5d0 \uc2e4\ud589\ud588\ub358 \uba85\ub839 \uc7ac\uc2e4\ud589\n", "- \uc138\uc158 \uac04\uc758 \uba85\ub839\uc5b4 \ud788\uc2a4\ud1a0\ub9ac \uc720\uc9c0\n", "- \uc785\u2219\ucd9c\ub825 \ud788\uc2a4\ud1a0\ub9ac\ub97c \ud30c\uc77c\uc5d0 \uae30\ub85d" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2.1 \uba85\ub839\uc5b4 \uac80\uc0c9\uacfc \uc7ac\uc0ac\uc6a9\n", "\n", "#### \uba85\ub839\uc5b4 \uc790\uc8fc \uc0ac\uc6a9\n", "> %run first/second/third/data_script.py\n", "\n", "- \uc704 \ud654\uc0b4\ud45c \ud0a4\ub098, Ctrl + P\ub97c \ub204\ub974\uba74 \uc774\uc804\uc5d0 \uc2e4\ud589\ud588\ub358 \uba85\ub839\uc5b4 \uc2e4\ud589(\uacc4\uc18d \ub20c\ub7ec\ubcf4\uba74\uc11c \uc775\uc219\ud574\uc9c0\uae30)\n", "- \uc544\ub798 \ud654\uc0b4\ud45c \ud0a4\ub098 Ctrl + B\ub97c \ub204\ub974\uba74 \ubaa9\ub85d\uc744 \uac70\uafb8\ub85c \ubcf4\uc5ec\uc8fc\uba70 \ucd5c\uc2e0\uc758 \uc2e4\ud589 \uacb0\uacfc\ub97c \ubcf4\uc5ec\uc90c. \uc989, \uc704 \ud654\uc0b4\ud45c \ud0a4 \ubc18\ub300 \uae30\ub2a5\n", "\n", "#### Ctrl+R\uc744 \ub204\ub974\uba74 \ubd80\ubd84 \uc21c\ucc28 \uac80\uc0c9 \uc0ac\uc6a9" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2.2 \uc785\u2219\ucd9c\ub825 \ubcc0\uc218\n", "\n", "- \ud568\uc218\uc758 \uc2e4\ud589 \uacb0\uacfc\ub97c \ubcc0\uc218\uc5d0 \uc800\uc7a5\ud558\uc9c0 \ubabb\ud558\uba74 \ub9e4\uc6b0 \ubd88\ud3b8\n", "- \uc785\ub825\ud55c \ub0b4\uc6a9\uacfc \ucd9c\ub825\ub41c \uacb0\uacfc\ubb3c(\ubc18\ud658\ub41c \uac1d\uccb4) \ub458 \ub2e4 \ud2b9\uc218\ud55c \ubcc0\uc218\uc5d0 \uc800\uc7a5\n", "- \ub9c8\uc9c0\ub9c9 2\uac1c\uc758 \uacb0\uacfc\ub97c \uc800\uc7a5\ud558\ub294 \ubc14\ub85c \uc774\uc804 \uacb0\uacfc\ub294 **_** \ubcc0\uc218\uc5d0, \uadf8 \uc774\uc804 \uacb0\uacfc\ub294 **__** \ubcc0\uc218\uc5d0 \uc800\uc7a5\ud55c\ub2e4.\n", "\n", "#### _ \ubcc0\uc218 \uc0ac\uc6a9\uc2dc \uc8fc\uc758\uc0ac\ud56d\n", "\n", "- \ubc14\ub85c \uc774\uc804 \uacb0\uacfc\ub97c \uc800\uc7a5\ud558\uae30 \ub54c\ubb38\uc5d0 IPython\uc758 \uba85\ub839\uc5b4 \uc2e4\ud589\ub41c \ubc88\ud638\uac00 \ub9e4\uc6b0 \uc911\uc694\ud558\ub2e4.\n", "- \ud604\uc7ac In [117] \uc5d0\uc11c _ \uba85\ub839\uc5b4\ub97c \uc785\ub825\ud588\ub2e4\uba74 In [116] \uacb0\uacfc\uac12\uc774 \uc800\uc7a5\ub41c \uac83\uc774\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "2 ** 27" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 30, "text": [ "134217728" ] } ], "prompt_number": 30 }, { "cell_type": "code", "collapsed": false, "input": [ "_" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 31, "text": [ "134217728" ] } ], "prompt_number": 31 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc785\ub825 \ubcc0\uc218: _iX(X\ub294 \uc785\ub825 \uc904 \ubc88\ud638) \ubcc0\uc218\uc5d0 \uc800\uc7a5\n", "- \ucd9c\ub825 \ubcc0\uc218: _X\n", "- \uadf8\ub798\uc11c 119\ubc88 \uc904\uc744 \uc785\ub825\ud55c \ud6c4\uc5d0\ub294 \ucd9c\ub825 \uacb0\uacfc\ub97c \uc800\uc7a5\ud558\ub294 _119 \ubcc0\uc218\uc640 \uc785\ub825\ubcc0\uc218\uc778 _i119\uc774 \uc0dd\uaca8\ub09c\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "foo = 'bar'" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 32 }, { "cell_type": "code", "collapsed": false, "input": [ "foo" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 33, "text": [ "'bar'" ] } ], "prompt_number": 33 }, { "cell_type": "code", "collapsed": false, "input": [ "# _i119" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "# _119" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "# \uac12\uc744 \uc124\uc815\n", "# _i118" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [ "# Failed! 118\ubc88 \uba85\ub839\uc904\uc5d0 \ucd9c\ub825\uac12\uc774 \uc5c6\uae30 \ub54c\ubb38\n", "# _118" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 8 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc785\ub825 \ubcc0\uc218\ub294 \ubb38\uc790\uc5f4\uc774\uae30 \ub54c\ubb38\uc5d0 \ub2e4\uc74c\ucc98\ub7fc \ud30c\uc774\uc36c\uc758 exec \uc608\uc57d\uc5b4\ub97c \uc0ac\uc6a9\ud574\uc11c \ub2e4\uc2dc \uc2e4\ud589\n", "> exec _119" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# exec _i119" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 9 }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### \ub9e4\uc9c1 \ud568\uc218\ub97c \uc0ac\uc6a9\ud55c \uc785\u2219\ucd9c\ub825 \ud788\uc2a4\ud1a0\ub9ac\ub97c \uc0ac\uc6a9\ud55c \uc791\uc5c5" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%hist" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "%reset" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "%xdel result" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "result" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 35, "text": [ "1.4666666666666666" ] } ], "prompt_number": 35 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \ub9e4\uc6b0 \ud070 \ub370\uc774\ud130\ub97c \uc774\uc6a9\ud558\ub294 \uc791\uc5c5\uc744 \ud560 \ub54c\ub294 del \uc608\uc57d\uc5b4\ub97c \uc0ac\uc6a9\ud574\uc11c \uc778\ud130\ub799\ud2f0\ube0c \ub124\uc784\uc2a4\ud398\uc774\uc2a4\uc5d0\uc11c \uc5b4\ub5a4 \ubcc0\uc218\ub97c \uc9c0\uc6e0\ub2e4\uace0 \ud574\ub3c4 IPython\uc758 \uc785\u2219\ucd9c\ub825 \ud788\uc2a4\ud1a0\ub9ac\uac00 \uac00\ube44\uc9c0 \ucf5c\ub809\ud2b8(\uba54\ubaa8\ub9ac \uc815\ub9ac)\ub97c \ubc29\ud574\ud560 \uc218 \uc788\ub2e4\ub294 \uc810\uc744 \uae30\uc5b5\n", "- \uadf8\ub7f0 \uacbd\uc6b0\uc5d0\ub294 %xdel\uacfc %reset\uc744 \uc2e0\uc911\ud558\uac8c \uc0ac\uc6a9\ud574\uc11c \uba54\ubaa8\ub9ac \ubb38\uc81c \ud68c\ud53c" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2.3 \uc785\u2219\ucd9c\ub825 \uae30\ub85d\ud558\uae30\n", "\n", "- \uc785\u2219\ucd9c\ub825\uc744 \ud3ec\ud568\ud55c \uc804\uccb4 \ucf58\uc194 \uc138\uc158\uc758 \ub85c\uadf8\ub97c %logstart\ub97c \uc0ac\uc6a9\ud574\uc11c \uae30\ub85d\ud560 \uc218 \uc788\ub2e4.\n", "- \ub85c\uae45\uc740 \uc544\ubb34 \ub54c\ub098 \ud65c\uc131\ud654 \uc2dc\ud0ac \uc218 \uc788\uc73c\uba70 \uacfc\uac70 \uba85\ub839\uc744 \ud3ec\ud568\ud55c \uc804\uccb4 \uc138\uc158\uc744 \uae30\ub85d\n", "- \ub530\ub77c\uc11c \ubb54\uac00 \uc791\uc5c5\uc744 \ud558\uace0 \uc788\ub2e4\uac00 \uadf8\ub54c\uae4c\uc9c0 \uc791\uc5c5\ud55c \ubaa8\ub4e0 \ub0b4\uc6a9\uc744 \uc800\uc7a5\ud558\uace0 \uc2f6\ub2e4\uba74 \ub85c\uae45\uc744 \ud65c\uc131\ud654 \ud558\uba74 \ub41c\ub2e4.\n", "- %logoff\n", "- %logon\n", "- %logstate\n", "- logstop" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%logstart" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Activating auto-logging. Current session state plus future input saved.\n", "Filename : ipython_log.py\n", "Mode : rotate\n", "Output logging : False\n", "Raw input log : False\n", "Timestamping : False\n", "State : active\n" ] } ], "prompt_number": 36 }, { "cell_type": "code", "collapsed": false, "input": [ "%logstop" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 37 }, { "cell_type": "code", "collapsed": false, "input": [ "%logstart?" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 38 }, { "cell_type": "markdown", "metadata": {}, "source": [ " Type: Magic function\n", " String form: >\n", " Namespace: IPython internal\n", " File: /Library/Python/2.7/site-packages/IPython/core/magics/logging.py\n", " Definition: %logstart(self, parameter_s='')\n", " Docstring:\n", " Start logging anywhere in a session.\n", "\n", " %logstart [-o|-r|-t] [log_name [log_mode]]\n", "\n", " If no name is given, it defaults to a file named 'ipython_log.py' in your\n", " current directory, in 'rotate' mode (see below).\n", "\n", " '%logstart name' saves to file 'name' in 'backup' mode. It saves your\n", " history up to that point and then continues logging.\n", "\n", " %logstart takes a second optional parameter: logging mode. This can be one\n", " of (note that the modes are given unquoted):\n", "\n", " append\n", " Keep logging at the end of any existing file.\n", "\n", " backup\n", " Rename any existing file to name~ and start name.\n", "\n", " global\n", " Append to a single logfile in your home directory.\n", "\n", " over\n", " Overwrite any existing log.\n", "\n", " rotate\n", " Create rotating logs: name.1~, name.2~, etc.\n", "\n", " Options:\n", "\n", " -o\n", " log also IPython's output. In this mode, all commands which\n", " generate an Out[NN] prompt are recorded to the logfile, right after\n", " their corresponding input line. The output lines are always\n", " prepended with a '#[Out]# ' marker, so that the log remains valid\n", " Python code.\n", "\n", " Since this marker is always the same, filtering only the output from\n", " a log is very easy, using for example a simple awk call::\n", "\n", " awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py\n", "\n", " -r\n", " log 'raw' input. Normally, IPython's logs contain the processed\n", " input, so that user lines are logged in their final form, converted\n", " into valid Python. For example, %Exit is logged as\n", " _ip.magic(\"Exit\"). If the -r flag is given, all input is logged\n", " exactly as typed, with no transformations applied.\n", "\n", " -t\n", " put timestamps before each input line logged (these are put in\n", " comments)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3.3 \uc6b4\uc601\uccb4\uc81c\uc640 \ud568\uaed8 \uc0ac\uc6a9\ud558\uae30\n", "\n", "- \ub610 \ub2e4\ub978 \uc911\uc694\ud55c \uae30\ub2a5: \uc6b4\uc601\uccb4\uc81c \uc258\uacfc \uac15\ub825\ud558\uac8c \ud1b5\ud569\n", "- IPython\uc744 \uc885\ub8cc\ud558\uc9c0 \uc54a\uace0 \uc708\ub3c4\uc6b0\ub098 \uc720\ub2c9\uc2a4 \uc258\uc774 \uc77c\ubc18\uc801\uc778 \uba85\ub839\ud589\uc5d0\uc11c \ud560 \uc218 \uc788\ub294 \uc791\uc5c5\uc774 \uac00\ub2a5\ud558\ub2e4\ub294 \ub73b(vi\uc640 \ube44\uc2b7)\n", "- \uc258 \uba85\ub839\uc5b4\ub97c \uc2e4\ud589\ud558\uac70\ub098 \ub514\ub809\ud1a0\ub9ac\ub97c \uc62e\uae30\uac70\ub098 \uba85\ub839\uc5b4\uc758 \uacb0\uacfc\ub97c \ud30c\uc774\uc36c \uac1d\uccb4(\ub9ac\uc2a4\ud2b8\ub098 \ubb38\uc790\uc5f4)\uc5d0 \uc800\uc7a5\ud558\ub294 \uae30\ub2a5\uc774 \ud3ec\ud568\n", "- \ub610\ud55c \uac04\ub2e8\ud55c \uc258 \uba85\ub839\uc5b4 \uc568\ub9ac\uc5b4\uc2f1\uacfc \ub514\ub809\ud1a0\ub9ac \ubd81\ub9c8\ud06c \uae30\ub2a5\uc774 \uc81c\uacf5\n", "\n", "#### [IPython reference Command-line usage](http://ipython.org/ipython-doc/dev/interactive/reference.html#system-shell-access)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.3.1 \uc258 \uba85\ub839\uc5b4\uc640 \ubcc4\uce6d\n", "\n", "- !\ub85c \uc2dc\uc791\ud558\ub294 \uc904\uc740 \ub290\ub08c\ud45c \ub2e4\uc74c\uc5d0 \uc788\ub294 \ub0b4\uc6a9\uc744 \uc2dc\uc2a4\ud15c \uc258\uc5d0\uc11c \uc2e4\ud589\ud558\ub77c\ub294 \uc758\ubbf8\n", "- rm\uc774\ub098 del \uba85\ub839\uc5b4\ub97c \uc0ac\uc6a9\ud574\uc11c \ud30c\uc77c\uc744 \uc9c0\uc6b0\uac70\ub098 \ub514\ub809\ud1a0\ub9ac\ub97c \uc62e\uae30\uac70\ub098 \ub2e4\ub978 \ud504\ub85c\uc138\uc2a4\ub97c \uc2e4\ud589\ud560 \uc218 \uc788\ub2e4\ub294 \ub9d0\n", "- \uc2ec\uc9c0\uc5b4 \ub2e4\ub978 \ud30c\uc774\uc36c \uc778\ud130\ud504\ub9ac\ud130\uc640 \uac19\uc740 IPython\uc758 \uc81c\uc5b4\uad8c\uc744 \ube7c\uc557\uc544\uac00\ub294 \ud504\ub85c\uc138\uc2a4\ub3c4 \uc2e4\ud589 \uac00\ub2a5" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# \uc0ac\uc6a9\uc790\ub9c8\ub2e4 \ud658\uacbd\uc774 \ub2e4\ub97c \uc218 \uc788\uc73c\ub2c8 \uc774 \uba85\ub839\uc5b4\uac00 \uc81c\ub300\ub85c \ub3d9\uc791\ud558\uc9c0 \uc54a\uc744 \uc218 \uc788\uc74c\n", "ip_info = !ifconfig en0 | grep 'inet'" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 39 }, { "cell_type": "code", "collapsed": false, "input": [ "ip_info[1].strip()" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 40, "text": [ "'inet 192.168.10.31 netmask 0xffffff00 broadcast 192.168.10.255'" ] } ], "prompt_number": 40 }, { "cell_type": "code", "collapsed": false, "input": [ "# \uc815\uaddc\ud45c\ud604\uc2dd\uc744 \uc0ac\uc6a9\ud55c ip \uc8fc\uc18c\ub9cc \ucd94\ucd9c \uc608\uc81c\n", "# \uadf8\ub0e5 \uc774\ub807\uac8c\ub3c4 \ud560 \uc218\ub3c4 \uc788\ub2e4\ub294 \uac83\ub9cc \uc54c\uc544\ub450\uc138\uc694.\n", "# \ub108\ubb34 \uae4a\uc774 \ub4e4\uc5b4\uac00\uba74 \uba38\ub9ac \uc544\ud515\ub2c8\ub2e4.\n", "\n", "import re\n", "ip = re.search('inet (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})', ip_info[1].strip())\n", "print ip.group(1)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "192.168.10.31\n" ] } ], "prompt_number": 41 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- !\ub97c \uc0ac\uc6a9\ud574\uc11c \ud604\uc7ac \ud658\uacbd\uc5d0 \uc815\uc758\ub418\uc5b4 \uc788\ub294 \ud30c\uc774\uc36c \uac12\uc744 \ub300\uccb4\ud558\uae30\ub3c4 \ud55c\ub2e4.\n", "- \ubcc0\uc218 \uc774\ub984 \uc55e\uc5d0 \ub2ec\ub7ec \uae30\ud638 $\ub97c \ubd99\uc774\uba74 \ub41c\ub2e4.\n", "- \uc880 \uc5b4\ub835\uac8c \uc124\uba85\ub418\uc5b4 \uc788\ub294\ub370 \uc27d\uac8c \uc608\ub97c \ub4e4\uc5b4\uc11c foo\ub77c\ub294 \ubcc0\uc218\ub97c IPython\uc5d0\uc11c \uc815\uc758\ud558\uace0 !\ub97c \uc0ac\uc6a9\ud574 \uc258 \uba85\ub839\uc5b4\ub97c \uc0ac\uc6a9\ud560 \ub54c \ud30c\ub77c\ubbf8\ud130 \uac12\uc73c\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub2e4\ub294 \ub9d0\uc774\ub2e4. \uc74c..? \ub0b4\uac00 \ub354 \uc5b4\ub835\uac8c \uc124\uba85\ud588\ub098? \uadf8\ub798\ub3c4 \uc608\uc81c\ub97c \ubcf4\uba74 \uc774\ud574\ud558\ub9ac\ub77c \uc0dd\uac01\ud55c\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "foo = 'test*'" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 42 }, { "cell_type": "code", "collapsed": false, "input": [ "!ls $foo" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "ls: test*: No such file or directory\r\n" ] } ], "prompt_number": 43 }, { "cell_type": "code", "collapsed": false, "input": [ "# \uc704\uc758 \uba85\ub839\uc5b4\uc640 \ub611\uac19\uc740\ub370 foo\ub77c\ub294 \ubcc0\uc218\ub97c \uc0ac\uc6a9\ud588\ub290\ub0d0? \uc544\ub2c8\ub0d0? \uc758 \ucc28\uc774\ub2e4.\n", "# \ubcc0\uc218\ub97c \uc0ac\uc6a9\ud558\uba74 \ub098\uc911\uc5d0 \ub611\uac19\uc740 \uc791\uc5c5\uc744 \ud558\uc9c0 \uc54a\uc744 \uc218 \uc788\uc73c\ub2c8 \uc7ac\ud65c\uc6a9\uc131 \uce21\uba74\uc5d0\uc11c \ub9e4\uc6b0 \uc88b\ub2e4.\n", "# \ud558\ub4dc \ucf54\ub529\uc740 \ub098\uc911\uc5d0 \uc218\uc815\ud558\uae30\uac00 \ub9e4\uc6b0 \uc5b4\ub824\uc6b0\ub2c8 \ubcc0\uc218 \uc4f0\ub294 \uc2b5\uad00\uc744 \ub4e4\uc774\uc790.\n", "!ls test*" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "ls: test*: No such file or directory\r\n" ] } ], "prompt_number": 44 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- %alias: \uc258 \uba85\ub839\uc5b4\uc5d0 \ub300\ud55c \uc0ac\uc6a9\uc790 \ub2e8\ucd95\ud0a4(\ubcc4\uce6d)\uc744 \uc815\uc758" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# ll: ls -l\ub85c \uc815\uc758\ud558\uaca0\ub2e4.\n", "# ls\uac00 \ubb34\uc5c7\uc778\uac00? \ud574\ub2f9 \ub514\ub809\ud1a0\ub9ac\uc5d0 \uc5b4\ub5a4 \ud30c\uc77c\ub4e4\uacfc \ub514\ub809\ud1a0\ub9ac\ub4e4\uc774 \uc788\ub294\uc9c0 \ud655\uc778\ud558\ub294 \uc258 \uba85\ub839\uc5b4\n", "# \uc774\ub807\uac8c \ub2e8\ucd95\ud0a4\ub97c \uc0ac\uc6a9\ud558\uba74 ls -l \uc785\ub825\ud560 \uac83\uc744 ll\ub9cc \uc785\ub825\ud558\uba74 \ub418\uae30 \ub54c\ubb38\uc5d0 \uc2dc\uac04 \uc808\uc57d\n", "%alias ll ls -l" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 45 }, { "cell_type": "code", "collapsed": false, "input": [ "ll /usr" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "total 8\r\n", "lrwxr-xr-x 1 root wheel 8 Jul 24 2013 \u001b[1m\u001b[35mX11R6\u001b[m\u001b[m -> /opt/X11\r\n", "drwxr-xr-x 1067 root wheel 36278 Feb 26 05:50 \u001b[1m\u001b[34mbin\u001b[m\u001b[m\r\n", "drwxr-xr-x 281 root wheel 9554 Dec 20 11:53 \u001b[1m\u001b[34minclude\u001b[m\u001b[m\r\n", "drwxr-xr-x 323 root wheel 10982 Dec 20 11:53 \u001b[1m\u001b[34mlib\u001b[m\u001b[m\r\n", "drwxr-xr-x 147 root wheel 4998 Dec 24 20:43 \u001b[1m\u001b[34mlibexec\u001b[m\u001b[m\r\n", "drwxr-xr-x 3 root wheel 102 Dec 20 11:51 \u001b[1m\u001b[34mllvm-gcc-4.2\u001b[m\u001b[m\r\n", "drwxrwxr-x 19 root admin 646 Jan 9 14:29 \u001b[1m\u001b[34mlocal\u001b[m\u001b[m\r\n", "drwxr-xr-x 267 root wheel 9078 Dec 20 11:51 \u001b[1m\u001b[34msbin\u001b[m\u001b[m\r\n", "drwxr-xr-x 54 root wheel 1836 Dec 22 05:39 \u001b[1m\u001b[34mshare\u001b[m\u001b[m\r\n", "drwxr-xr-x 4 root wheel 136 Jul 23 2013 \u001b[1m\u001b[34mstandalone\u001b[m\u001b[m\r\n" ] } ], "prompt_number": 46 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc258\uacfc \ub611\uac19\uc774 \uc0ac\uc6a9\ud560 \uc218 \uc788\uc73c\ub2c8 ;\uc73c\ub85c \uad6c\ubd84\ud558\uc5ec \ud55c \ubc88\uc5d0 \uc2e4\ud589\ud560 \uc218\ub3c4 \uc788\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%alias test_alias (cd /tmp; ls;)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 47 }, { "cell_type": "code", "collapsed": false, "input": [ "test_alias" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\u001b[30m\u001b[42mVMwareDnD\u001b[m\u001b[m \u001b[1m\u001b[34mlaunch-BK2w6d\u001b[m\u001b[m \u001b[1m\u001b[34mlaunch-dDPynA\u001b[m\u001b[m \u001b[1m\u001b[34mlaunchd-336.7UVzxV\u001b[m\u001b[m\r\n", "\u001b[1m\u001b[34mlaunch-8m9D1N\u001b[m\u001b[m \u001b[1m\u001b[34mlaunch-EZ4J4M\u001b[m\u001b[m \u001b[1m\u001b[34mlaunch-z9jhMT\u001b[m\u001b[m \u001b[1m\u001b[32mmysql.sock\u001b[m\u001b[m\r\n" ] } ], "prompt_number": 48 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc138\uc158\uc774 \uc885\ub8cc\ub428\uacfc \ub3d9\uc2dc\uc5d0 \uc815\uc758\ud574\ub193\uc740 \ubcc4\uce6d\uc774 \uc5c6\uc5b4\uc9d0. \ud718\ubc1c\uc131\n", "- \uace0\uc815 \ubcc4\uce6d\uc744 \ub9cc\ub4e4\uace0 \uc2f6\ub2e4\uba74 \uc124\uc815 \uc2dc\uc2a4\ud15c \uc0ac\uc6a9" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.3.2 \ub514\ub809\ud1a0\ub9ac \ubd81\ub9c8\ud06c \uc2dc\uc2a4\ud15c\n", "\n", "- \ube0c\ub77c\uc6b0\uc800\uc758 \uc990\uaca8\ucc3e\uae30\uc640 \ub611\uac19\ub2e4\uace0 \uc0dd\uac01\ud558\uba74 \ub41c\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "# %bookmark db /Users/re4lfl0w/Dropbox/" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 49 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \ubd81\ub9c8\ud06c\ub97c \ud574\ub450\uace0 \ub098\uba74 %cd \ub9e4\uc9c1\uc744 \uc774\uc6a9\ud560 \ub54c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc55e\uc758 %\uac00 \uc0dd\ub7b5\ub418\uc5b4\ub3c4 \uc624\ud1a0\ub9e4\uc9c1\uc73c\ub85c \uc778\ud558\uc5ec \uc258 \uba85\ub839\uc5b4\uac00 \uc2e4\ud589\ub420 \uc218 \uc788\ub2e4\uace0 \uc55e\uc5d0 \uc5b8\uae09\ud558\uc600\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "pwd" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 50, "text": [ "u'/Users/re4lfl0w/Documents/ipython/python_data_analysis'" ] } ], "prompt_number": 50 }, { "cell_type": "code", "collapsed": false, "input": [ "# cd db" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 51 }, { "cell_type": "code", "collapsed": false, "input": [ "pwd" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 52, "text": [ "u'/Users/re4lfl0w/Documents/ipython/python_data_analysis'" ] } ], "prompt_number": 52 }, { "cell_type": "code", "collapsed": false, "input": [ "%bookmark -l" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Current bookmarks:\n", "cp -> ~/downloads/_tmp/ppt\n", "db -> /Users/re4lfl0w/Dropbox/\n" ] } ], "prompt_number": 53 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \ubcc4\uce6d\uacfc \ub2ec\ub9ac \ubd81\ub9c8\ud06c\ub294 IPython\uc774 \uc885\ub8cc\ub418\ub354\ub77c\ub3c4 \uc720\uc9c0\ub41c\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3.4 \uc18c\ud504\ud2b8\uc6e8\uc5b4 \uac1c\ubc1c \ub3c4\uad6c\n", "\n", "- \ub370\uc774\ud130 \ubd84\uc11d \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc5d0\uc11c\ub294 \uc62c\ubc14\ub978 \ucf54\ub4dc\uac00 \uac00\uc7a5 \uc911\uc694\n", "- IPython\uc740 \ud5a5\uc0c1\ub41c \ud30c\uc774\uc36c pdb \ub514\ubc84\uac70\ub97c \ub0b4\uc7a5\n", "- \ucf54\ub4dc \uc2e4\ud589\uc774 \ube68\ub77c\uc57c \ud558\ub294\ub370 IPython\uc740 \uc27d\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc787\ub294 \ucf54\ub4dc \ud0c0\uc774\ubc0d\uacfc \ud504\ub85c\ud30c\uc77c\ub9c1 \ub3c4\uad6c\ub97c \ud3ec\ud568\n", "\n", "#### \ub514\ubc84\uac70 \ub0b4\uc6a9\uc740 \uc5b4\ub835\uae30 \ub54c\ubb38\uc5d0 \ucd08\ubcf4\uc790\ub4e4\uc740 skip \ud574\ub3c4 \ubb34\ubc29\ud558\ub9ac\ub77c \ubcf8\ub2e4. \n", "\n", "- \ub098\uc911\uc5d0 \uc911\u2219\uace0\uc218\uac00 \ub418\uc5c8\uc744 \ub54c \ub2e4\uc2dc \ud55c \ubc88 \uc0b4\ud3b4\ubcf4\ub77c.\n", "- \uc5b4\ucc0c\ub410\ub4e0 \ub0b4\uac00 \ud568\uc218\ub97c \ub9cc\ub4e4\uba74 \ubc84\uadf8\uac00 \uc5c6\uac8c \ub9cc\ub4e4\ub824\uba74 \ub514\ubc84\uae45 \uacfc\uc815\uc740 \ud544\uc218\ub2c8..\n", "- \uc9c0\uae08\uc740 \ub530\ub77c\ud558\ub294 \uc218\uc900\uc774\uae30 \ub54c\ubb38\uc5d0 \uad73\uc774 \uc5b4\ub824\uc6b4 \uac78 \ubc30\uc6b0\ub290\ub77c \uc7ac\ubbf8\ub97c \ud3ec\uae30\ud560 \ud544\uc694\ub294 \uc5c6\ub2e4\ub294\uac8c \uac1c\uc778\uc801\uc778\n", "\n", "#### \ud604\uc7ac \uc774 ipynb \ud30c\uc77c\uc744 \ub2e4\uc6b4\ubc1b\uc544 \uc2e4\ud589\ud574 \ubcfc \ub54c debugger\uac00 \uc2e4\ud589\ub418\uae30 \ub54c\ubb38\uc5d0 \uba85\ub839\uc5b4\uac00 \uc785\ub825\ub418\uc9c0 \uc54a\ub294 \uc0c1\ud669\uc774 \ubc1c\uc0dd\ud558\ub2c8 \uc8fc\uc758. quit\ub85c \ube60\uc838 \ub098\uc624\uba74 \ub41c\ub2e4.\n", "\n", "### \ud30c\uc774\uc36c \ub514\ubc84\uae45 \ucc38\uace0 \uc790\ub8cc\n", "\n", "1. [\ud30c\uc774\uc36c \uc0c1\ud638\ub300\ud654 \ub514\ubc84\uae45](http://www.hanbit.co.kr/network/view.html?bi_id=1298)\n", "1. [\ud30c\uc774\uc36c \ub514\ubc84\uae45](http://coreapython.hosting.paran.com/etc/Debugging%20in%20Python.htm)\n", "1. [Getting started with the Python Debugger pdb](http://stackoverflow.com/questions/4228637/getting-started-with-the-python-debugger-pdb)\n", "1. [pdb - Interactive Debugger](http://pymotw.com/2/pdb/)\n", "\n", "#### Video\n", "\n", "1. [Youtube search word: \"python debugger\"](http://www.youtube.com/results?page=&utm_source=opensearch&high_definition=1&search_query=python+debugger)\n", "1. [Introduction to PDB](http://www.youtube.com/watch?v=vfPtGsSJldg)\n", "1. [Fundementals of Python Debugging](http://www.youtube.com/watch?v=7KLWszUrVn0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.4.1 \uc778\ud130\ub799\ud2f0\ube0c \ub514\ubc84\uac70\n", "\n", "- IPython\uc758 \ub514\ubc84\uac70\ub294 pdb\uc5d0 \ud0ed \uc790\ub3d9 \uc644\uc131 \uae30\ub2a5\uacfc \ubb38\ubc95 \uac15\uc870, \uc608\uc678 \ud2b8\ub808\uc774\uc2a4\ubc31\uc5d0\uc11c \uac01 \uc904\uc5d0 \ud574\ub2f9\ud558\ub294 \ucee8\ud0dd\uc2a4\ud2b8 \uac1c\uc120\n", "- \uc624\ub958\uac00 \ubc1c\uc0dd\ud55c \ubc14\ub85c \uadf8 \uc2dc\uc810\uc774 \ucf54\ub4dc\ub97c \ub514\ubc84\uae45\ud558\uae30\uc5d0 \uac00\uc7a5 \ucd5c\uc801\uc778 \uc2dc\uc810\n", "- \uc608\uc678\uac00 \ubc1c\uc0dd\ud55c \ud6c4\uc5d0 %debug \uba85\ub839\uc5b4\ub97c \uc0ac\uc6a9\ud558\uba74 \uc0ac\ud6c4\ucc98\ub9ac(post-mortem) \ub514\ubc84\uac70\uac00 \uc2e4\ud589\ub418\uace0 \uc608\uc678\uac00 \ubc1c\uc0dd\ud55c \uc2dc\uc810\uc758 \uc2a4\ud0dd \ud504\ub808\uc784 \uc815\ubcf4\ub97c \ubcf4\uc5ec\uc900\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "# %run ch03/ipython_bug.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 13 }, { "cell_type": "markdown", "metadata": {}, "source": [ " ---------------------------------------------------------------------------\n", " AssertionError Traceback (most recent call last)\n", " /Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/ipython_bug.py in ()\n", " 13 throws_an_exception()\n", " 14 \n", " ---> 15 calling_things()\n", "\n", " /Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/ipython_bug.py in calling_things()\n", " 11 def calling_things():\n", " 12 works_fine()\n", " ---> 13 throws_an_exception()\n", " 14 \n", " 15 calling_things()\n", "\n", " /Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/ipython_bug.py in throws_an_exception()\n", " 7 a = 5\n", " 8 b = 6\n", " ----> 9 assert(a + b == 10)\n", " 10 \n", " 11 def calling_things():\n", "\n", " AssertionError: \n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# %debug" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 55 }, { "cell_type": "markdown", "metadata": {}, "source": [ " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(9)throws_an_exception()\n", " 8 b = 6\n", " ----> 9 assert(a + b == 10)\n", " 10 \n", "\n", " ipdb> u\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(13)calling_things()\n", " 12 works_fine()\n", " ---> 13 throws_an_exception()\n", " 14 \n", "\n", " ipdb> u\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(15)()\n", " 13 throws_an_exception()\n", " 14 \n", " ---> 15 calling_things()\n", "\n", " ipdb> u\n", " > /Library/Python/2.7/site-packages/IPython/utils/py3compat.py(224)execfile()\n", " 223 filename = fname\n", " --> 224 builtin_mod.execfile(filename, *where)\n", " 225 \n", "\n", " ipdb> u\n", " *** Oldest frame\n", " ipdb> d\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(15)()\n", " 13 throws_an_exception()\n", " 14 \n", " ---> 15 calling_things()\n", "\n", " ipdb> d\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(13)calling_things()\n", " 12 works_fine()\n", " ---> 13 throws_an_exception()\n", " 14 \n", "\n", " ipdb> d\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(9)throws_an_exception()\n", " 8 b = 6\n", " ----> 9 assert(a + b == 10)\n", " 10 " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \ub514\ubc84\uac70 \uc548\uc5d0\uc11c\ub294 \uc544\ubb34 \ud30c\uc774\uc36c \ucf54\ub4dc\ub098 \uc2e4\ud589\ud574\ubcfc \uc218\ub3c4 \uc788\uace0\n", "- \uac01\uac01\uc758 \uc2a4\ud0dd \ud504\ub808\uc784\uc5d0\uc11c \uc778\ud130\ud504\ub9ac\ud130 \uc548\uc5d0 \uc720\uc9c0\ub418\uace0 \uc788\ub294 \ubaa8\ub4e0 \uac1d\uccb4\uc640 \ub370\uc774\ud130\ub97c \uc0b4\ud3b4\ubcfc \uc218\ub3c4\n", "- \ub514\ud3f4\ud2b8\ub85c \uc624\ub958\uac00 \ubc1c\uc0dd\ud55c \uac00\uc7a5 \uc544\ub798 \ub808\ubca8\uc5d0\uc11c \uc2dc\uc791\ud55c\ub2e4.\n", "- u(up), d(down)\ub97c \ub20c\ub7ec\uc11c \uc2a4\ud0dd \ud2b8\ub808\uc774\uc2a4 \uc0ac\uc774 \uc774\ub3d9 \uac00\ub2a5\n", "\n", "- %pdb: \uc608\uc678\uac00 \ubc1c\uc0dd\ud560 \uacbd\uc6b0 IPython\uc774 \uc790\ub3d9\uc801\uc73c\ub85c \ub514\ubc84\uac70\ub97c \uc2e4\ud589\ud558\ub294\ub370, \uc774 \ubaa8\ub4dc\ub294 \ub9ce\uc740 \uc0ac\uc6a9\uc790\ub4e4\uc774 \uc544\uc8fc \uc720\uc6a9\ud558\ub2e4\uace0 \uc0dd\uac01\n", "- \ub514\ubc84\uac70\ub294 \uac1c\ubc1c\ud558\ub294 \uc911\uc5d0 \uc2a4\ud06c\ub9bd\ud2b8\ub098 \ud568\uc218\ub97c \uc2e4\ud589\ud558\ub294 \uacfc\uc815\uc5d0\uc11c \uac01 \ub2e8\uacc4\ub97c \ud558\ub098\uc529 \uac80\uc99d\ud558\uac70\ub098 \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \uc124\uc815\ud558\uace0 \uc2f6\uc744 \ub54c \uc27d\uac8c \uc0ac\uc6a9\n", "- %run \uba85\ub839\uc5d0 -d \uc635\uc158: \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc2e4\ud589\ud558\uae30 \uc804\uc5d0 \ub514\ubc84\uac70\ub97c \uba3c\uc800 \uc2e4\ud589. \uadf8\ub9ac\uace0 s(step)\ub97c \ub204\ub974\uba74 \uc2a4\ud06c\ub9bd\ud2b8\ub85c \uc9c4\uc785" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Breakpoint 1 at /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py:1\n", " NOTE: Enter 'c' at the ipdb> prompt to continue execution.\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(1)()\n", " 1---> 1 def works_fine():\n", " 2 a = 5\n", " 3 b = 6\n", "\n", " ipdb> s\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(6)()\n", " 5 \n", " ----> 6 def throws_an_exception():\n", " 7 a = 5" ] }, { "cell_type": "code", "collapsed": false, "input": [ "run -d ch03/ipytch03/ipytch03/ipytch03/ipytch03/ipython_bug.py" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stderr", "text": [ "ERROR: File `u'ch03/ipytch03/ipytch03/ipytch03/ipytch03/ipython_bug.py'` not found.\n" ] } ], "prompt_number": 56 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc5ec\uae30\uc11c\ubd80\ud130\ub294 \uc2a4\ud06c\ub9bd\ud2b8 \ud30c\uc77c\uc744 \uc5b4\ub5a4 \uc2dd\uc73c\ub85c \ub3d9\uc791\ud558\uac8c \ud560 \uac83\uc778\uac00\ub294 \ub3c5\uc790\uc758 \ubaab\n", "- \uc608\ub97c \ub4e4\uc5b4 \uc704 \uc608\uc81c\uc5d0\uc11c works_fine \uba54\uc11c\ub4dc\ub97c \ud638\ucd9c\ud558\uae30 \ubc14\ub85c \uc9c1\uc804\uc5d0 \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \uac78\uace0 c(continue)\ub97c \ub20c\ub7ec \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\uc5d0 \uac78\ub9b4 \ub54c\uae4c\uc9c0 \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc2e4\ud589\ud560 \uc218 \uc788\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " ipdb> b 12\n", " Breakpoint 2 at /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py:12\n", " ipdb> c\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(12)calling_things()\n", " 11 def calling_things():\n", " 2--> 12 works_fine()\n", " 13 throws_an_exception()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\uc774\uc81c s\ub97c \ub20c\ub7ec works_fine() \uc548\uc73c\ub85c \uc9c4\uc785\ud558\uac70\ub098 n(next)\uc744 \ub20c\ub7ec works_fine()\uc744 \uc2e4\ud589\ud558\uace0 \ub2e4\uc74c \uc904\ub85c \uc9c4\ud589\ud560 \uc218\ub3c4 \uc788\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " ipdb> n\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(13)calling_things()\n", " 2 12 works_fine()\n", " ---> 13 throws_an_exception()\n", " 14 " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uadf8\ub7ec\uba74 \uc774\uc81c\ub294 throws_an_exception\uae4c\uc9c0 \uc9c4\uc785\ud588\uace0 \uc62c\ub958\uac00 \ubc1c\uc0dd\ud558\ub294 \ub2e4\uc74c \uc904\ub85c \uc9c4\ud589\ud55c \ud6c4 \ud574\ub2f9 \ubc94\uc704 \uc548\uc5d0 \uc788\ub294 \ubcc0\uc218\ub97c \uc0b4\ud3b4\ubcf4\uc790. \n", "- \ub514\ubc84\uac70 \uba85\ub839\uc5b4\ub294 \ubcc0\uc218 \uc774\ub984\ubcf4\ub2e4 \uc6b0\uc120\uc774\ubbc0\ub85c \ub514\ubc84\uac70 \uba85\ub839\uacfc \uac19\uc740 \uc774\ub984\uc758 \ubcc0\uc218\uac00 \uc788\ub2e4\uba74 !\ub97c \ubcc0\uc218 \uc774\ub984 \uc55e\uc5d0 \ubd99\uc5ec\uc11c \ub0b4\uc6a9\uc744 \ud655\uc778\ud560 \uc218 \uc788\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " ipdb> s\n", " --Call--\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(6)throws_an_exception()\n", " 5 \n", " ----> 6 def throws_an_exception():\n", " 7 a = 5\n", "\n", " ipdb> n\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(7)throws_an_exception()\n", " 6 def throws_an_exception():\n", " ----> 7 a = 5\n", " 8 b = 6\n", "\n", " ipdb> n\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(8)throws_an_exception()\n", " 7 a = 5\n", " ----> 8 b = 6\n", " 9 assert(a + b == 10)\n", "\n", " ipdb> n\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(9)throws_an_exception()\n", " 8 b = 6\n", " ----> 9 assert(a + b == 10)\n", " 10 \n", "\n", " ipdb> !a\n", " 5\n", " ipdb> !b\n", " 6" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \ub300\ud654\ud615 \ub514\ubc84\uac70\ub294 \ub9ce\uc740 \uc5f0\uc2b5\uacfc \uc2dc\ud589\ucc29\uc624\ub97c \ud1b5\ud574\uc11c\ub9cc \uc775\uc219\ud574\uc9c8 \uc218 \uc788\ub2e4.\n", "- IDE\uc5d0\ub3c4 \ud6cc\ub96d\ud55c GUI \ub514\ubc84\uac70\ub97c \ub0b4\uc7a5\ud558\uace0 \uc788\uc9c0\ub9cc IPython \ub514\ubc84\uac70\ub97c \uc0ac\uc6a9\ud574\uc11c \ub514\ubc84\uae45\uc744 \ud558\ub294 \uac83\uc774 \uc0dd\uc0b0\uc131 \ud5a5\uc0c1\uc5d0 \ub9ce\uc740 \ub3c4\uc6c0" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%writefile ch03/debugger.csv\n", "Command, Comment\n", "h(elp), \uba85\ub839\uc5b4 \ubaa9\ub85d\uc744 \ubcf4\uc5ec\uc900\ub2e4.\n", "help command, command\uc5d0 \ub300\ud55c \ubb38\uc11c\ub97c \ubcf4\uc5ec\uc900\ub2e4.\n", "c(continue), \ud504\ub85c\uadf8\ub7a8\uc758 \uc2e4\ud589\uc744 \uc7ac\uac1c\ud55c\ub2e4.\n", "q(uit), \ub354 \uc774\uc0c1 \ucf54\ub4dc\ub97c \uc2e4\ud589\ud558\uc9c0 \uc54a\uace0 \ub514\ubc84\uac70\ub97c \uc885\ub8cc\ud55c\ub2e4.\n", "b(reak) number, \ud604\uc7ac \ud30c\uc77c\uc758 number\ubc88\uc9f8 \uc904\uc5d0 \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \uc124\uc815\ud55c\ub2e4.\n", "b path/to/file.py:number, \uc9c0\uc815\ud55c \ud30c\uc77c\uc758 number\ubc88\uc9f8 \uc904\uc5d0 \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \uc124\uc815\ud55c\ub2e4\n", "s(tep), \ud568\uc218 \ud638\ucd9c \uc548\uc73c\ub85c \uc9c4\uc785\ud55c\ub2e4.\n", "n(ext), \ud604\uc7ac \uc904\uc744 \uc2e4\ud589\ud558\uace0 \uac19\uc740 \ub808\ubca8\uc758 \ub2e4\uc74c \uc904\ub85c \uc9c4\ud589\ud55c\ub2e4.\n", "u(p) / d(own), \ud568\uc218 \ucf5c \uc2a4\ud0dd(\ud638\ucd9c \uc815\ubcf4)\uc758 \uc704/\uc544\ub798\ub85c \uc774\ub3d9\ud55c\ub2e4.\n", "a(rgs), \ud604\uc7ac \ud568\uc218\uc758 \uc778\uc790\ub97c \ubcf4\uc5ec\uc900\ub2e4.\n", "debug statement, statement \ubb38\uc7a5\uc744 \uc0c8\ub85c\uc6b4 (\uc7ac\uadc0\uc801) \ub514\ubc84\uac70\uc5d0\uc11c \uc2e4\ud589\ud55c\ub2e4.\n", "l(ist) statement, \ud604\uc7ac \uc704\uce58\uc640 \uc2a4\ud0dd\uc758 \ud604\uc7ac \ub808\ubca8\uc5d0 \ub300\ud55c \ubb38\ub9e5\uc744 \ubcf4\uc5ec\uc900\ub2e4.\n", "w(here), \ud604\uc7ac \uc704\uce58\uc5d0 \ub300\ud55c \ubb38\ub9e5\uacfc \ud568\uaed8 \uc804\uccb4 \uc2a4\ud0dd \uc815\ubcf4\ub97c \ucd9c\ub825\ud55c\ub2e4." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Overwriting ch03/debugger.csv\n" ] } ], "prompt_number": 57 }, { "cell_type": "code", "collapsed": false, "input": [ "df = pd.read_csv('ch03/debugger.csv', delimiter=',')" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 58 }, { "cell_type": "code", "collapsed": false, "input": [ "df" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Command Comment
0 h(elp) \uba85\ub839\uc5b4 \ubaa9\ub85d\uc744 \ubcf4\uc5ec\uc900\ub2e4.
1 help command command\uc5d0 \ub300\ud55c \ubb38\uc11c\ub97c \ubcf4\uc5ec\uc900\ub2e4.
2 c(continue) \ud504\ub85c\uadf8\ub7a8\uc758 \uc2e4\ud589\uc744 \uc7ac\uac1c\ud55c\ub2e4.
3 q(uit) \ub354 \uc774\uc0c1 \ucf54\ub4dc\ub97c \uc2e4\ud589\ud558\uc9c0 \uc54a\uace0 \ub514\ubc84\uac70\ub97c \uc885\ub8cc\ud55c\ub2e4.
4 b(reak) number \ud604\uc7ac \ud30c\uc77c\uc758 number\ubc88\uc9f8 \uc904\uc5d0 \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \uc124\uc815\ud55c\ub2e4.
5 b path/to/file.py:number \uc9c0\uc815\ud55c \ud30c\uc77c\uc758 number\ubc88\uc9f8 \uc904\uc5d0 \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \uc124\uc815\ud55c\ub2e4
6 s(tep) \ud568\uc218 \ud638\ucd9c \uc548\uc73c\ub85c \uc9c4\uc785\ud55c\ub2e4.
7 n(ext) \ud604\uc7ac \uc904\uc744 \uc2e4\ud589\ud558\uace0 \uac19\uc740 \ub808\ubca8\uc758 \ub2e4\uc74c \uc904\ub85c \uc9c4\ud589\ud55c\ub2e4.
8 u(p) / d(own) \ud568\uc218 \ucf5c \uc2a4\ud0dd(\ud638\ucd9c \uc815\ubcf4)\uc758 \uc704/\uc544\ub798\ub85c \uc774\ub3d9\ud55c\ub2e4.
9 a(rgs) \ud604\uc7ac \ud568\uc218\uc758 \uc778\uc790\ub97c \ubcf4\uc5ec\uc900\ub2e4.
10 debug statement statement \ubb38\uc7a5\uc744 \uc0c8\ub85c\uc6b4 (\uc7ac\uadc0\uc801) \ub514\ubc84\uac70\uc5d0\uc11c \uc2e4\ud589\ud55c\ub2e4.
11 l(ist) statement \ud604\uc7ac \uc704\uce58\uc640 \uc2a4\ud0dd\uc758 \ud604\uc7ac \ub808\ubca8\uc5d0 \ub300\ud55c \ubb38\ub9e5\uc744 \ubcf4\uc5ec\uc900\ub2e4.
12 w(here) \ud604\uc7ac \uc704\uce58\uc5d0 \ub300\ud55c \ubb38\ub9e5\uacfc \ud568\uaed8 \uc804\uccb4 \uc2a4\ud0dd \uc815\ubcf4\ub97c \ucd9c\ub825\ud55c\ub2e4.
\n", "
" ], "metadata": {}, "output_type": "pyout", "prompt_number": 59, "text": [ " Command Comment\n", "0 h(elp) \uba85\ub839\uc5b4 \ubaa9\ub85d\uc744 \ubcf4\uc5ec\uc900\ub2e4.\n", "1 help command command\uc5d0 \ub300\ud55c \ubb38\uc11c\ub97c \ubcf4\uc5ec\uc900\ub2e4.\n", "2 c(continue) \ud504\ub85c\uadf8\ub7a8\uc758 \uc2e4\ud589\uc744 \uc7ac\uac1c\ud55c\ub2e4.\n", "3 q(uit) \ub354 \uc774\uc0c1 \ucf54\ub4dc\ub97c \uc2e4\ud589\ud558\uc9c0 \uc54a\uace0 \ub514\ubc84\uac70\ub97c \uc885\ub8cc\ud55c\ub2e4.\n", "4 b(reak) number \ud604\uc7ac \ud30c\uc77c\uc758 number\ubc88\uc9f8 \uc904\uc5d0 \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \uc124\uc815\ud55c\ub2e4.\n", "5 b path/to/file.py:number \uc9c0\uc815\ud55c \ud30c\uc77c\uc758 number\ubc88\uc9f8 \uc904\uc5d0 \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \uc124\uc815\ud55c\ub2e4\n", "6 s(tep) \ud568\uc218 \ud638\ucd9c \uc548\uc73c\ub85c \uc9c4\uc785\ud55c\ub2e4.\n", "7 n(ext) \ud604\uc7ac \uc904\uc744 \uc2e4\ud589\ud558\uace0 \uac19\uc740 \ub808\ubca8\uc758 \ub2e4\uc74c \uc904\ub85c \uc9c4\ud589\ud55c\ub2e4.\n", "8 u(p) / d(own) \ud568\uc218 \ucf5c \uc2a4\ud0dd(\ud638\ucd9c \uc815\ubcf4)\uc758 \uc704/\uc544\ub798\ub85c \uc774\ub3d9\ud55c\ub2e4.\n", "9 a(rgs) \ud604\uc7ac \ud568\uc218\uc758 \uc778\uc790\ub97c \ubcf4\uc5ec\uc900\ub2e4.\n", "10 debug statement statement \ubb38\uc7a5\uc744 \uc0c8\ub85c\uc6b4 (\uc7ac\uadc0\uc801) \ub514\ubc84\uac70\uc5d0\uc11c \uc2e4\ud589\ud55c\ub2e4.\n", "11 l(ist) statement \ud604\uc7ac \uc704\uce58\uc640 \uc2a4\ud0dd\uc758 \ud604\uc7ac \ub808\ubca8\uc5d0 \ub300\ud55c \ubb38\ub9e5\uc744 \ubcf4\uc5ec\uc900\ub2e4.\n", "12 w(here) \ud604\uc7ac \uc704\uce58\uc5d0 \ub300\ud55c \ubb38\ub9e5\uacfc \ud568\uaed8 \uc804\uccb4 \uc2a4\ud0dd \uc815\ubcf4\ub97c \ucd9c\ub825\ud55c\ub2e4." ] } ], "prompt_number": 59 }, { "cell_type": "markdown", "metadata": {}, "source": [ "### \ub2e4\ub978 \ubc29\ubc95\n", "\n", "- \ub514\ubc84\uac70\ub97c \uc2e4\ud589\ud558\ub294 \uba87 \uac00\uc9c0 \ub2e4\ub978 \uc720\uc6a9\ud55c \ubc29\ubc95\n", "- set_trace \ud568\uc218(pdb.set_trace)\ub97c \uc774\uc6a9\ud558\ub294 \uac83\uc774 \uadf8 \uc911 \ud558\ub098\ub85c, '\uac00\ub09c\ubc45\uc774\uc758 \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8'\ub77c\uace0 \ubd88\ub9b0\ub2e4.\n", "- \uc774 \ucf54\ub4dc\ub97c \ubc94\uc6a9\uc801\uc73c\ub85c \uc0ac\uc6a9\ud558\uae30 \uc704\ud574 IPython \ud504\ub85c\ud30c\uc77c\uc5d0 \ucd94\uac00\ud574\uc11c \uc0ac\uc6a9" ] }, { "cell_type": "code", "collapsed": false, "input": [ "def set_trace():\n", " from IPython.core.debugger import Pdb\n", " Pdb(color_scheme='Linux').set_trace(sys._getframe().f_back)\n", " \n", "def debug(f, *args, **kwargs):\n", " from IPython.core.debugger import Pdb\n", " pdb = Pdb(color_scheme='Linux')\n", " return pdb.runcall(f, *args, **kwargs)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 60 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uccab\ubc88\uc9f8 \ud568\uc218\uc778 set_trace\ub294 \ub9e4\uc6b0 \uac04\ub2e8\n", "- set_trace()\ub97c \ucf54\ub4dc\uc758 \uc544\ubb34 \uacf3\uc5d0\ub098 \ub123\uc73c\uba74 \uadf8 \uacf3\uc5d0\uc11c \uc2e4\ud589\uc744 \uba48\ucd94\uace0 \uc0b4\ud3b4\ubcfc \uc218 \uc788\ub2e4.(\uc608\uc678\uac00 \ubc1c\uc0dd\ud558\uae30 \ubc14\ub85c \uc804 \uc704\uce58\ub77c\uba74 \uc801\uc808\ud558\ub2e4.)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### \ucc45\uc5d0 \uc788\ub294 \uc608\uc81c \uc2e4\uc2b5 \ucf54\ub4dc\n", "\n", "- \uba3c\uc800 ipython_bug2.py\ub85c \uc800\uc7a5\ud55c\ub2e4.\n", "- notebook\uc5d0\uc11c \ubc14\ub85c \ud30c\uc77c\ub85c \uc800\uc7a5\ud560 \uc218 \uc788\ub294\uac8c \uc815\ub9d0 \uc88b\uc740 \uac83 \uac19\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%writefile ch03/ipython_bug2.py\n", "import sys\n", "\n", "def set_trace():\n", " from IPython.core.debugger import Pdb\n", " Pdb(color_scheme='Linux').set_trace(sys._getframe().f_back)\n", "\n", "def works_fine():\n", " a = 5\n", " b = 6\n", " assert(a + b == 11)\n", "\n", "def throws_an_exception():\n", " a = 5\n", " b = 6\n", " assert(a + b == 10)\n", "\n", "def calling_things():\n", " works_fine()\n", " set_trace()\n", " throws_an_exception()\n", "\n", "calling_things()" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Overwriting ch03/ipython_bug2.py\n" ] } ], "prompt_number": 61 }, { "cell_type": "code", "collapsed": false, "input": [ "# run ch03/ipython_bug2.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 62 }, { "cell_type": "markdown", "metadata": {}, "source": [ " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug2.py(20)calling_things()\n", " 19 set_trace()\n", " ---> 20 throws_an_exception()\n", " 21 " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- c\ub97c \ub204\ub974\uba74 \uc544\ubb34\ub7f0 \ubb38\uc81c \uc5c6\uc774 \uc815\uc0c1\uc801\uc73c\ub85c \ucf54\ub4dc \uc2e4\ud589\uc774 \uc7ac\uac1c\ub41c\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " ipdb> c\n", " ---------------------------------------------------------------------------\n", " AssertionError Traceback (most recent call last)\n", " /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug2.py in ()\n", " 20 throws_an_exception()\n", " 21 \n", " ---> 22 calling_things()\n", "\n", " /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug2.py in calling_things()\n", " 18 works_fine()\n", " 19 set_trace()\n", " ---> 20 throws_an_exception()\n", " 21 \n", " 22 calling_things()\n", "\n", " /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug2.py in throws_an_exception()\n", " 13 a = 5\n", " 14 b = 6\n", " ---> 15 assert(a + b == 10)\n", " 16 \n", " 17 def calling_things():\n", "\n", " AssertionError: " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- debug \ud568\uc218\ub294 \uc5b4\ub5a4 \ud568\uc218 \ud638\ucd9c\uc5d0\uc11c\ub77c\ub3c4 \ub300\ud654\ud615 \ub514\ubc84\uac70\ub97c \uc27d\uac8c \uc2e4\ud589\ud560 \uc218 \uc788\ub3c4\ub85d \ud574\uc8fc\ub294\ub370 \ub2e4\uc74c\uacfc \uac19\uc740 \ud568\uc218\ub97c \uc791\uc131\ud588\ub2e4\uace0 \uac00\uc815" ] }, { "cell_type": "code", "collapsed": false, "input": [ "def f(x, y, z=1):\n", " tmp = x + y\n", " return tmp / z" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc774 \ud568\uc218\uc758 \ub0b4\ubd80 \ub85c\uc9c1\uc744 \uc0b4\ud3b4\ubcf4\uc790.\n", "- \ubcf4\ud1b5 f \ud568\uc218\ub294 f(1, 2, z=3) \uac19\uc740 \uc2dd\uc73c\ub85c \ud638\ucd9c\ud558\uac8c \ub420 \uac83\uc774\ub2e4.\n", "- f \ud568\uc218\uc758 \ub0b4\ubd80\ub85c \uc9c4\uc785\ud558\uae30 \uc704\ud574 f\ub97c debug \ud568\uc218\uc758 \uccab\ubc88\uc9f8 \uc778\uc790\ub85c \ub118\uae30\uace0 \uadf8 \ub2e4\uc74c\uc5d0 f \ud568\uc218\uc758 \uc778\uc790\ub97c \ucc28\ub840\ub300\ub85c \uc368 \ub123\uc73c\uba74 \ub41c\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "debug(f, 1, 2, z=3)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "NOTE: Enter 'c' at the ipdb> prompt to continue execution.\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n", "\u001b[0;31mSyntaxError\u001b[0m Traceback (most recent call last)\n", "\u001b[0;31mSyntaxError\u001b[0m: invalid syntax (, line 4)\n" ] } ], "prompt_number": 2 }, { "cell_type": "raw", "metadata": {}, "source": [ "> (2)f()\n", " 1 def f(x, y, z=1):\n", "----> 2 tmp = x + y\n", " 3 return tmp / z\n", "\n", "ipdb> c\n", "Out[127]:\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- debug\uc5d0 \ub514\ubc84\uae45\ud558\uace0 \uc2f6\uc740 \ud568\uc218\ub9cc \ub118\uaca8\uc8fc\uba74 \uadf8 \ud568\uc218\ub97c \ubc14\ub85c \ub514\ubc84\uae45 \ud560 \uc218 \uc788\ub2e4.\n", "- \uc774 2\uac00\uc9c0\uc758 \uc9e7\uc740 \ucf54\ub4dc\uac00 \ub9e4\uc77c \uc2dc\uac04\uc744 **\uc808\uc57d**\ud574 \uc8fc\uace0 \uc788\ub2e4.\n", "\n", "#### %run \uba85\ub839\uc5b4\uc640 \uacb0\ud569\ud558\uc5ec \uc0ac\uc6a9\ud558\ub294 \ubc29\ubc95\n", "\n", "- %run -d\ub97c \uc774\uc6a9\ud574\uc11c \uc2e4\ud589\ud558\uba74 \ubc14\ub85c \ub514\ubc84\uac70\uac00 \uc2e4\ud589\n", "- \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \uc124\uc815\ud558\uace0 \uc2a4\ud06c\ub9bd\ud2b8 \uc2dc\uc791" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# %run -d ch03/ipython_bug.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 65 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- b\uc5d0 \ud589 \ubc88\ud638\ub97c \ubd99\uc5ec\uc11c \ub118\uae30\uba74 \ub514\ubc84\uac70\uac00 \uc2e4\ud589\ub418\uba74\uc11c \ube0c\ub808\uc774\ud06c\ud3ec\uc778\ud2b8\ub97c \ubbf8\ub9ac \uc124\uc815\ud574\uc900\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "# %run -d -b3 ch03/ipython_bug.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 66 }, { "cell_type": "markdown", "metadata": {}, "source": [ " Breakpoint 1 at /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py:3\n", " NOTE: Enter 'c' at the ipdb> prompt to continue execution.\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(1)()\n", " ----> 1 def works_fine():\n", " 2 a = 5\n", " 1 3 b = 6\n", "\n", " ipdb> c\n", " > /Users/re4lfl0w/Documents/SPSE/ch03/ipython_bug.py(3)works_fine()\n", " 2 a = 5\n", " 1---> 3 b = 6\n", " 4 assert(a + b == 11)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### \ud30c\uc774\uc36c \uc0c1\ud638\ub300\ud654 \ub514\ubc84\uae45 \uc5f0\uc2b5" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%writefile ch03/test_debugger.py\n", "import pdb\n", "\n", "def test_debugger(some_int):\n", " print 'start some_int>>>', some_int\n", " return_int = 10 / some_int\n", " print 'end some_int>>', some_int\n", " return return_int\n", "\n", "if __name__ == '__main__':\n", " pdb.run('test_debugger(0)')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Overwriting ch03/test_debugger.py\n" ] } ], "prompt_number": 67 }, { "cell_type": "code", "collapsed": false, "input": [ "%run ch03/test_debugger.py" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "> (1)()\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "(Pdb) n\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "start some_int>>> 0\n", "ZeroDivisionError: 'integer division or modulo by zero'\n", "> (1)()\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "(Pdb) n\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "--Return--\n", "> (1)()->None\n" ] }, { "name": "stdout", "output_type": "stream", "stream": "stdout", "text": [ "(Pdb) n\n" ] }, { "ename": "ZeroDivisionError", "evalue": "integer division or modulo by zero", "output_type": "pyerr", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/Users/re4lfl0w/Documents/ipython/books/python_data_analysis/ch03/test_debugger.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m__name__\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'__main__'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mpdb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'test_debugger(0)'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m/Applications/Canopy.app/appdata/canopy-1.3.0.1715.macosx-x86_64/Canopy.app/Contents/lib/python2.7/pdb.pyc\u001b[0m in \u001b[0;36mrun\u001b[0;34m(statement, globals, locals)\u001b[0m\n\u001b[1;32m 1236\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1237\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mglobals\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlocals\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1238\u001b[0;31m \u001b[0mPdb\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mglobals\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlocals\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1239\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1240\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mruneval\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexpression\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mglobals\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlocals\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Applications/Canopy.app/appdata/canopy-1.3.0.1715.macosx-x86_64/Canopy.app/Contents/lib/python2.7/bdb.pyc\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, cmd, globals, locals)\u001b[0m\n\u001b[1;32m 398\u001b[0m \u001b[0mcmd\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcmd\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;34m'\\n'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 399\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 400\u001b[0;31m \u001b[0;32mexec\u001b[0m \u001b[0mcmd\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mglobals\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlocals\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 401\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mBdbQuit\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 402\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n", "\u001b[0;32m/Users/re4lfl0w/Documents/ipython/books/python_data_analysis/ch03/test_debugger.py\u001b[0m in \u001b[0;36mtest_debugger\u001b[0;34m(some_int)\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mtest_debugger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msome_int\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0;34m'start some_int>>>'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msome_int\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mreturn_int\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m10\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0msome_int\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0;34m'end some_int>>'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msome_int\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mreturn_int\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mZeroDivisionError\u001b[0m: integer division or modulo by zero" ] } ], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "%%writefile ch03/buggy.py\n", "def divide_one_by(divisor):\n", " return 1/ divisor\n", "\n", "if __name__ == '__main__':\n", " divide_one_by(0)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Overwriting ch03/buggy.py\n" ] } ], "prompt_number": 69 }, { "cell_type": "code", "collapsed": false, "input": [ "# %run ch03/buggy.py" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 17 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " ---------------------------------------------------------------------------\n", " ZeroDivisionError Traceback (most recent call last)\n", " /Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/buggy.py in ()\n", " 3 \n", " 4 if __name__ == '__main__':\n", " ----> 5 divide_one_by(0)\n", "\n", " /Users/re4lfl0w/Documents/ipython/python_data_analysis/ch03/buggy.py in divide_one_by(divisor)\n", " 1 def divide_one_by(divisor):\n", " ----> 2 return 1/ divisor\n", " 3 \n", " 4 if __name__ == '__main__':\n", " 5 divide_one_by(0)\n", "\n", " ZeroDivisionError: integer division or modulo by zero" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.4.2 \ucf54\ub4dc \uc2dc\uac04 \uce21\uc815: %time\uacfc %timeit\n", "\n", "- \ub300\uaddc\ubaa8 \ubd84\uc11d \uc791\uc5c5\uc774\ub098 \uc624\ub79c \uc2dc\uac04\uc774 \uc18c\uc694\ub418\ub294 \ub370\uc774\ud130 \ubd84\uc11d \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc5d0\uc11c\ub294 \ucef4\ud3ec\ub10c\ud2b8\ub098 \ud568\uc218 \ud638\ucd9c \ud639\uc740 \ub2e8\uc77c \uba85\ub839\uc5b4\uc758 \uc2e4\ud589 \uc2dc\uac04\uc774 \uc5bc\ub9c8\uc778\uc9c0 \uce21\uc815\ud574\uc57c \ud558\ub294 \uacbd\uc6b0 \uc874\uc7ac\n", "- \uc804\uccb4 \ucc98\ub9ac \uacfc\uc815\uc5d0\uc11c \uc5b4\ub5a4 \ud568\uc218\uac00 \uac00\uc7a5 \uc624\ub7ab\ub3d9\uc548 \uc2e4\ud589\ub418\uc5c8\ub294\uc9c0 \ubcf4\uace0\uc11c\uac00 \ud544\uc694\n", "- \ub0b4\uc7a5 time \ubaa8\ub4c8\uc744 \uc774\uc6a9\ud574\uc11c time.clock, time.time \ud568\uc218\ub85c \uc9c1\uc811 \uc2dc\uac04 \uce21\uc815 \ucf54\ub4dc\ub97c \uc791\uc131\ud558\ub294 \uc77c\uc740 \uc7ac\ubbf8 \uc5c6\ub294 \ucf54\ub4dc\ub97c \ubc18\ubcf5\uc801\uc73c\ub85c \uc368\ub123\uc5b4\uc57c \ud558\uae30 \ub54c\ubb38\uc5d0 \uc9c0\ub8e8" ] }, { "cell_type": "code", "collapsed": false, "input": [ "iterations = 10" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 71 }, { "cell_type": "code", "collapsed": false, "input": [ "import time\n", "start = time.time()\n", "for i in range(iterations):\n", " elapsed_per = (time.time() - start) / iterations" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 72 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc774 \ucf54\ub4dc\ub294 \uc2dc\uac04\uc744 \uce21\uc815\ud558\uae30 \uc704\ud574 \uc544\uc8fc \ud754\ud558\ub2e4.\n", "- IPython \uc5d0\ub294 %time\uacfc %timeit \uc774\ub77c\ub294 \ub9e4\uc9c1 \ud568\uc218\uac00 \uc788\uc5b4 \uac04\ub2e8\ud788 \uc4f8 \uc218 \uc788\ub2e4.\n", "- %time: \ud55c \ubb38\uc7a5\uc744 \uc2e4\ud589\ud558\uace0 \uc18c\uc694\ub41c \uc804\uccb4 \uc2e4\ud589 \uc2dc\uac04 \ubcf4\uc5ec\uc90c" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# a very large list of strings\n", "strings = ['foo', 'foobar', 'baz', 'qux',\n", " 'python', 'Guido Van Rossum', 'scari'] * 100000\n", "\n", "method1 = [x for x in strings if x.startswith('foo')]\n", "method2 = [x for x in strings if x[:3] == 'foo']" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 73 }, { "cell_type": "code", "collapsed": false, "input": [ "%time method1 = [x for x in strings if x.startswith('foo')]" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "CPU times: user 219 ms, sys: 11 ms, total: 230 ms\n", "Wall time: 224 ms\n" ] } ], "prompt_number": 74 }, { "cell_type": "code", "collapsed": false, "input": [ "%time method2 = [x for x in strings if x[:3] == 'foo']" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "CPU times: user 95.6 ms, sys: 4.6 ms, total: 100 ms\n", "Wall time: 98.1 ms\n" ] } ], "prompt_number": 75 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Wall time\uac12 \uc911\uc694\ud558\ub2e4.\n", "- \uc880 \ub354 \uc815\ud655\ud55c \uce21\uc815\uc744 \ud558\uae30 \uc704\ud574\uc11c\ub294 %timeit \ub9e4\uc9c1 \ud568\uc218 \uc0ac\uc6a9. \uc784\uc758\uc758 \ud55c \ubb38\uc7a5\uc744 \uc5ec\ub7ec \ubc88 \uc2e4\ud589\ud574\ubcf4\uace0 \uc0c1\ub2f9\ud788 \uc815\ud655\ud55c \ud3c9\uade0 \uc2e4\ud589 \uc2dc\uac04\uc744 \uad6c\ud574\uc900\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%timeit method1 = [x for x in strings if x.startswith('foo')]" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "10 loops, best of 3: 154 ms per loop\n" ] } ], "prompt_number": 76 }, { "cell_type": "code", "collapsed": false, "input": [ "%timeit method2 = [x for x in strings if x[:3] == 'foo']" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "10 loops, best of 3: 60 ms per loop\n" ] } ], "prompt_number": 77 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc55e\uc758 \uc608\uc81c\ub294 \ubc00\ub9ac\ucd08 \ub2e8\uc704\uc600\uc9c0\ub9cc \ub300\uaddc\ubaa8 \ub370\uc774\ud130 \ubd84\uc11d \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc5d0\uc11c\ub294 \ub354 \ud070 \ub2e8\uc704 \ub4f1\uc7a5\n", "\n", "- timeit\uc740 \ub9c8\uc774\ud06c\ub85c\ucd08(1\uc758 -6\uc2b9) \ud639\uc740 \ub098\ub178\ucd08(1\uc758 -9\uc2b9) \ub2e8\uc704\uc758 \ub9e4\uc6b0 \uc9e7\uc740 \uc2e4\ud589 \uc2dc\uac04\uc744 \uac00\uc9c0\ub294 \ud568\uc218\ub098 \ubb38\uc7a5\uc744 \ubd84\uc11d\ud558\ub294 \ub370 \ub9e4\uc6b0 \uc720\uc6a9\n", "- \uc544\uc8fc \uc9e7\uc740 \uc2dc\uac04\ucc98\ub7fc \ubcf4\uc774\uaca0\uc9c0\ub9cc 20\ub9c8\uc774\ud06c\ub85c\ucd08\uac00 \uac78\ub9ac\ub294 \ud568\uc218\ub97c \ubc31\ub9cc \ubc88 \uc2e4\ud589\ud558\uba74 5\ub9c8\uc774\ud06c\ub85c\ucd08\uac00 \uac78\ub9ac\ub294 \ud568\uc218\ubcf4\ub2e4 15\ucd08\ub098 \ub354 \uac78\ub9b0\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- %time, %timeit \uc774 \uad49\uc7a5\ud788 \ud3b8\ud55c \ud568\uc218\ub2e4. \uc2dc\uac04\uc744 \uce21\uc815\ud558\ub824\uba74 start, end \uad6c\ud574\uc57c \ub418\ub294\ub370 \uadc0\ucc2e\uc740 \uc791\uc5c5\uc744 \ubaa8\ub450 \ud55c \ubc88\uc5d0 \ub0a0\ub824\uc900\ub2e4. \uc65c \uc608\uc804\uc5d0\ub294 \uc774\ub7f0 \uc0dd\uac01\uc744 \ubabb\ud588\uc744\uae4c? \n", "- \ub610 \uad81\uae08\ud55c \uac83\uc740 %timeit \ub9e4\uc9c1 \ud568\uc218\ub97c \uc5b4\ub5bb\uac8c \uad6c\ud604\ud588\uc744\uae4c? \uc774\uac83\ub3c4 \ud568\uc218\ub97c \uac10\uc2f8\ub294 \ub370\ucf54\ub808\uc774\ud130\uc758 \uc77c\uc885\uc73c\ub85c \uc0dd\uac01\uc740 \ub418\ub294\ub370 \uc790\uc138\ud55c \uac83\uc740 \ucf54\ub4dc\ub97c \ud55c \ubc88 \ubd10\uc57c\ud560\ub4ef \uc2f6\ub2e4. \uc5b4\uca0c\ub4e0 \ub9e4\uc6b0 \ud3b8\ub9ac\ud55c \ud568\uc218!\n", "\n", "#### \ub370\ucf54\ub808\uc774\ud130, \ud3fc \uc785\ub825 \ud544\ud130\ub9c1\uc744 \ud65c\uc6a9\ud55c SQL Injection \ubc29\uc9c0 \uc0dd\uac01\n", "\n", "- \ub370\ucf54\ub808\uc774\ud130\uc758 \uc77c\uc885\uc73c\ub85c \ub9cc\ub4e4\uba74 SQL Injection\uc744 \ubc29\uc5b4\ud558\ub294\ub370 \ub9e4\uc6b0 \ud3b8\ub9ac\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc744\uac83 \uac19\ub2e4.\n", "- \ubbf8\ub9ac \uc815\uc758\ub41c string \uce58\ud658 \ud568\uc218\ub97c \ub370\ucf54\ub808\uc774\ud130\ub85c \ub9cc\ub4e4\uc5b4\ub193\uace0 \uc774 \ub370\ucf54\ub808\uc774\ud130\ub85c \ubcc0\ud658\ud560 \ud568\uc218 \uc55e\uc5d0 \ub370\ucf54\ub808\uc774\ud130\ub9cc \uc9c0\uc815\ud574\uc8fc\uba74 \uc790\ub3d9\uc73c\ub85c \ubcc0\uc218\uc758 SQL Injection \ucde8\uc57d\uc810\uc774 \uc5c6\uc5b4\uc9c0\ub2c8.. \uadfc\ub370 \uc774\uac83\ub3c4 \uadc0\ucc2e\uc744 \uc218\uac00 \uc788\ub2e4. \ub9cc\uc57d\uc5d0 \ub370\ucf54\ub808\uc774\ud130 \ucd94\uac00\ud558\ub294 \uac83\uc744 \uae5c\ube61\ud558\uba74 \uc5b4\ub5bb\uac8c \ud560 \uac83\uc778\uac00? \uc608\uc804\uc5d0 \uad6c\uae00\uc571\uc5d4\uc9c4 \uac1c\ubc1c\ud560\ub54c \uc7a0\uae50 \uc0b4\ud3b4\ubd24\ub358 \ub77c\uc774\ube0c\ub7ec\ub9ac\uc778\ub370 \ud3fc\uc73c\ub85c \uc785\ub825\ub41c \ubcc0\uc218\uac12\ub4e4\uc740 \ubaa8\ub450 \ud544\ud130\ub9c1\ud574\uc11c \uc92c\ub358\uac70 \uac19\uc740\ub370.. \uc774 \ub77c\uc774\ube0c\ub7ec\ub9ac \uac19\uc740 \uacbd\uc6b0\ub294 \uc544\uc608 \ud3fc\uc73c\ub85c \ubc1b\ub294 \uc785\ub825\uac12\uc744 \ud544\ud130\ub9c1\ud574\uc11c \ub118\uaca8\uc8fc\ub2c8 \uc6d0\ucc9c\uc801\uc73c\ub85c \ud504\ub808\uc784\uc6cc\ud06c \ub2e8\uc5d0\uc11c \ucc28\ub2e8\ud574\uc904 \uac83 \uac19\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
Type:        Magic function\n",
      "String form: >\n",
      "Namespace:   IPython internal\n",
      "File:        /Library/Python/2.7/site-packages/IPython/core/magics/execution.py\n",
      "Definition:  %timeit(self, line='', cell=None)\n",
      "Source:\n",
      "    @skip_doctest\n",
      "    @line_cell_magic\n",
      "    def timeit(self, line='', cell=None):\n",
      "        \"\"\"Time execution of a Python statement or expression\n",
      "\n",
      "        Usage, in line mode:\n",
      "          %timeit [-n -r [-t|-c] -q -p

-o] statement\n", " or in cell mode:\n", " %%timeit [-n -r [-t|-c] -q -p

-o] setup_code\n", " code\n", " code...\n", "\n", " Time execution of a Python statement or expression using the timeit\n", " module. This function can be used both as a line and cell magic:\n", "\n", " - In line mode you can time a single-line statement (though multiple\n", " ones can be chained with using semicolons).\n", "\n", " - In cell mode, the statement in the first line is used as setup code\n", " (executed but not timed) and the body of the cell is timed. The cell\n", " body has access to any variables created in the setup code.\n", "\n", " Options:\n", " -n: execute the given statement times in a loop. If this value\n", " is not given, a fitting value is chosen.\n", "\n", " -r: repeat the loop iteration times and take the best result.\n", " Default: 3\n", "\n", " -t: use time.time to measure the time, which is the default on Unix.\n", " This function measures wall time.\n", "\n", " -c: use time.clock to measure the time, which is the default on\n", " Windows and measures wall time. On Unix, resource.getrusage is used\n", " instead and returns the CPU user time.\n", "\n", " -p

: use a precision of

digits to display the timing result.\n", " Default: 3\n", "\n", " -q: Quiet, do not print result.\n", "\n", " -o: return a TimeitResult that can be stored in a variable to inspect\n", " the result in more details.\n", "\n", "\n", " Examples\n", " --------\n", " ::\n", "\n", " In [1]: %timeit pass\n", " 10000000 loops, best of 3: 53.3 ns per loop\n", "\n", " In [2]: u = None\n", "\n", " In [3]: %timeit u is None\n", " 10000000 loops, best of 3: 184 ns per loop\n", "\n", " In [4]: %timeit -r 4 u == None\n", " 1000000 loops, best of 4: 242 ns per loop\n", "\n", " In [5]: import time\n", "\n", " In [6]: %timeit -n1 time.sleep(2)\n", " 1 loops, best of 3: 2 s per loop\n", "\n", "\n", " The times reported by %timeit will be slightly higher than those\n", " reported by the timeit.py script when variables are accessed. This is\n", " due to the fact that %timeit executes the statement in the namespace\n", " of the shell, compared with timeit.py, which uses a single setup\n", " statement to import function or create variables. Generally, the bias\n", " does not matter as long as results from timeit.py are not mixed with\n", " those from %timeit.\"\"\"\n", "\n", " import timeit\n", "\n", " opts, stmt = self.parse_options(line,'n:r:tcp:qo',\n", " posix=False, strict=False)\n", " if stmt == \"\" and cell is None:\n", " return\n", " \n", " timefunc = timeit.default_timer\n", " number = int(getattr(opts, \"n\", 0))\n", " repeat = int(getattr(opts, \"r\", timeit.default_repeat))\n", " precision = int(getattr(opts, \"p\", 3))\n", " quiet = 'q' in opts\n", " return_result = 'o' in opts\n", " if hasattr(opts, \"t\"):\n", " timefunc = time.time\n", " if hasattr(opts, \"c\"):\n", " timefunc = clock\n", "\n", " timer = timeit.Timer(timer=timefunc)\n", " # this code has tight coupling to the inner workings of timeit.Timer,\n", " # but is there a better way to achieve that the code stmt has access\n", " # to the shell namespace?\n", " transform = self.shell.input_splitter.transform_cell\n", "\n", " if cell is None:\n", " # called as line magic\n", " ast_setup = ast.parse(\"pass\")\n", " ast_stmt = ast.parse(transform(stmt))\n", " else:\n", " ast_setup = ast.parse(transform(stmt))\n", " ast_stmt = ast.parse(transform(cell))\n", "\n", " ast_setup = self.shell.transform_ast(ast_setup)\n", " ast_stmt = self.shell.transform_ast(ast_stmt)\n", "\n", " # This codestring is taken from timeit.template - we fill it in as an\n", " # AST, so that we can apply our AST transformations to the user code\n", " # without affecting the timing code.\n", " timeit_ast_template = ast.parse('def inner(_it, _timer):\\n'\n", " ' setup\\n'\n", " ' _t0 = _timer()\\n'\n", " ' for _i in _it:\\n'\n", " ' stmt\\n'\n", " ' _t1 = _timer()\\n'\n", " ' return _t1 - _t0\\n')\n", "\n", " timeit_ast = TimeitTemplateFiller(ast_setup, ast_stmt).visit(timeit_ast_template)\n", " timeit_ast = ast.fix_missing_locations(timeit_ast)\n", "\n", " # Track compilation time so it can be reported if too long\n", " # Minimum time above which compilation time will be reported\n", " tc_min = 0.1\n", "\n", " t0 = clock()\n", " code = compile(timeit_ast, \"\", \"exec\")\n", " tc = clock()-t0\n", "\n", " ns = {}\n", " exec(code, self.shell.user_ns, ns)\n", " timer.inner = ns[\"inner\"]\n", "\n", " if number == 0:\n", " # determine number so that 0.2 <= total time < 2.0\n", " number = 1\n", " for _ in range(1, 10):\n", " if timer.timeit(number) >= 0.2:\n", " break\n", " number *= 10\n", " all_runs = timer.repeat(repeat, number)\n", " best = min(all_runs) / number\n", " if not quiet :\n", " print(u\"%d loops, best of %d: %s per loop\" % (number, repeat,\n", " _format_time(best, precision)))\n", " if tc > tc_min:\n", " print(\"Compiler time: %.2f s\" % tc)\n", " if return_result:\n", " return TimeitResult(number, repeat, best, all_runs, tc, precision)" ] }, { "cell_type": "code", "collapsed": false, "input": [ "x = 'foobar'" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 78 }, { "cell_type": "code", "collapsed": false, "input": [ "y = 'foo'" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 79 }, { "cell_type": "code", "collapsed": false, "input": [ "%timeit x.startswith(y)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "1000000 loops, best of 3: 217 ns per loop\n" ] } ], "prompt_number": 80 }, { "cell_type": "code", "collapsed": false, "input": [ "%timeit x[:3] == y" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "10000000 loops, best of 3: 119 ns per loop\n" ] } ], "prompt_number": 81 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- %timeit\uc740 \uba87 \ubc88 loops\ub97c \ub3cc\uc558\ub294\uc9c0 \uc11c\ub85c \ube44\uad50\ud574 \ubcf4\uba74\uc11c \ubd10\uc57c \ud55c\ub2e4. loops \ub2e8\uc704\uac00 \ub2e4\ub97c \uc218 \uc788\ub2e4." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.4.3 \uae30\ubcf8\uc801\uc778 \ud504\ub85c\ud30c\uc77c\ub9c1: %prun\uacfc %run -p\n", "\n", "- \ucf54\ub4dc \ud504\ub85c\ud30c\uc77c\ub9c1\uc740 \ucf54\ub4dc \uc2e4\ud589 \uc2dc\uac04 \uce21\uc815\uacfc \ubc00\uc811\ud55c \uad00\uacc4\n", "- \ud504\ub85c\ud30c\uc77c\ub9c1\uc740 \uadf8 \uc2dc\uac04\uc774 \uc5b4\ub514\uc11c \uc18c\uc694\ub418\uc5c8\ub294\uc9c0 \uce20\uac86\u3147\n", "- \uc8fc\ub85c \uc0ac\uc6a9\ub418\ub294 \ud30c\uc774\uc36c \ud504\ub85c\ud30c\uc77c\ub9c1 \ub3c4\uad6c\ub294 cProfile \ubaa8\ub4c8\uc778\ub370 IPython\uc5d0 \uad6d\ud55c\ub41c \ub3c4\uad6c\ub294 \uc544\ub2d8\n", "- cProfile\uc740 \ud504\ub85c\uadf8\ub7a8\uc774\ub098 \uc784\uc758\uc758 \ucf54\ub4dc \ube14\ub85d\uc744 \uc2e4\ud589\ud558\uba74\uc11c \uac01 \ud568\uc218\uc5d0\uc11c \uc18c\ubaa8\ub41c \uc2dc\uac04\uc744 \uacc4\uc18d \uae30\ub85d\n", "- \uba85\ub839\ud589\uc5d0\uc11c cProfile\uc744 \uc0ac\uc6a9\ud558\ub294 \uc77c\ubc18\uc801\uc778 \ubc29\ubc95\uc740 \ud504\ub85c\uadf8\ub7a8 \uc804\uccb4\ub97c \uc2e4\ud589\ud558\uace0 \uac01 \ud568\uc218\ubcc4\ub85c \uc218\uc9d1\ub41c \uc2dc\uac04 \uc815\ubcf4\ub97c \ucd9c\ub825\ud558\ub294 \ubc29\uc2dd" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%writefile ch03/cprof_example.py\n", "\n", "import numpy as np\n", "from numpy.linalg import eigvals\n", "\n", "def run_experiment(niter=100):\n", " K = 100\n", " results = []\n", " for _ in xrange(niter):\n", " mat = np.random.randn(K, K)\n", " max_eigenvalue = np.abs(eigvals(mat)).max()\n", " results.append(max_eigenvalue)\n", " return results\n", "some_results = run_experiment()\n", "print 'Largest one we saw: %s' % np.max(some_results)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Overwriting ch03/cprof_example.py\n" ] } ], "prompt_number": 82 }, { "cell_type": "code", "collapsed": false, "input": [ "def run_experiment(niter=100):\n", " K = 100\n", " results = []\n", " for _ in xrange(niter):\n", " mat = np.random.randn(K, K)\n", " max_eigenvalue = np.abs(eigvals(mat)).max()\n", " results.append(max_eigenvalue)\n", " return results" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 83 }, { "cell_type": "code", "collapsed": false, "input": [ "!python -m cProfile -s cumulative ch03/cprof_example.py" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Largest one we saw: 11.7134449573\r\n", " 14452 function calls (14364 primitive calls) in 0.866 seconds\r\n", "\r\n", " Ordered by: cumulative time\r\n", "\r\n", " ncalls tottime percall cumtime percall filename:lineno(function)\r\n", " 1 0.001 0.001 0.868 0.868 cprof_example.py:2()\r\n", " 1 0.002 0.002 0.715 0.715 cprof_example.py:5(run_experiment)\r\n", " 100 0.661 0.007 0.673 0.007 linalg.py:819(eigvals)\r\n", " 1 0.015 0.015 0.152 0.152 __init__.py:106()\r\n", " 3 0.026 0.009 0.128 0.043 __init__.py:1()\r\n", " 1 0.001 0.001 0.086 0.086 add_newdocs.py:10()\r\n", " 1 0.001 0.001 0.050 0.050 type_check.py:3()\r\n", " 100 0.039 0.000 0.039 0.000 {method 'randn' of 'mtrand.RandomState' objects}\r\n", " 1 0.005 0.005 0.031 0.031 __init__.py:15()\r\n", " 1 0.002 0.002 0.017 0.017 __init__.py:7()\r\n", " 1 0.007 0.007 0.015 0.015 numeric.py:1()\r\n", " 1 0.003 0.003 0.014 0.014 __init__.py:45()\r\n", " 275 0.006 0.000 0.008 0.000 function_base.py:2940(add_newdoc)\r\n", " 1 0.006 0.006 0.007 0.007 __init__.py:88()\r\n", " 1 0.005 0.005 0.006 0.006 __init__.py:38()\r\n", " 1 0.004 0.004 0.006 0.006 npyio.py:1()\r\n", " 1 0.002 0.002 0.006 0.006 index_tricks.py:1()\r\n", " 1 0.005 0.005 0.005 0.005 polynomial.py:55()\r\n", " 1 0.003 0.003 0.005 0.005 collections.py:1()\r\n", " 1 0.004 0.004 0.005 0.005 legendre.py:83()\r\n", " 1 0.002 0.002 0.005 0.005 ctypeslib.py:51()\r\n", " 1 0.004 0.004 0.004 0.004 chebyshev.py:87()\r\n", " 1 0.003 0.003 0.004 0.004 case.py:1()\r\n", " 301 0.004 0.000 0.004 0.000 {method 'reduce' of 'numpy.ufunc' objects}\r\n", " 100 0.003 0.000 0.004 0.000 linalg.py:214(_assertFinite)\r\n", " 1 0.003 0.003 0.004 0.004 laguerre.py:59()\r\n", " 200 0.000 0.000 0.004 0.000 {method 'all' of 'numpy.ndarray' objects}\r\n", " 1 0.003 0.003 0.004 0.004 hermite.py:59()\r\n", " 6 0.000 0.000 0.004 0.001 string.py:148(substitute)\r\n", " 1 0.003 0.003 0.004 0.004 hermite_e.py:59()\r\n", " 6 0.003 0.000 0.004 0.001 {method 'sub' of '_sre.SRE_Pattern' objects}\r\n", " 100 0.000 0.000 0.003 0.000 fromnumeric.py:1837(all)\r\n", " 200 0.000 0.000 0.003 0.000 _methods.py:35(_all)\r\n", " 1 0.000 0.000 0.003 0.003 polynomial.py:4()\r\n", " 13 0.000 0.000 0.003 0.000 re.py:188(compile)\r\n", " 13 0.000 0.000 0.003 0.000 re.py:226(_compile)\r\n", " 1 0.003 0.003 0.003 0.003 __init__.py:4()\r\n", " 1 0.000 0.000 0.003 0.003 _internal.py:6()\r\n", " 11 0.000 0.000 0.003 0.000 sre_compile.py:496(compile)\r\n", " 1 0.002 0.002 0.003 0.003 result.py:1()\r\n", " 2 0.002 0.001 0.002 0.001 function_base.py:1()\r\n", " 1 0.001 0.001 0.002 0.002 __init__.py:44()\r\n", " 1 0.001 0.001 0.002 0.002 main.py:1()\r\n", " 1 0.001 0.001 0.002 0.002 _datasource.py:33()\r\n", " 1 0.002 0.002 0.002 0.002 arrayprint.py:5()\r\n", " 1 0.002 0.002 0.002 0.002 heapq.py:31()\r\n", " 1 0.002 0.002 0.002 0.002 runner.py:1()\r\n", " 1 0.000 0.000 0.002 0.002 numerictypes.py:82()\r\n", " 1 0.001 0.001 0.002 0.002 core.py:21()\r\n", " 2 0.001 0.001 0.002 0.001 collections.py:282(namedtuple)\r\n", " 11 0.000 0.000 0.001 0.000 sre_parse.py:676(parse)\r\n", " 11 0.000 0.000 0.001 0.000 sre_compile.py:481(_code)\r\n", " 17/11 0.000 0.000 0.001 0.000 sre_parse.py:302(_parse_sub)\r\n", " 100 0.000 0.000 0.001 0.000 {method 'max' of 'numpy.ndarray' objects}\r\n", " 1 0.001 0.001 0.001 0.001 linalg.py:10()\r\n", " 17/11 0.001 0.000 0.001 0.000 sre_parse.py:380(_parse)\r\n", " 1 0.001 0.001 0.001 0.001 __init__.py:10()\r\n", " 101 0.000 0.000 0.001 0.000 _methods.py:15(_amax)\r\n", " 1 0.000 0.000 0.001 0.001 difflib.py:29()\r\n", " 1 0.001 0.001 0.001 0.001 __init__.py:3()\r\n", " 38/11 0.000 0.000 0.001 0.000 sre_compile.py:33(_compile)\r\n", " 1 0.001 0.001 0.001 0.001 shutil.py:5()\r\n", " 1 0.001 0.001 0.001 0.001 loader.py:1()\r\n", " 100 0.001 0.000 0.001 0.000 linalg.py:139(_commonType)\r\n", " 300 0.000 0.000 0.001 0.000 linalg.py:111(isComplexType)\r\n", " 100 0.000 0.000 0.001 0.000 numeric.py:462(asanyarray)\r\n", " 1 0.000 0.000 0.001 0.001 util.py:1()\r\n", " 3 0.000 0.000 0.001 0.000 warnings.py:45(filterwarnings)\r\n", " 238 0.001 0.000 0.001 0.000 {numpy.core.multiarray.array}\r\n", " 1 0.001 0.001 0.001 0.001 utils.py:4()\r\n", " 100 0.001 0.000 0.001 0.000 {method 'astype' of 'numpy.ndarray' objects}\r\n", " 1 0.001 0.001 0.001 0.001 fromnumeric.py:3()\r\n", " 666 0.001 0.000 0.001 0.000 string.py:158(convert)\r\n", " 40 0.000 0.000 0.001 0.000 core.py:109(get_object_signature)\r\n", " 100 0.000 0.000 0.001 0.000 linalg.py:106(_makearray)\r\n", " 15 0.000 0.000 0.001 0.000 sre_compile.py:179(_compile_charset)\r\n", " 1 0.000 0.000 0.001 0.001 numerictypes.py:304(_add_aliases)\r\n", " 429 0.001 0.000 0.001 0.000 {issubclass}\r\n", " 15 0.000 0.000 0.000 0.000 sre_compile.py:208(_optimize_charset)\r\n", " 23 0.000 0.000 0.000 0.000 core.py:5983(__init__)\r\n", " 23 0.000 0.000 0.000 0.000 core.py:5988(getdoc)\r\n", " 1 0.000 0.000 0.000 0.000 utils.py:1()\r\n", " 1 0.000 0.000 0.000 0.000 fftpack.py:32()\r\n", " 100 0.000 0.000 0.000 0.000 linalg.py:209(_assertNdSquareness)\r\n", " 100 0.000 0.000 0.000 0.000 linalg.py:101(get_linalg_error_extobj)\r\n", " 243 0.000 0.000 0.000 0.000 sre_parse.py:202(get)\r\n", " 11 0.000 0.000 0.000 0.000 sre_compile.py:362(_compile_info)\r\n", " 285 0.000 0.000 0.000 0.000 sre_parse.py:183(__next)\r\n", " 932 0.000 0.000 0.000 0.000 {isinstance}\r\n", " 509 0.000 0.000 0.000 0.000 {getattr}\r\n", " 1 0.000 0.000 0.000 0.000 defmatrix.py:1()\r\n", " 1 0.000 0.000 0.000 0.000 extras.py:10()\r\n", " 40 0.000 0.000 0.000 0.000 _inspect.py:120(getargspec)\r\n", " 100 0.000 0.000 0.000 0.000 numeric.py:392(asarray)\r\n", " 100 0.000 0.000 0.000 0.000 linalg.py:219(_assertNoEmpty2d)\r\n", " 26 0.000 0.000 0.000 0.000 numerictypes.py:232(bitname)\r\n", " 59/32 0.000 0.000 0.000 0.000 sre_parse.py:141(getwidth)\r\n", " 31 0.000 0.000 0.000 0.000 _inspect.py:159(formatargspec)\r\n", " 1 0.000 0.000 0.000 0.000 _iotools.py:3()\r\n", " 19 0.000 0.000 0.000 0.000 nosetester.py:140(__init__)\r\n", " 3 0.000 0.000 0.000 0.000 numeric.py:346(extend_all)\r\n", " 100 0.000 0.000 0.000 0.000 linalg.py:198(_assertRankAtLeast2)\r\n", " 272 0.000 0.000 0.000 0.000 {method 'strip' of 'str' objects}\r\n", " 100 0.000 0.000 0.000 0.000 linalg.py:127(_complexType)\r\n", " 4 0.000 0.000 0.000 0.000 sre_compile.py:259(_mk_bitmap)\r\n", " 1429 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects}\r\n", " 1 0.000 0.000 0.000 0.000 case.py:133(TestCase)\r\n", " 1 0.000 0.000 0.000 0.000 polyutils.py:33()\r\n", " 145 0.000 0.000 0.000 0.000 sre_parse.py:131(__getitem__)\r\n", " 9 0.000 0.000 0.000 0.000 extras.py:241(__init__)\r\n", " 9 0.000 0.000 0.000 0.000 extras.py:245(getdoc)\r\n", " 272 0.000 0.000 0.000 0.000 {numpy.lib._compiled_base.add_docstring}\r\n", " 8 0.000 0.000 0.000 0.000 core.py:7190(__init__)\r\n", " 27 0.000 0.000 0.000 0.000 core.py:822(__init__)\r\n", " 31 0.000 0.000 0.000 0.000 _inspect.py:61(getargs)\r\n", " 1 0.000 0.000 0.000 0.000 numerictypes.py:458(_set_array_types)\r\n", " 1 0.000 0.000 0.000 0.000 numerictypes.py:288(_add_types)\r\n", " 8 0.000 0.000 0.000 0.000 core.py:7195(getdoc)\r\n", "1031/1009 0.000 0.000 0.000 0.000 {len}\r\n", " 100 0.000 0.000 0.000 0.000 {max}\r\n", " 1 0.000 0.000 0.000 0.000 records.py:36()\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:265(_reset_cache)\r\n", " 906 0.000 0.000 0.000 0.000 {method 'group' of '_sre.SRE_Match' objects}\r\n", " 100 0.000 0.000 0.000 0.000 linalg.py:124(_realType)\r\n", " 19 0.000 0.000 0.000 0.000 posixpath.py:127(dirname)\r\n", " 273 0.000 0.000 0.000 0.000 {method 'get' of 'dict' objects}\r\n", " 1 0.000 0.000 0.000 0.000 defchararray.py:17()\r\n", " 1 0.000 0.000 0.000 0.000 :2()\r\n", " 1 0.000 0.000 0.000 0.000 signals.py:1()\r\n", " 1 0.000 0.000 0.000 0.000 suite.py:1()\r\n", " 8 0.000 0.000 0.000 0.000 {all}\r\n", " 512 0.000 0.000 0.000 0.000 {chr}\r\n", " 51 0.000 0.000 0.000 0.000 {method 'join' of 'str' objects}\r\n", " 46 0.000 0.000 0.000 0.000 collections.py:323()\r\n", " 1 0.000 0.000 0.000 0.000 _endian.py:4()\r\n", " 30 0.000 0.000 0.000 0.000 numerictypes.py:450(_add_array_type)\r\n", " 3 0.000 0.000 0.000 0.000 __init__.py:78(CFUNCTYPE)\r\n", " 1 0.000 0.000 0.000 0.000 numerictypes.py:345(_add_integer_aliases)\r\n", " 1 0.000 0.000 0.000 0.000 numerictypes.py:787(_construct_lookups)\r\n", " 21 0.000 0.000 0.000 0.000 numerictypes.py:219(_evalname)\r\n", " 1 0.000 0.000 0.000 0.000 arrayterator.py:9()\r\n", " 18 0.000 0.000 0.000 0.000 core.py:902(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 memmap.py:1()\r\n", " 1 0.000 0.000 0.000 0.000 core.py:2563(MaskedArray)\r\n", " 14 0.000 0.000 0.000 0.000 __init__.py:147(_check_size)\r\n", " 112 0.000 0.000 0.000 0.000 sre_parse.py:196(match)\r\n", " 1 0.000 0.000 0.000 0.000 _import_tools.py:1()\r\n", " 115 0.000 0.000 0.000 0.000 sre_parse.py:139(append)\r\n", " 72 0.000 0.000 0.000 0.000 numerictypes.py:130(english_lower)\r\n", " 3 0.000 0.000 0.000 0.000 __init__.py:493(PYFUNCTYPE)\r\n", " 1 0.000 0.000 0.000 0.000 scimath.py:17()\r\n", " 176 0.000 0.000 0.000 0.000 {min}\r\n", " 40 0.000 0.000 0.000 0.000 _inspect.py:15(ismethod)\r\n", " 1 0.000 0.000 0.000 0.000 getlimits.py:3()\r\n", " 1 0.000 0.000 0.000 0.000 nanfunctions.py:20()\r\n", " 21 0.000 0.000 0.000 0.000 sre_compile.py:355(_simple)\r\n", " 1 0.000 0.000 0.000 0.000 machar.py:7()\r\n", " 74 0.000 0.000 0.000 0.000 _inspect.py:152(strseq)\r\n", " 1 0.000 0.000 0.000 0.000 linalg.py:76(_determine_error_states)\r\n", " 12 0.000 0.000 0.000 0.000 ctypeslib.py:303(prep_simple)\r\n", " 11 0.000 0.000 0.000 0.000 sre_parse.py:179(__init__)\r\n", " 2 0.000 0.000 0.000 0.000 shape_base.py:1()\r\n", " 14 0.000 0.000 0.000 0.000 {method 'format' of 'str' objects}\r\n", " 2 0.000 0.000 0.000 0.000 {_ctypes.POINTER}\r\n", " 1 0.000 0.000 0.000 0.000 nosetester.py:6()\r\n", " 1 0.000 0.000 0.000 0.000 fromnumeric.py:2043(amax)\r\n", " 1 0.000 0.000 0.000 0.000 numerictypes.py:435(_construct_char_code_lookup)\r\n", " 1 0.000 0.000 0.000 0.000 numpytest.py:1()\r\n", " 1 0.000 0.000 0.000 0.000 result.py:26(TestResult)\r\n", " 75 0.000 0.000 0.000 0.000 {range}\r\n", " 2 0.000 0.000 0.000 0.000 utils.py:152(deprecate)\r\n", " 1 0.000 0.000 0.000 0.000 :7(Laguerre)\r\n", " 3 0.000 0.000 0.000 0.000 result.py:14(failfast)\r\n", " 91 0.000 0.000 0.000 0.000 {_sre.getlower}\r\n", " 85 0.000 0.000 0.000 0.000 sre_parse.py:127(__len__)\r\n", " 1 0.000 0.000 0.000 0.000 arraypad.py:5()\r\n", " 21 0.000 0.000 0.000 0.000 {numpy.core.multiarray.empty}\r\n", " 1 0.000 0.000 0.000 0.000 stride_tricks.py:7()\r\n", " 40 0.000 0.000 0.000 0.000 numerictypes.py:157(english_upper)\r\n", " 1 0.000 0.000 0.000 0.000 defchararray.py:1668(chararray)\r\n", " 112 0.000 0.000 0.000 0.000 {method 'translate' of 'str' objects}\r\n", " 14 0.000 0.000 0.000 0.000 numerictypes.py:184(english_capitalize)\r\n", " 1 0.000 0.000 0.000 0.000 _methods.py:5()\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:349(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 numerictypes.py:386(_set_up_aliases)\r\n", " 6 0.000 0.000 0.000 0.000 core.py:1046(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 _iotools.py:466(StringConverter)\r\n", " 1 0.000 0.000 0.000 0.000 format.py:136()\r\n", " 1 0.000 0.000 0.000 0.000 :7(Legendre)\r\n", " 1 0.000 0.000 0.000 0.000 :7(Polynomial)\r\n", " 8 0.000 0.000 0.000 0.000 collections.py:349()\r\n", " 124 0.000 0.000 0.000 0.000 {method 'startswith' of 'str' objects}\r\n", " 1 0.000 0.000 0.000 0.000 :7(HermiteE)\r\n", " 11 0.000 0.000 0.000 0.000 {_sre.compile}\r\n", " 1 0.000 0.000 0.000 0.000 :7(Hermite)\r\n", " 2 0.000 0.000 0.000 0.000 utils.py:108(__call__)\r\n", " 1 0.000 0.000 0.000 0.000 :7(Chebyshev)\r\n", " 43 0.000 0.000 0.000 0.000 _inspect.py:163()\r\n", " 3 0.000 0.000 0.000 0.000 functools.py:17(update_wrapper)\r\n", " 38 0.000 0.000 0.000 0.000 sre_parse.py:91(__init__)\r\n", " 9 0.000 0.000 0.000 0.000 core.py:2419(__init__)\r\n", " 11 0.000 0.000 0.000 0.000 sre_parse.py:258(_escape)\r\n", " 1 0.000 0.000 0.000 0.000 _inspect.py:7()\r\n", " 19 0.000 0.000 0.000 0.000 {method 'rfind' of 'str' objects}\r\n", " 22 0.000 0.000 0.000 0.000 sre_compile.py:475(isstring)\r\n", " 1 0.000 0.000 0.000 0.000 __future__.py:48()\r\n", " 1 0.000 0.000 0.000 0.000 pprint.py:35()\r\n", " 17 0.000 0.000 0.000 0.000 {method 'keys' of 'dict' objects}\r\n", " 1 0.000 0.000 0.000 0.000 StringIO.py:30()\r\n", " 4 0.000 0.000 0.000 0.000 sre_parse.py:217(isname)\r\n", " 40 0.000 0.000 0.000 0.000 _inspect.py:26(isfunction)\r\n", " 1 0.000 0.000 0.000 0.000 twodim_base.py:3()\r\n", " 1 0.000 0.000 0.000 0.000 financial.py:10()\r\n", " 18 0.000 0.000 0.000 0.000 {_struct.calcsize}\r\n", " 126 0.000 0.000 0.000 0.000 {ord}\r\n", " 45 0.000 0.000 0.000 0.000 {repr}\r\n", " 2 0.000 0.000 0.000 0.000 numeric.py:2320(seterr)\r\n", " 1 0.000 0.000 0.000 0.000 defmatrix.py:206(matrix)\r\n", " 1 0.000 0.000 0.000 0.000 collections.py:26(OrderedDict)\r\n", " 2 0.000 0.000 0.000 0.000 getlimits.py:244(__init__)\r\n", " 15 0.000 0.000 0.000 0.000 sre_compile.py:52(fixup)\r\n", " 1 0.000 0.000 0.000 0.000 numeric.py:2705(__enter__)\r\n", " 1 0.000 0.000 0.000 0.000 numeric.py:2716(_setdef)\r\n", " 1 0.000 0.000 0.000 0.000 polytemplate.py:11()\r\n", " 1 0.000 0.000 0.000 0.000 {posix.uname}\r\n", " 9 0.000 0.000 0.000 0.000 core.py:2425(getdoc)\r\n", " 21 0.000 0.000 0.000 0.000 {sys._getframe}\r\n", " 3 0.000 0.000 0.000 0.000 {numpy.core.umath.seterrobj}\r\n", " 18 0.000 0.000 0.000 0.000 {method 'extend' of 'list' objects}\r\n", " 2 0.000 0.000 0.000 0.000 numeric.py:1617(set_string_function)\r\n", " 38 0.000 0.000 0.000 0.000 {method 'isalnum' of 'str' objects}\r\n", " 19 0.000 0.000 0.000 0.000 {method 'rstrip' of 'str' objects}\r\n", " 8 0.000 0.000 0.000 0.000 collections.py:347()\r\n", " 31 0.000 0.000 0.000 0.000 _inspect.py:39(iscode)\r\n", " 1 0.000 0.000 0.000 0.000 py3k.py:4()\r\n", " 1 0.000 0.000 0.000 0.000 helper.py:4()\r\n", " 1 0.000 0.000 0.000 0.000 arraysetops.py:26()\r\n", " 1 0.000 0.000 0.000 0.000 keyword.py:11()\r\n", " 1 0.000 0.000 0.000 0.000 decorators.py:15()\r\n", " 2 0.000 0.000 0.000 0.000 getlimits.py:269(max)\r\n", " 1 0.000 0.000 0.000 0.000 _internal.py:196(_getintp_ctype)\r\n", " 1 0.000 0.000 0.000 0.000 info.py:176()\r\n", " 5 0.000 0.000 0.000 0.000 sre_parse.py:73(opengroup)\r\n", " 9 0.000 0.000 0.000 0.000 {method 'update' of 'dict' objects}\r\n", " 1 0.000 0.000 0.000 0.000 info.py:147()\r\n", " 1 0.000 0.000 0.000 0.000 :1(Mismatch)\r\n", " 11 0.000 0.000 0.000 0.000 sre_parse.py:68(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 polynomial.py:930(poly1d)\r\n", " 1 0.000 0.000 0.000 0.000 :1(Match)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5758(__new__)\r\n", " 2 0.000 0.000 0.000 0.000 {numpy.core.multiarray.set_string_function}\r\n", " 1 0.000 0.000 0.000 0.000 info.py:84()\r\n", " 1 0.000 0.000 0.000 0.000 extras.py:1501(__init__)\r\n", " 13 0.000 0.000 0.000 0.000 {method 'items' of 'dict' objects}\r\n", " 50 0.000 0.000 0.000 0.000 {_ctypes.sizeof}\r\n", " 21 0.000 0.000 0.000 0.000 sre_parse.py:135(__setitem__)\r\n", " 1 0.000 0.000 0.000 0.000 _iotools.py:246(NameValidator)\r\n", " 1 0.000 0.000 0.000 0.000 ufunclike.py:5()\r\n", " 2 0.000 0.000 0.000 0.000 numeric.py:2416(geterr)\r\n", " 3 0.000 0.000 0.000 0.000 index_tricks.py:231(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 copy_reg.py:14(pickle)\r\n", " 2 0.000 0.000 0.000 0.000 {map}\r\n", " 5 0.000 0.000 0.000 0.000 sre_parse.py:84(closegroup)\r\n", " 1 0.000 0.000 0.000 0.000 info.py:83()\r\n", " 1 0.000 0.000 0.000 0.000 extras.py:1431(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 {method 'view' of 'numpy.ndarray' objects}\r\n", " 1 0.000 0.000 0.000 0.000 getlimits.py:194(iinfo)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5752(MaskedConstant)\r\n", " 1 0.000 0.000 0.000 0.000 numeric.py:2701(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 numeric.py:2710(__exit__)\r\n", " 1 0.000 0.000 0.000 0.000 _internal.py:224(_ctypes)\r\n", " 4 0.000 0.000 0.000 0.000 {method 'replace' of 'str' objects}\r\n", " 1 0.000 0.000 0.000 0.000 npyio.py:90(BagObj)\r\n", " 1 0.000 0.000 0.000 0.000 _datasource.py:49(_FileOpeners)\r\n", " 1 0.000 0.000 0.000 0.000 arrayterator.py:21(Arrayterator)\r\n", " 1 0.000 0.000 0.000 0.000 utils.py:957(SafeEval)\r\n", " 1 0.000 0.000 0.000 0.000 nosetester.py:88(NoseTester)\r\n", " 1 0.000 0.000 0.000 0.000 warnings.py:74(simplefilter)\r\n", " 1 0.000 0.000 0.000 0.000 warnings.py:339(__enter__)\r\n", " 4 0.000 0.000 0.000 0.000 core.py:92(doc_note)\r\n", " 1 0.000 0.000 0.000 0.000 records.py:286(recarray)\r\n", " 1 0.000 0.000 0.000 0.000 _import_tools.py:8(PackageLoader)\r\n", " 1 0.000 0.000 0.000 0.000 StringIO.py:42(StringIO)\r\n", " 3 0.000 0.000 0.000 0.000 functools.py:39(wraps)\r\n", " 1 0.000 0.000 0.000 0.000 info.py:34()\r\n", " 1 0.000 0.000 0.000 0.000 index_tricks.py:461(ndenumerate)\r\n", " 1 0.000 0.000 0.000 0.000 weakref.py:243(__init__)\r\n", " 24 0.000 0.000 0.000 0.000 sre_parse.py:211(isident)\r\n", " 1 0.000 0.000 0.000 0.000 npyio.py:133(NpzFile)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:2241(_MaskedPrintOption)\r\n", " 1 0.000 0.000 0.000 0.000 fnmatch.py:11()\r\n", " 67 0.000 0.000 0.000 0.000 {globals}\r\n", " 1 0.000 0.000 0.000 0.000 _datasource.py:150(DataSource)\r\n", " 1 0.000 0.000 0.000 0.000 runner.py:28(TextTestResult)\r\n", " 3 0.000 0.000 0.000 0.000 {method 'split' of 'str' objects}\r\n", " 1 0.000 0.000 0.000 0.000 numerictypes.py:772(_typedict)\r\n", " 1 0.000 0.000 0.000 0.000 {_ctypes.set_conversion_mode}\r\n", " 38 0.000 0.000 0.000 0.000 sre_compile.py:25(_identityfunction)\r\n", " 1 0.000 0.000 0.000 0.000 function_base.py:1405(vectorize)\r\n", " 1 0.000 0.000 0.000 0.000 suite.py:16(BaseTestSuite)\r\n", " 7 0.000 0.000 0.000 0.000 case.py:609(_deprecate)\r\n", " 1 0.000 0.000 0.000 0.000 index_tricks.py:434(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 warnings.py:318(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 collections.py:381(Counter)\r\n", " 1 0.000 0.000 0.000 0.000 UserDict.py:58(get)\r\n", " 1 0.000 0.000 0.000 0.000 index_tricks.py:456(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 _datasource.py:497(Repository)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5555(mvoid)\r\n", " 1 0.000 0.000 0.000 0.000 arrayprint.py:715(DatetimeFormat)\r\n", " 9 0.000 0.000 0.000 0.000 {setattr}\r\n", " 1 0.000 0.000 0.000 0.000 ctypeslib.py:150(_ndptr)\r\n", " 1 0.000 0.000 0.000 0.000 _iotools.py:155(LineSplitter)\r\n", " 1 0.000 0.000 0.000 0.000 case.py:1018(FunctionTestCase)\r\n", " 1 0.000 0.000 0.000 0.000 difflib.py:46(SequenceMatcher)\r\n", " 1 0.000 0.000 0.000 0.000 warnings.py:355(__exit__)\r\n", " 1 0.000 0.000 0.000 0.000 loader.py:38(TestLoader)\r\n", " 1 0.000 0.000 0.000 0.000 __config__.py:3()\r\n", " 1 0.000 0.000 0.000 0.000 difflib.py:1672(HtmlDiff)\r\n", " 1 0.000 0.000 0.000 0.000 :1()\r\n", " 4 0.000 0.000 0.000 0.000 {method 'insert' of 'list' objects}\r\n", " 6 0.000 0.000 0.000 0.000 core.py:769(__init__)\r\n", " 8 0.000 0.000 0.000 0.000 {method '__contains__' of 'frozenset' objects}\r\n", " 1 0.000 0.000 0.000 0.000 utils.py:1398(WarningManager)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5919(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 version.py:3()\r\n", " 2 0.000 0.000 0.000 0.000 utils.py:103(__init__)\r\n", " 3 0.000 0.000 0.000 0.000 __init__.py:494(CFunctionType)\r\n", " 1 0.000 0.000 0.000 0.000 pprint.py:84(PrettyPrinter)\r\n", " 1 0.000 0.000 0.000 0.000 runner.py:119(TextTestRunner)\r\n", " 1 0.000 0.000 0.000 0.000 __future__.py:74(_Feature)\r\n", " 1 0.000 0.000 0.000 0.000 _datasource.py:72(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 arrayprint.py:532(FloatFormat)\r\n", " 7 0.000 0.000 0.000 0.000 {method 'pop' of 'dict' objects}\r\n", " 1 0.000 0.000 0.000 0.000 records.py:85(format_parser)\r\n", " 1 0.000 0.000 0.000 0.000 main.py:63(TestProgram)\r\n", " 2 0.000 0.000 0.000 0.000 sre_parse.py:214(isdigit)\r\n", " 6 0.000 0.000 0.000 0.000 {numpy.core.umath.geterrobj}\r\n", " 2 0.000 0.000 0.000 0.000 index_tricks.py:626(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 index_tricks.py:213(AxisConcatenator)\r\n", " 1 0.000 0.000 0.000 0.000 arrayprint.py:658(LongFloatFormat)\r\n", " 3 0.000 0.000 0.000 0.000 __init__.py:104(CFunctionType)\r\n", " 1 0.000 0.000 0.000 0.000 {zip}\r\n", " 1 0.000 0.000 0.000 0.000 records.py:216(record)\r\n", " 1 0.000 0.000 0.000 0.000 difflib.py:766(Differ)\r\n", " 4 0.000 0.000 0.000 0.000 core.py:2432(__get__)\r\n", " 1 0.000 0.000 0.000 0.000 memmap.py:23(memmap)\r\n", " 1 0.000 0.000 0.000 0.000 {_ctypes.dlopen}\r\n", " 1 0.000 0.000 0.000 0.000 index_tricks.py:85(nd_grid)\r\n", " 1 0.000 0.000 0.000 0.000 machar.py:17(MachAr)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5931(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:332(CDLL)\r\n", " 1 0.000 0.000 0.000 0.000 arrayprint.py:743(TimedeltaFormat)\r\n", " 1 0.000 0.000 0.000 0.000 polyutils.py:48(RankWarning)\r\n", " 1 0.000 0.000 0.000 0.000 {numpy.core.multiarray.set_typeDict}\r\n", " 1 0.000 0.000 0.000 0.000 stride_tricks.py:14(DummyArray)\r\n", " 1 0.000 0.000 0.000 0.000 getlimits.py:24(finfo)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5973(_frommethod)\r\n", " 1 0.000 0.000 0.000 0.000 suite.py:252(_ErrorHolder)\r\n", " 1 0.000 0.000 0.000 0.000 arrayprint.py:688(LongComplexFormat)\r\n", " 1 0.000 0.000 0.000 0.000 case.py:45(_UnexpectedSuccess)\r\n", " 3 0.000 0.000 0.000 0.000 core.py:784(__init__)\r\n", " 2 0.000 0.000 0.000 0.000 index_tricks.py:145(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 numeric.py:2639(errstate)\r\n", " 1 0.000 0.000 0.000 0.000 utils.py:1366(WarningMessage)\r\n", " 1 0.000 0.000 0.000 0.000 shutil.py:34(SpecialFileError)\r\n", " 1 0.000 0.000 0.000 0.000 _iotools.py:438(ConverterError)\r\n", " 1 0.000 0.000 0.000 0.000 extras.py:224(_fromnxfunction)\r\n", " 1 0.000 0.000 0.000 0.000 signals.py:9(_InterruptHandler)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:243(c_char_p)\r\n", " 1 0.000 0.000 0.000 0.000 string.py:131(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:233(c_byte)\r\n", " 1 0.000 0.000 0.000 0.000 index_tricks.py:439(CClass)\r\n", " 1 0.000 0.000 0.000 0.000 nanfunctions.py:31(NanWarning)\r\n", " 1 0.000 0.000 0.000 0.000 index_tricks.py:510(ndindex)\r\n", " 2 0.000 0.000 0.000 0.000 {hasattr}\r\n", " 1 0.000 0.000 0.000 0.000 runner.py:12(_WritelnDecorator)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:7178(_convert2ma)\r\n", " 1 0.000 0.000 0.000 0.000 linalg.py:43(LinAlgError)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:428(LibraryLoader)\r\n", " 1 0.000 0.000 0.000 0.000 case.py:98(_AssertRaisesContext)\r\n", " 1 0.000 0.000 0.000 0.000 UserDict.py:70(__contains__)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:159(py_object)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:112(ModuleDeprecationWarning)\r\n", " 1 0.000 0.000 0.000 0.000 case.py:25(SkipTest)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:883(_MaskedBinaryOperation)\r\n", " 1 0.000 0.000 0.000 0.000 _iotools.py:445(ConverterLockError)\r\n", " 2 0.000 0.000 0.000 0.000 utils.py:87(_set_function_name)\r\n", " 1 0.000 0.000 0.000 0.000 copy_reg.py:27(constructor)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:782(_DomainGreater)\r\n", " 1 0.000 0.000 0.000 0.000 suite.py:78(TestSuite)\r\n", " 7 0.000 0.000 0.000 0.000 __future__.py:75(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:260(c_bool)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:388(PyDLL)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:193(c_uint)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:255(c_void_p)\r\n", " 1 0.000 0.000 0.000 0.000 index_tricks.py:583(IndexExpression)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:359(_FuncPtr)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5917(_minimum_operation)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:238(c_char)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:767(_DomainSafeDivide)\r\n", " 1 0.000 0.000 0.000 0.000 _endian.py:49(BigEndianStructure)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:1026(_DomainedBinaryOperation)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:2390(_arraymethod)\r\n", " 1 0.000 0.000 0.000 0.000 numeric.py:49(ComplexWarning)\r\n", " 1 0.000 0.000 0.000 0.000 arrayprint.py:699(ComplexFormat)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:729(_DomainCheckInterval)\r\n", " 1 0.000 0.000 0.000 0.000 shutil.py:31(Error)\r\n", " 2 0.000 0.000 0.000 0.000 __init__.py:429(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:128(MAError)\r\n", " 1 0.000 0.000 0.000 0.000 _internal.py:217(_missing_ctypes)\r\n", " 3 0.000 0.000 0.000 0.000 _inspect.py:161()\r\n", " 1 0.000 0.000 0.000 0.000 suite.py:299(_DebugResult)\r\n", " 1 0.000 0.000 0.000 0.000 case.py:34(_ExpectedFailure)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:2460(MaskedIterator)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5862(_extrema_operation)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:205(c_longdouble)\r\n", " 1 0.000 0.000 0.000 0.000 _import_tools.py:336(PackageLoaderDebug)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:131(MaskError)\r\n", " 1 0.000 0.000 0.000 0.000 shutil.py:38(ExecError)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:291(c_wchar_p)\r\n", " 1 0.000 0.000 0.000 0.000 polyutils.py:52(PolyError)\r\n", " 2 0.000 0.000 0.000 0.000 core.py:796(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:294(c_wchar)\r\n", " 1 0.000 0.000 0.000 0.000 utils.py:1581(IgnoreException)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:226(c_ubyte)\r\n", " 1 0.000 0.000 0.000 0.000 index_tricks.py:340(RClass)\r\n", " 1 0.000 0.000 0.000 0.000 polynomial.py:21(RankWarning)\r\n", " 1 0.000 0.000 0.000 0.000 numeric.py:2635(_unspecified)\r\n", " 1 0.000 0.000 0.000 0.000 polyutils.py:69(PolyBase)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:805(_MaskedUnaryOperation)\r\n", " 2 0.000 0.000 0.000 0.000 {method 'clear' of 'dict' objects}\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:197(c_float)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:172(c_ushort)\r\n", " 1 0.000 0.000 0.000 0.000 _iotools.py:452(ConversionWarning)\r\n", " 8 0.000 0.000 0.000 0.000 {method 'isdigit' of 'str' objects}\r\n", " 1 0.000 0.000 0.000 0.000 core.py:751(_DomainTan)\r\n", " 6 0.000 0.000 0.000 0.000 {method 'add' of 'set' objects}\r\n", " 1 0.000 0.000 0.000 0.000 core.py:2246(__init__)\r\n", " 3 0.000 0.000 0.000 0.000 core.py:737(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 _inspect.py:162()\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:168(c_short)\r\n", " 1 0.000 0.000 0.000 0.000 utils.py:92(_Deprecate)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:757(__init__)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:201(c_double)\r\n", " 1 0.000 0.000 0.000 0.000 polyutils.py:56(PolyDomainError)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:189(c_int)\r\n", " 1 0.000 0.000 0.000 0.000 _endian.py:26(_swapped_meta)\r\n", " 1 0.000 0.000 0.000 0.000 extras.py:1485(mr_class)\r\n", " 1 0.000 0.000 0.000 0.000 arrayprint.py:638(IntegerFormat)\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:180(c_ulong)\r\n", " 1 0.000 0.000 0.000 0.000 extras.py:1419(MAxisConcatenator)\r\n", " 5 0.000 0.000 0.000 0.000 {method 'remove' of 'list' objects}\r\n", " 1 0.000 0.000 0.000 0.000 __init__.py:176(c_long)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5761(__array_finalize__)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:794(_DomainGreaterEqual)\r\n", " 1 0.000 0.000 0.000 0.000 core.py:5929(_maximum_operation)\r\n", " 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}\r\n", "\r\n", "\r\n" ] } ], "prompt_number": 84 }, { "cell_type": "markdown", "metadata": {}, "source": [ "- \uc2e4\ud589\ud574\ubcf4\uba74 \ud568\uc218 \uc774\ub984 \uc21c\uc73c\ub85c \uc815\ub82c\ub41c \uacb0\uacfc \ucd9c\ub825\n", "- \uc5b4\ub514\uc5d0\uc11c \uac00\uc7a5 \ub9ce\uc740 \uc2dc\uac04\uc774 \uc18c\uc694\ub418\uc5c8\ub294\uc9c0 \uc54c\uae30 \uc704\ud574 -s \uc635\uc158\uc73c\ub85c \uc815\ub82c \uc21c\uc11c\ub97c \uc9c0\uc815\ud574\uc8fc\ub294 \uac83\uc774 \uc77c\ubc18\uc801\uc778 \ubc29\ubc95\n", "- cumtime \uc5f4\uc744 \ud6d1\uc5b4\ubcf4\uba74\uc11c \uac01 \ud568\uc218 \ub0b4\ubd80\uc5d0\uc11c \uc5bc\ub9c8\ub098 \ub9ce\uc740 \uc2dc\uac04\uc774 \uc18c\uc694\ub418\uc5c8\ub294\uc9c0 \ud655\uc778\n", "- \ub9cc\uc57d\uc5d0 \uc5b4\ub5a4 \ud568\uc218\uac00 \ub2e4\ub978 \ud568\uc218\ub97c \ud638\ucd9c\ud55c\ub2e4\uace0 \ud574\ub3c4 \uadf8 \ud568\uc218\uc5d0 \ub300\ud55c \uc2dc\uac04 \uce21\uc815\uc740 \uba48\ucd94\uc9c0 \uc54a\ub294\ub2e4\ub294 \uc810 \uae30\uc5b5\n", "- cProfile\uc740 \uac01 \ud568\uc218\uc758 \uc2dc\uc791\uacfc \ub05d \uc2dc\uac04\uc744 \uae30\ub85d\ud558\uc5ec \uc2dc\uac04 \uce21\uc815\n", "- cProfile\uc740 \ud504\ub85c\uadf8\ub7a8\uc744 \ub530\ub85c \uc2e4\ud589\ud558\uc9c0 \uc54a\uace0\ub3c4 \uc784\uc758\uc758 \ucf54\ub4dc \ube14\ub85d\uc744 \ud504\ub85c\uadf8\ub7a8\uc801\uc73c\ub85c \ud504\ub85c\ud30c\uc77c\ub9c1\ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\n", "- %prun \uba85\ub839\uacfc %run -p \uc635\uc158 \uc81c\uacf5\n", "- %prun\uc740 cProfile\uc5d0 \uc0ac\uc6a9\ud558\ub294 \uba85\ub839\ud589 \uc635\uc158\uc744 \uadf8\ub300\ub85c \ubc1b\uc544\uc11c .py \ud30c\uc77c \ub300\uc2e0 \uc784\uc758\uc758 \ud30c\uc774\uc36c \ubb38\uc7a5\uc744 \ud504\ub85c\ud30c\uc77c\ub9c1 \ud574\uc900\ub2e4." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%prun -l 7 -s cumulative run_experiment()" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " " ] } ], "prompt_number": 85 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

4003 function calls in 0.661 seconds\n",
      "\n",
      "   Ordered by: cumulative time\n",
      "   List reduced from 32 to 7 due to restriction <7>\n",
      "\n",
      "   ncalls  tottime  percall  cumtime  percall filename:lineno(function)\n",
      "        1    0.000    0.000    0.661    0.661 :1()\n",
      "        1    0.002    0.002    0.661    0.661 :4(run_experiment)\n",
      "      100    0.608    0.006    0.619    0.006 linalg.py:819(eigvals)\n",
      "      100    0.039    0.000    0.039    0.000 {method 'randn' of 'mtrand.RandomState' objects}\n",
      "      100    0.003    0.000    0.004    0.000 linalg.py:214(_assertFinite)\n",
      "      300    0.004    0.000    0.004    0.000 {method 'reduce' of 'numpy.ufunc' objects}\n",
      "      200    0.000    0.000    0.003    0.000 {method 'all' of 'numpy.ndarray' objects}"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "%run -p -s cumulative ch03/cprof_example.py"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Largest one we saw: 12.630078966\n",
        " "
       ]
      }
     ],
     "prompt_number": 86
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "    4072 function calls in 0.674 seconds\n",
      "\n",
      "       Ordered by: cumulative time\n",
      "\n",
      "       ncalls  tottime  percall  cumtime  percall filename:lineno(function)\n",
      "            1    0.000    0.000    0.674    0.674 :1()\n",
      "            1    0.000    0.000    0.674    0.674 interactiveshell.py:2496(safe_execfile)\n",
      "            1    0.000    0.000    0.668    0.668 py3compat.py:219(execfile)\n",
      "            1    0.001    0.001    0.667    0.667 {execfile}\n",
      "            1    0.000    0.000    0.666    0.666 cprof_example.py:1()\n",
      "            1    0.001    0.001    0.666    0.666 cprof_example.py:4(run_experiment)\n",
      "          100    0.618    0.006    0.627    0.006 linalg.py:819(eigvals)\n",
      "          100    0.037    0.000    0.037    0.000 {method 'randn' of 'mtrand.RandomState' objects}\n",
      "            1    0.006    0.006    0.006    0.006 posixpath.py:127(dirname)\n",
      "          100    0.003    0.000    0.004    0.000 linalg.py:214(_assertFinite)\n",
      "          301    0.003    0.000    0.003    0.000 {method 'reduce' of 'numpy.ufunc' objects}\n",
      "          200    0.000    0.000    0.003    0.000 {method 'all' of 'numpy.ndarray' objects}\n",
      "          200    0.000    0.000    0.003    0.000 _methods.py:35(_all)\n",
      "          100    0.000    0.000    0.002    0.000 fromnumeric.py:1837(all)\n",
      "          100    0.000    0.000    0.001    0.000 {method 'max' of 'numpy.ndarray' objects}\n",
      "          101    0.000    0.000    0.001    0.000 _methods.py:15(_amax)\n",
      "          100    0.000    0.000    0.001    0.000 linalg.py:139(_commonType)\n",
      "          100    0.000    0.000    0.001    0.000 linalg.py:106(_makearray)\n",
      "          300    0.000    0.000    0.001    0.000 linalg.py:111(isComplexType)\n",
      "          100    0.000    0.000    0.000    0.000 numeric.py:462(asanyarray)\n",
      "          200    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}\n",
      "          100    0.000    0.000    0.000    0.000 {method 'astype' of 'numpy.ndarray' objects}\n",
      "          400    0.000    0.000    0.000    0.000 {issubclass}\n",
      "          100    0.000    0.000    0.000    0.000 linalg.py:209(_assertNdSquareness)\n",
      "          100    0.000    0.000    0.000    0.000 linalg.py:101(get_linalg_error_extobj)\n",
      "          100    0.000    0.000    0.000    0.000 numeric.py:392(asarray)\n",
      "          100    0.000    0.000    0.000    0.000 linalg.py:219(_assertNoEmpty2d)\n",
      "          100    0.000    0.000    0.000    0.000 linalg.py:198(_assertRankAtLeast2)\n",
      "          100    0.000    0.000    0.000    0.000 linalg.py:127(_complexType)\n",
      "          100    0.000    0.000    0.000    0.000 linalg.py:124(_realType)\n",
      "          100    0.000    0.000    0.000    0.000 {max}\n",
      "          200    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}\n",
      "            1    0.000    0.000    0.000    0.000 syspathcontext.py:54(__init__)\n",
      "            1    0.000    0.000    0.000    0.000 posixpath.py:350(abspath)\n",
      "            1    0.000    0.000    0.000    0.000 fromnumeric.py:2043(amax)\n",
      "          100    0.000    0.000    0.000    0.000 {getattr}\n",
      "            2    0.000    0.000    0.000    0.000 iostream.py:189(write)\n",
      "          101    0.000    0.000    0.000    0.000 {len}\n",
      "          106    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}\n",
      "            1    0.000    0.000    0.000    0.000 syspathcontext.py:57(__enter__)\n",
      "            1    0.000    0.000    0.000    0.000 py3compat.py:30(cast_bytes)\n",
      "            1    0.000    0.000    0.000    0.000 posixpath.py:321(normpath)\n",
      "          100    0.000    0.000    0.000    0.000 {min}\n",
      "            1    0.000    0.000    0.000    0.000 {open}\n",
      "            1    0.000    0.000    0.000    0.000 py3compat.py:20(encode)\n",
      "            2    0.000    0.000    0.000    0.000 {method 'decode' of 'str' objects}\n",
      "            1    0.000    0.000    0.000    0.000 {posix.getcwdu}\n",
      "            2    0.000    0.000    0.000    0.000 {method 'encode' of 'unicode' objects}\n",
      "            2    0.000    0.000    0.000    0.000 utf_8.py:15(decode)\n",
      "            2    0.000    0.000    0.000    0.000 iostream.py:99(_check_mp_mode)\n",
      "            6    0.000    0.000    0.000    0.000 {isinstance}\n",
      "            2    0.000    0.000    0.000    0.000 {_codecs.utf_8_decode}\n",
      "            1    0.000    0.000    0.000    0.000 posixpath.py:68(join)\n",
      "            2    0.000    0.000    0.000    0.000 iostream.py:90(_is_master_process)\n",
      "            1    0.000    0.000    0.000    0.000 {method 'split' of 'unicode' objects}\n",
      "            5    0.000    0.000    0.000    0.000 {method 'startswith' of 'unicode' objects}\n",
      "            1    0.000    0.000    0.000    0.000 syspathcontext.py:64(__exit__)\n",
      "            2    0.000    0.000    0.000    0.000 {method 'write' of '_io.StringIO' objects}\n",
      "            1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'unicode' objects}\n",
      "            1    0.000    0.000    0.000    0.000 {method 'insert' of 'list' objects}\n",
      "            2    0.000    0.000    0.000    0.000 {method 'setdefault' of 'dict' objects}\n",
      "            1    0.000    0.000    0.000    0.000 posixpath.py:258(expanduser)\n",
      "            2    0.000    0.000    0.000    0.000 {time.time}\n",
      "            1    0.000    0.000    0.000    0.000 {sys.getdefaultencoding}\n",
      "            1    0.000    0.000    0.000    0.000 {method 'rfind' of 'unicode' objects}\n",
      "            1    0.000    0.000    0.000    0.000 {method 'join' of 'unicode' objects}\n",
      "            1    0.000    0.000    0.000    0.000 {method 'endswith' of 'unicode' objects}\n",
      "            2    0.000    0.000    0.000    0.000 {posix.getpid}\n",
      "            1    0.000    0.000    0.000    0.000 {method 'remove' of 'list' objects}\n",
      "            1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}\n",
      "            1    0.000    0.000    0.000    0.000 posixpath.py:59(isabs)\n",
      "            1    0.000    0.000    0.000    0.000 {sys.getfilesystemencoding}"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "- %prun\uc744 \uc0ac\uc6a9\ud55c \uac83\uacfc \ub3d9\uc77c\ud55c \uacb0\uacfc\ub97c \uc5bb\uc744 \uc218 \uc788\ub2e4.(\ubb3c\ub860 \uc77c\ubd80 \ubc14\ub010 \uac83\ub4e4\uc774 \uc788\uaca0\uc9c0\ub9cc \ud070 \ud2c0\uc5d0\uc11c\ub294 \ub3d9\uc77c\ud558\ub2e4)"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "### 3.4.4 \ud568\uc218\uc758 \uac01 \uc904\ub9c8\ub2e4 \ud504\ub85c\ud30c\uc77c\ub9c1\ud558\uae30\n",
      "\n",
      "- %prun\uc774\ub098 \ub2e4\ub978 cProfile \uae30\ubc18\uc758 \ud504\ub85c\ud30c\uc77c\ub9c1 \uae30\ubc95\uc744 \ud1b5\ud574 \uc5bb\uc740 \uc815\ubcf4\ub85c\ub294 \ud568\uc218\uc758 \uc2e4\ud589 \uc2dc\uac04\uc5d0 \ub300\ud55c \uc804\uccb4 \uc0c1\ud669\uc744 \uc54c\uae30 \ud798\ub4e4\uac70\ub098 \ud568\uc218 \uc774\ub984\uc744 \uae30\uc900\uc73c\ub85c \uc218\uc9d1\ub41c \uacb0\uacfc\uac00 \ub108\ubb34 \ubcf5\uc7a1\ud574\uc11c \ubd84\uc11d \uc5b4\ub824\uc6c0\n",
      "- line_profiler(PyPI\ub098 \ub2e4\ub978 \ud328\ud0a4\uc9c0 \uad00\ub9ac \ub3c4\uad6c\ub97c \uc774\uc6a9\ud574 \uc5bb\uc74c)\ub77c\ub294 \uc791\uc740 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc0ac\uc6a9\ud558\uba74 \ub41c\ub2e4.\n",
      "- IPython \ud655\uc7a5\uc744 \ud3ec\ud568\ud574 \ud558\ub098 \uc774\uc0c1\uc758 \ud568\uc218\ub97c \uc904\ub9c8\ub2e4 \ud504\ub85c\ud30c\uc77c\ub9c1 \ud560 \uc218 \uc788\ub294 %lprun \ub9e4\uc9c1 \ud568\uc218 \uc81c\uacf5\n",
      "\n",
      "#### line_profiler \uc0bd\uc9c8\uae30\n",
      "\n",
      "- \ucc45\uc5d0 \uc368 \uc788\ub294\ub300\ub85c \ud574\ubd24\uc9c0\ub9cc \ub3c4\uc800\ud788 \ub3d9\uc791\ud558\uc9c0 \uc54a\ub294\ub2e4.\n",
      "- \uc544\ubb34\ub9ac \uc124\uc815 \ud30c\uc77c\uc5d0 \ucd94\uac00\ud558\uace0 lprun\uc744 \ud574\ubcf4\uc9c0\ub9cc \uadf8\ub7f0 \ubaa8\ub4c8\uc740 \uc5c6\ub2e4\ub294 \uce5c\uc808\ud55c \uc5d0\ub7ec\ub97c \ubc49\uc5b4\uc900\ub2e4.\n",
      "- \uad6c\uae00\ub9c1\uc73c\ub85c\ub3c4 \uba87 \uc2dc\uac04\uc774\ub098 \ucc3e\uc544\ubd24\uc9c0\ub9cc \ubabb \ucc3e\uc558\uae30 \ub54c\ubb38\uc5d0 \uc5ec\uae30\uc5d0\uc11c\ub294 \uc2a4\ud0b5\ud558\uaca0\ub2e4. \ud639\uc2dc \ub418\ub294 \ubd84\uc740 \uc54c\ub824\uc8fc\uae30 \ubc14\ub780\ub2e4. \ub0b4\uac00 \ub0ad\ube44\ud55c \uc2dc\uac04\uc774 \uc544\uae4c\uc6cc\uc11c\ub77c\ub3c4 \ud55c \ubc88 \ud574\ubcf4\uace0 \uc2f6\ub2e4 \u3160\u3160"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## 3.5 IPython HTML \ub178\ud2b8\ubd81\n",
      "\n",
      "- \ub178\ud2b8\ubd81\uc5d0\ub294 \ucf54\ub4dc, \ucd9c\ub825 \uacb0\uacfc, \uadf8\ub9bc\uc744 \uc27d\uac8c \uacf5\uc720\ud560 \uc218 \uc788\ub294 JSON \ud30c\uc77c \ud615\uc2dd\uc758 .ipynb \ubb38\uc11c \uc874\uc7ac\n",
      "- \ucd5c\uadfc \ud30c\uc774\uc36c \ucee8\ud37c\ub7f0\uc2a4\uc5d0\uc11c\ub294 \uc774 .ipynb \ud30c\uc77c\uc744 \uc628\ub77c\uc778\uc73c\ub85c \uacf5\uc720\ud574 \ubc1c\ud45c \ud6c4\uc5d0 \ub2e4\ub978 \uc0ac\ub78c\ub3c4 \uc9c1\uc811 \uc2e4\ud589\ud574 \ubcfc \uc218 \uc788\ub3c4\ub85d \ud558\uace0 \uc788\uc9c0\ub9cc \uad6d\ub0b4\uc5d0\uc11c\ub294 \ub9ce\uc774 \uc0ac\uc6a9\ub418\uace0 \uc788\uc9c0 \uc54a\ub2e4. \n",
      "- \ub178\ud2b8\ubd81 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc740 \uba85\ub839\ud589\uc5d0\uc11c \uc2e4\ud589\ub418\ub294 \uacbd\ub7c9 \uc11c\ubc84 \ud504\ub85c\uc138\uc2a4\ub85c \uc2e4\ud589\n",
      "- \ub300\ud654\ud615 \ucef4\ud4e8\ud305\uc5d0 \ud3b8\ub9ac\ud55c \ub3c4\uad6c\uc77c \ubfd0\ub9cc \uc544\ub2c8\ub77c \uc5f0\uad6c\uc640 \uad50\uc721\uc744 \uc704\ud574 \uc7ac\uc0ac\uc6a9\uc774 \uac00\ub2a5\ud55c \uc774\uc0c1\uc801\uc778 \ub9e4\uccb4\n",
      "- \uc774 \ucc45\uc758 \ub300\ubd80\ubd84\uc744 IPython \ub178\ud2b8\ubd81\uc744 \uc0ac\uc6a9\ud574\uc11c \uc791\uc131"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "    $ ipython notebook --pylab\n",
      "    2014-05-09 16:28:43.140 [NotebookApp] Using existing profile dir: u'/Users/re4lfl0w/.ipython/profile_default'\n",
      "    2014-05-09 16:28:43.149 [NotebookApp] Using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/MathJax.js\n",
      "    2014-05-09 16:28:43.168 [NotebookApp] Serving notebooks from local directory: /Users/re4lfl0w/Documents/SPSE\n",
      "    2014-05-09 16:28:43.168 [NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/\n",
      "    2014-05-09 16:28:43.168 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "- \ub300\ubd80\ubd84\uc758 \ud658\uacbd\uc5d0\uc11c\ub294 \uae30\ubcf8 \uc6f9\ube0c\ub77c\uc6b0\uc800\uac00 \uc790\ub3d9\uc73c\ub85c \uc5f4\ub9ac\uba74\uc11c \ub178\ud2b8\ubd81\uc758 \ub300\uc2dc\ubcf4\ub4dc\ub97c \ubcf4\uc5ec\uc900\ub2e4.\n",
      "- \uc5b4\ub5a8 \ub54c\uc5d0\ub294 \uc9c1\uc811 URL \uc785\ub825\n",
      "- \ube0c\ub77c\uc6b0\uc800\uc5d0 \ub178\ud2b8\ubd81\uc774 \ub098\ud0c0\ub098\uba74 \uac70\uae30\uc11c \uc0c8 \ub178\ud2b8\ubd81\uc744 \uc0dd\uc131\ud558\uace0 \uc0b4\ud3b4\ubcf4\uc790\n",
      "- [NotebookCloud](http://notebookcloud.appspot.com)\uc744 \uc774\uc6a9\ud558\uba74 EC2 \uc704\uc5d0\uc11c \ub178\ud2b8\ubd81\uc744 \uc27d\uac8c \uc5f4\ub78c"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "----\n",
      "### gist\ub97c \uc774\uc6a9\ud55c \ubc29\ubc95"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "    \ud398\uc774\uc2a4\ubd81 PythonKorea\uac15\ub0a8\uc2a4\ud130\ub514 \uae40\uc815\uc8fc\ub2d8 \uc81c\uacf5\n",
      "\n",
      "    \uc5b4\uc81c \ubc1c\ud45c\uc790\ub8cc\uc785\ub2c8\ub2e4. \uad50\uc7ac\uc640 \ub3d9\uc77c\ud55c \ub0b4\uc6a9\uc785\ub2c8\ub2e4\ub9cc \ucc38\uace0\ub85c \uc62c\ub824\ubd05\ub2c8\ub2e4.\n",
      "    http://nbviewer.ipython.org/gist/haje01/44825afdb0b54ac39150\n",
      "    \uc5ec\ucb64\ubcf4\uc168\ub358 IPython Notebook\uc744 gist\ub97c \ud1b5\ud574 nbviewer\uc5d0 \uc62c\ub9ac\ub294 \uacfc\uc815\uc740 \ub2e4\uc74c\uacfc \uac19\uc774 \uac04\ub2e8\ud569\ub2c8\ub2e4:\n",
      "    1. \ub178\ud2b8\ubd81 \ud30c\uc77c(.ipynb) \ub0b4\uc6a9\uc744 \ubcf5\uc0ac\ud558\uace0 https://gist.github.com\ub85c \uac00\uc11c \ubd99\uc5ec \ub123\uc2b5\ub2c8\ub2e4.\n",
      "    2. \uc800\uc7a5\ud6c4 \uc0dd\uc131\ub41c URL\uc744 \ubcf5\uc0ac\ud558\uace0 http://nbviewer.ipython.org\ub85c \uac00\uc154\uc11c \ubd99\uc5ec \ub123\uc2b5\ub2c8\ub2e4.\n",
      "\n",
      "    3. \uc5ec\uae30\uc5d0\uc11c \uc0dd\uc131\ub41c URL\ub85c \uacf5\uc720\ud574 \uc8fc\uc2dc\uba74 \ub429\ub2c8\ub2e4.\n",
      "    \ub2e4\ub9cc, \ubcc4\ub3c4 \ud30c\uc77c(\uc774\ubbf8\uc9c0 \ub4f1)\uc774 \uc788\ub294 \uacbd\uc6b0\uac00 \uc880 \ubb38\uc81c\uc778\ub370, \uc774\ub54c\ub294:\n",
      "    1. http://stackoverflow.com/questions/16425770/how-do-you-upload-images-to-a-gist \uc744 \ucc38\uace0\ud558\uc154\uc11c \uc774\ubbf8\uc9c0 \ud30c\uc77c\uc744 \uc62c\ub9bd\ub2c8\ub2e4.\n",
      "    2. \uc774\ub54c \uc774\ubbf8\uc9c0 \ud30c\uc77c\uc774 images/\ub77c\ub294 \ud3f4\ub354\uc5d0 \uc788\uc5c8\ub2e4\uba74, IPython\ub0b4 \ub178\ud2b8\ubd81\uc758 Markdown\uc140\uc5d0\uc11c \n",
      "    ![desc](files/images/myimage.png)\n",
      "    \ud615\uc2dd\uc73c\ub85c \uae30\uc220\ud558\uc154\uc57c \ud569\ub2c8\ub2e4.\n",
      "    \n",
      "-----"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## 3.6 IPython\uc744 \uc0ac\uc6a9\ud55c \uc81c\ud488 \uac1c\ubc1c\uc744 \uc704\ud55c \ud301\n",
      "\n",
      "- \ud328\ub7ec\ub2e4\uc784 \uc2dc\ud504\ud2b8: \uac1c\ubc1c\uacfc \ub514\ubc84\uae45\uc774 \uc27d\uace0, \uad81\uadf9\uc801\uc73c\ub85c\ub294 \uc778\ud130\ub799\ud2f0\ube0c\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub3c4\ub85d \ucf54\ub4dc\ub97c \uc791\uc131\ud558\ub294 \uac83\n",
      "- \ucf54\ub529 \uc2a4\ud0c0\uc77c\uacfc \ub354\ubd88\uc5b4 \uc57d\uac04\uc758 \uc218\uc815\uc744 \ud544\uc694\ub85c \ud558\ub294 \ucf54\ub4dc \ub9ac\ub85c\ub529 \uac19\uc740 \uc808\ucc28\uc801\uc778 \uc138\ubd80\uc0ac\ud56d \uc874\uc7ac\n",
      "- \ub300\ubd80\ubd84\uc758 \uc0ac\uc6a9\uc790\ub294 \uc7ac\uc0ac\uc6a9\uc774 \uc27d\uace0 \uac00\ub2a5\ud55c \ud55c \ud070 \uc5b4\ub824\uc6c0 \uc5c6\uc774 \ud568\uc218\ub098 \ud504\ub85c\uadf8\ub7a8\uc758 \uc2e4\ud589 \uacb0\uacfc\ub97c \ud655\uc778\ud560 \uc218 \uc788\ub294 \ubc29\uc2dd\uc73c\ub85c \ucf54\ub4dc\ub97c \uad6c\uc870\ud654\ud558\uace0 \uc2f6\uc744 \uac83\uc774\ub2e4. \ub098\ub294 \ub3c5\ub9bd\uc801\uc73c\ub85c \uc2e4\ud589\ub418\ub294 \uba85\ub839\ud589 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\ub9cc\uc744 \uc704\ud55c \ucf54\ub4dc\ubcf4\ub2e4\ub294 IPython \uc5d0\uc11c \uc2e4\ud589\ub418\ub294 \uac83\uc744 \uc5fc\ub450\uc5d0 \ub450\uace0 \uac1c\ubc1c\ub41c \uc18c\ud504\ud2b8\uc6e8\uc5b4\uac00 \ud6e8\uc52c \ub354 \uc27d\uac8c \uc791\uc5c5\ud560 \uc218 \uc788\ub2e4.\n",
      "- \uc774\ub294 \uc5ec\ub7ec\ubd84\uc774 \uba87 \ub2ec, \uc2ec\uc9c0\uc5b4\ub294 **\uba87 \ub144 \uc804\uc5d0 \uc791\uc131\ud55c \ucf54\ub4dc\uc5d0\uc11c \ubc1c\uc0dd\ud55c \uc624\ub958\ub97c \ubd84\uc11d**\ud574\uc57c \ud560 \ub54c \ud2b9\ud788 \uc911\uc694\ud55c \ubb38\uc81c"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "### 3.6.1 \ubaa8\ub4c8 \uc758\uc874\uc131 \ub9ac\ub85c\ub529\ud558\uae30\n",
      "\n",
      "- import some_lib\uc744 \uc785\ub825\ud558\uba74 some_lib\uc5d0 \uc788\ub294 \ucf54\ub4dc\uac00 \uc2e4\ud589\n",
      "- \ubaa8\ub4e0 \ubcc0\uc218\uc640 \ud568\uc218, \uadf8 \uc548\uc5d0 import\ub294 \uc0c8\ub85c \uc0dd\uc131\ub41c some_lib \ubaa8\ub4c8\uc758 \ub124\uc784\uc2a4\ud398\uc774\uc2a4 \uc548\uc5d0 \uc800\uc7a5\n",
      "- \uadf8 \ud6c4\uc5d0 \ub2e4\uc2dc import some_lib\uc744 \uc785\ub825\ud558\uba74 \uc774\ubbf8 \uc874\uc7ac\ud558\ub294 \ubaa8\ub4c8 \ub124\uc784\uc2a4\ud398\uc774\uc2a4\uc5d0 \ub300\ud55c \ucc38\uc870\ub97c \uc5bb\uc744 \uc218 \uc788\ub2e4.\n",
      "- IPython\uc5d0\uc11c \ub300\ud654\ud615 \ucf54\ub4dc \uac1c\ubc1c\uc5d0 \uc788\uc5b4 \uc7a0\uc7ac\uc801\uc778 \uc5b4\ub824\uc6c0\uc740 \ubcc0\uacbd\ud55c \ub2e4\ub978 \ubaa8\ub4c8\uc5d0 \ub300\ud55c \uc758\uc874\uc131\uc744 \uac00\uc9c0\ub294 \uc2a4\ud06c\ub9bd\ud2b8\ub97c %run \uc73c\ub85c \uc2e4\ud589\ud588\uc744 \ub54c \uacaa\uac8c \ub420 \uac83"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "    import some_lib\n",
      "\n",
      "    x = 5\n",
      "    y = [1,2,3,4]\n",
      "    result = some_lib.get_answer(x, y)"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "- %run test_script.py\uc744 \uc2e4\ud589\ud558\uace0 some_lib.py \ud30c\uc77c\uc744 \ubcc0\uacbd\ud55c \ub2e4\uc74c \ub2e4\uc2dc %run test_script.py\ub97c \uc2e4\ud589\ud558\uba74 \ubcc0\uacbd\ub418\uae30 \uc804\uc758 some_lib\uc744 \ucc38\uc870\ud558\uac8c \ub418\ub294\ub370, \uc774\ub294 \ud30c\uc774\uc36c\uc774 \ubaa8\ub4c8\uc744 \ud55c \ubc88\ub9cc \ub85c\ub529\ud558\uae30 \ub54c\ubb38\n",
      "- \uc774\ub7f0 \ud615\ud0dc\ub294 \uc790\ub3d9\uc801\uc73c\ub85c \ucf54\ub4dc \ubcc0\uacbd\uc744 \uc804\ud30c\ud574\uc8fc\ub294 MATALB \uac19\uc740 \ub2e4\ub978 \ub370\uc774\ud130 \ubd84\uc11d \ud658\uacbd\uacfc\ub294 \ub2e4\ub974\ub2e4.\n",
      "- \uc774\ub7f0 \ubb38\uc81c\uc5d0 \ub300\uc751\ud558\uae30 \uc704\ud55c \uba87 \uac00\uc9c0 \uc635\uc158\n",
      "- \uccab\ubc88\uc9f8 \ubc29\ubc95\uc740 \ud30c\uc774\uc36c\uc758 \ub0b4\uc7a5 reload \ud568\uc218\ub97c \uc774\uc6a9\ud558\ub3c4\ub85d \ub2e4\uc74c \uc608\uc81c\ucc98\ub7fc test_script.py\ub97c \ubcc0\uacbd\ud558\ub294 \uac83\uc774\ub2e4.\n",
      "\n",
      "#### MATLAB\uc740 \uc790\ub3d9\uc801\uc73c\ub85c \ucf54\ub4dc \ubcc0\uacbd \uc804\ud30c\n",
      "\n",
      "- \ubaa8\ub4c8\uc774\ub098 \ud328\ud0a4\uc9c0\ub294 \ud55c \ud504\ub85c\uadf8\ub7a8 \uc548\uc5d0\uc11c\ub3c4 \ub2e4\uc591\ud55c \uacf3\uc5d0\uc11c import \ub420 \uc218 \uc788\uae30 \ub54c\ubb38\uc5d0 \ud30c\uc774\uc36c\uc740 \ubaa8\ub4c8\uc774 import \ub420 \ub54c\ub9c8\ub2e4 \ucf54\ub4dc\ub97c \uc2e4\ud589\ud558\uc9c0 \uc54a\uace0 \ucd5c\ucd08\uc5d0 \ubaa8\ub4c8\uc774 import \ub418\uc5c8\uc744 \ub54c \ubaa8\ub4c8\uc758 \ucf54\ub4dc\ub97c \uce90\uc2dc\uc5d0 \ub2f4\uc544\ub454\ub2e4. \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \ubaa8\ub4c8 \ubc29\uc2dd\uacfc \ud6cc\ub96d\ud55c \ucf54\ub4dc \uad6c\uc131\uc774 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc758 \ud6a8\uc728\uc744 \ub5a8\uc5b4\ub728\ub9b4 \uc218 \uc788\ub2e4."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "    import some_lib\n",
      "    reload(some_lib)\n",
      "\n",
      "    x = 5\n",
      "    y = [1,2,3,4]\n",
      "    result = some_lib.get_answer(x, y)"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "- \uc774\ub807\uac8c \ud558\uba74 test_script.py\ub97c \uc2e4\ud589\ud560 \ub54c\ub9c8\ub2e4 \ud56d\uc0c1 \uc0c8\ub86d\uac8c some_lib\uc758 \ubcf5\uc0ac\ubcf8\uc744 \uc5bb\uc744 \uc218 \uc788\ub2e4.\n",
      "- \ub2f9\uc5f0\ud788 \uc758\uc874\uc131\uc774 \uae4a\uc5b4\uc9c8\uc218\ub85d \ubaa8\ub4e0 \uacf3\uc5d0 reload\ub97c \uc0ac\uc6a9\ud558\ub3c4\ub85d \ucd94\uac00\ud574\uc57c \ud558\ub294 \ubc88\uac70\ub85c\uc6c0\uc774 \ub530\ub978\ub2e4.\n",
      "- \uc774\ub7f0 \ubb38\uc81c \ub54c\ubb38\uc5d0 IPython\uc5d0\uc11c\ub294 dreload(deep reload) \ud568\uc218 \uc874\uc7ac\n",
      "- dreload\ub294 \ub9e4\uc9c1 \ud568\uc218\ub294 \uc544\ub2c8\uba70 \uae4a\uc740(\uc7ac\uadc0\uc801\uc73c\ub85c) \ubaa8\ub4c8\uc744 \ub9ac\ub85c\ub529\ud558\uac8c \ud574\uc900\ub2e4.\n",
      "- \ub9cc\uc77c import some_lib \uc774\ub77c\uace0 \uc785\ub825\ud558\uc9c0 \uc54a\uace0 dreload(some_lib) \uc774\ub77c\uace0 \uc785\ub825\ud55c\ub2e4\uba74 some_lib\uacfc some_lib\uc5d0 \uc758\uc874\ud558\ub294 \ub2e4\ub978 \ubaa8\ub4e0 \ubaa8\ub4c8\uc744 \uc0c8\ub85c \uc77d\uc5b4\uc624\ub824\uace0 \ud560 \uac83\uc774\ub2e4.\n",
      "- \uc544\uc27d\uc9c0\ub9cc \ubaa8\ub4e0 \uacbd\uc6b0\uc5d0 \uc774 \ubc29\ubc95\uc744 \uc801\uc6a9\ud560 \uc218\ub294 \uc5c6\ub2e4.\n",
      "- \ud558\uc9c0\ub9cc IPython\uc744 \uc7ac\uc2dc\uc791\ud574\uc57c \ud558\ub294 \ubc88\uac70\ub85c\uc6c0\uc740 \ud574\uacb0\ud560 \uc218 \uc788\ub2e4."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "### 3.6.2 \ucf54\ub4dc \uc124\uacc4 \ud301\n",
      "\n",
      "- \ucf54\ub4dc \uc124\uacc4\uc5d0 \uc788\uc5b4 \uc9c0\ub984\uae38\uc740 \uc5c6\uc9c0\ub9cc \uc77c\uc744 \ud558\uba74\uc11c \ub3c4\uc6c0\uc774 \ub418\uc5c8\ub358 \uba87 \uac00\uc9c0 \uc0c1\uc704 \uc218\uc900\uc758 \uc6d0\ub9ac \uc18c\uac1c\n",
      "\n",
      "#### \uad00\ub828 \uc788\ub294 \uac1d\uccb4\uc640 \ub370\uc774\ud130\ub294 \uc720\uc9c0"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "    from my_functions import g\n",
      "\n",
      "    def f(x, y):\n",
      "        return g(x + y)\n",
      "\n",
      "    def main():\n",
      "        x = 6\n",
      "        y = 7.5\n",
      "        result = x + y\n",
      "\n",
      "    if __name__ == '__main__':\n",
      "        main()"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#### \uc774 \ud504\ub85c\uadf8\ub7a8\uc758 \ubb38\uc81c\uc810?\n",
      "\n",
      "- \ud504\ub85c\uadf8\ub7a8\uc758 \uc2e4\ud589\uc774 \ub05d\ub098\uba74 IPython \uc5d0\uc11c\ub294 main \ud568\uc218 \ub0b4\ubd80\uc5d0\uc11c \uc2e4\ud589\ub418\ub294 \ucf54\ub4dc\ub97c \ubaa8\ub4c8\uc758 \uae00\ub85c\ubc8c \ub124\uc784\uc2a4\ud398\uc774\uc2a4\uc5d0\uc11c \uc9c1\uc811 \uc2e4\ud589\ub418\ub3c4\ub85d \uace0\uce58\ub294 \uac83(\ud639\uc740 \ubaa8\ub4c8\uc774 import\uac00 \uac00\ub2a5\ud558\ub3c4\ub85d \ub9cc\ub4e4\uace0 \uc2f6\ub2e4\uba74 if \\_\\_name\\_\\_ == '\\_\\_main\\_\\_': \ube0c\ub85d \uc548\uc5d0\uc11c \uc2e4\ud589 \ub418\ub3c4\ub85d \ud55c\ub2e4)\n",
      "- \uc774\ub807\uac8c \ud558\uba74 %run\uc73c\ub85c \ud504\ub85c\uadf8\ub7a8\uc744 \uc2e4\ud589\uc2dc\ucf1c\ub3c4 main \ud568\uc218\uc5d0\uc11c \uc815\uc758\ub41c \ubaa8\ub4e0 \ubcc0\uc218\ub97c \uc0b4\ud3b4\ubcfc \uc218 \uc788\uac8c \ub41c\ub2e4.\n",
      "- \uc774 \uc608\uc81c\ub294 \ud070 \uc758\ubbf8\uac00 \uc5c6\uc5b4 \ubcf4\uc774\uc9c0\ub9cc \uc55e\uc73c\ub85c IPython\uc73c\ub85c \ub300\uc6a9\ub7c9 \ub370\uc774\ud130\ub97c \ub2e4\ub8e8\ub294 \uc880 \ub354 **\ubcf5\uc7a1\ud55c \ub370\uc774\ud130 \ubd84\uc11d \ubb38\uc81c**\ub97c \uc0b4\ud3b4\ubcfc \uac83\uc774\ubbc0\ub85c \uc774\ub807\uac8c \ud558\ub294 \ud3b8\uc774 \ub354 \ub0ab\ub2e4."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "%%writefile ch03/test_namespace.py\n",
      "def f(x, y):\n",
      "    return g(x + y)\n",
      "\n",
      "def main():\n",
      "    x = 6\n",
      "    y = 7.5\n",
      "    result = x + y\n",
      "\n",
      "if __name__ == '__main__':\n",
      "    main()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Overwriting ch03/test_namespace.py\n"
       ]
      }
     ],
     "prompt_number": 87
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "%run ch03/test_namespace.py"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 88
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "x"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 89,
       "text": [
        "'foobar'"
       ]
      }
     ],
     "prompt_number": 89
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "result"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 90,
       "text": [
        "1.4666666666666666"
       ]
      }
     ],
     "prompt_number": 90
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#### __main__\uc5d0\uc11c \ud568\uc218 \uc2e4\ud589\n",
      "\n",
      "- main() \ud568\uc218\uc5d0 \uc788\ub358 \ub0b4\uc6a9\uc744 \\_\\_main\\_\\_ \uc73c\ub85c \uc62e\uae30\ub2c8 run\uc744 \uc2e4\ud589\ud55c \ud6c4\uc5d0 \ubcc0\uc218\ub4e4\uc744 \ucc38\uc870\ud560 \uc218 \uc788\uac8c \ub410\ub2e4."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "%%writefile ch03/test_namespace2.py\n",
      "def f(x, y):\n",
      "    return g(x + y)\n",
      "\n",
      "if __name__ == '__main__':\n",
      "    x = 6\n",
      "    y = 7.5\n",
      "    result = x + y"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Overwriting ch03/test_namespace2.py\n"
       ]
      }
     ],
     "prompt_number": 91
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "%run ch03/test_namespace2.py"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 92
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "x"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 93,
       "text": [
        "6"
       ]
      }
     ],
     "prompt_number": 93
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "result"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 94,
       "text": [
        "13.5"
       ]
      }
     ],
     "prompt_number": 94
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#### \uc911\ucca9\uc744 \ud53c\ud558\uc790\n",
      "\n",
      "- \ud568\uc218\ub97c \ud14c\uc2a4\ud2b8\ud558\uac70\ub098 \ub514\ubc84\uae45\ud560 \ub54c, \ud655\uc778\ud574\uc57c \ud560 \ucf54\ub4dc\ub97c \ubcf4\uae30 \uc704\ud574 \uba87 \uacb9\uc758 \uc591\ud30c \uaecd\uc9c8\uc744 \ubc97\uaca8\uc57c \ud560\uae4c? '\uc911\ucca9\uc744 \ud53c\ud558\uc790'\ub294 [Zen of Python(PEP20)](http://legacy.python.org/dev/peps/pep-0020/)\uc5d0 \ub098\uc624\ub294 \uad6c\uc808\uc778\ub370, \ub300\ud654\ud615 \ubc29\uc2dd\uc744 \uc704\ud55c \ucf54\ub4dc\ub97c \uac1c\ubc1c\ud560 \ub54c\ub3c4 \ub9c8\ucc2c\uac00\uc9c0\ub85c \uc801\uc6a9\n",
      "- \ud568\uc218\uc640 \ud074\ub798\uc2a4\ub97c \uc791\uc131\ud560 \ub54c \uac00\ub2a5\ud55c \ud55c \uacb0\ud569\ub3c4\ub97c \ub0ae\ucd94\uace0 \ubaa8\ub4c8\ud654\ud558\uba74 \ud14c\uc2a4\ud2b8(\ub2e8\uc704 \ud14c\uc2a4\ud2b8\ub97c \uc791\uc131\ud55c\ub2e4\uba74), \ub514\ubc84\uae45\uc774 \uc26c\uc6cc\uc9c8 \ubfd0 \uc544\ub2c8\ub77c \ub300\ud654\ud615 \ubc29\uc2dd\uc73c\ub85c \uc0ac\uc6a9\ud558\uae30\ub3c4 \uc26c\uc6cc\uc9c4\ub2e4.\n",
      "- [PEP 20(The Zen of Python) by example](http://artifex.org/~hblanks/talks/2011/pep20_by_example.html)"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#### \uae34 \ud30c\uc77c\uc5d0 \ub300\ud55c \ub450\ub824\uc6c0\uc744 \ubc84\ub9ac\uc790\n",
      "\n",
      "- IPython\uc5d0\uc11c 10\uac1c\uc758 \uc791\uace0 \uc11c\ub85c \uc5f0\uad00\ub41c \ud30c\uc77c(\uac01\uac01 100\uc5ec \uc904 \uc774\ud558\uc778)\uc744 \uc0ac\uc6a9\ud574\uc11c \uac1c\ubc1c\uc744 \uc9c4\ud589\ud55c\ub2e4\uba74 \ud55c\ub450 \uac1c\uc758 \uae34 \ud30c\uc77c\ub85c \uc791\uc5c5\ud560 \ub54c\ubcf4\ub2e4 \ub354 \uace8\uce58\uac00 \uc544\ud50c \uac83\n",
      "- \ud30c\uc77c \uac1c\uc218\uac00 \uc801\ub2e4\ub294 \ub9d0\uc740 \uace7 \ub9ac\ub85c\ub4dc\ud560 \ubaa8\ub4c8\uc774 \uc801\ub2e4\ub294 \uc758\ubbf8\uc774\uace0, \uc774 \ud30c\uc77c\uc77c \uc800 \ud30c\uc77c \ud3b8\uc9d1\ud558\ub294 \uc77c\uc774 \uc904\uc5b4\ub4e0\ub2e4.\n",
      "- \ub098\ub294 \ub0b4\ubd80\uc801\uc73c\ub85c \ub192\uc740 \uacb0\ud569\ub3c4\ub97c \uac00\uc9c0\ub294 \ud070 \ubaa8\ub4c8\uc744 \uc720\uc9c0\ud558\ub294 \uac83\uc774 \ud6e8\uc52c \uc720\uc6a9\ud558\uace0 '\ud30c\uc774\uc36c\uc2a4\ub7fd\ub2e4'\ub294 \uc0ac\uc2e4\uc744 \uae68\ub2ec\uc558\ub2e4.\n",
      "- \ud574\ubc95\uc744 \uc704\ud574 \ubc18\ubcf5\ud558\ub2e4\ubcf4\uba74 \uac00\ub054\uc740 \ud070 \ud30c\uc77c\uc744 \uc791\uc740 \ud30c\uc77c\ub85c \ucabc\uac1c\ub294 \uac83\uc774 \uc790\uc5f0\uc2a4\ub7fd\ub2e4\ub294 \uac83\uc744 \uc54c\uac8c \ub418\uae30\ub3c4 \ud55c\ub2e4.\n",
      "- \ubb3c\ub860 \uc774 \uc8fc\uc7a5\uc744 \uc9c0\ub098\uce58\uac8c \ubc1b\uc544\ub4e4\uc5ec\uc11c \uad34\ubb3c\ucc98\ub7fc \ud558\ub098\uc9dc\ub9ac \ud30c\uc77c\uc5d0 \ubaa8\ub4e0 \ucf54\ub4dc\ub97c \ub2e4 \uc9d1\uc5b4\ub123\uc73c\ub77c\ub294 \uac83\uc740 \uc544\ub2c8\ub2e4. \ud070 \ucf54\ub4dc \uae30\ubc18\uc5d0 \uc5b4\uc6b8\ub9ac\ub294 \ud569\ub9ac\uc801\uc774\uace0 \uc9c1\uad00\uc801\uc778 \ubaa8\ub4c8\uacfc \ud328\ud0a4\uc9c0 \uad6c\uc870\ub97c \ucc3e\ub294 \uc77c\uc740 \uc57d\uac04\uc758 \uc218\uace0\uac00 \ud544\uc694\ud558\uc9c0\ub9cc \uc81c\ub300\ub85c \uc77c\ud558\ub824\uba74 \ubb34\uc5c7\ubcf4\ub2e4 \uc911\uc694\ud55c \uacfc\uc815\n",
      "- \uac01\uac01\uc758 \ubaa8\ub4c8\uc740 \ub0b4\ubd80\uc801\uc73c\ub85c \uc751\uc9d1\ud574\uc57c \ud558\uace0 \uac01 \uae30\ub2a5\uc744 \uc704\ud55c \ud074\ub798\uc2a4\uc640 \ud568\uc218\ub97c \ucc3e\ub294 \uc77c\ub3c4 \ucd5c\ub300\ud55c \ubd84\uba85\ud574\uc57c \ud55c\ub2e4."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## 3.7 IPython \uace0\uae09 \uae30\ub2a5\n",
      "\n",
      "### 3.7.1 IPython \uce5c\ud654\uc801\uc778 \ud074\ub798\uc2a4 \ub9cc\ub4e4\uae30\n",
      "\n",
      "- IPython\uc740 \uc0b4\ud3b4\ubcf4\ub824\ub294 \ubaa8\ub4e0 \uac1d\uccb4\uc758 \ubb38\uc790\uc5f4 \ud45c\ud604\uc744 \ucf58\uc194 \uce5c\ud654\uc801\uc778 \ubaa8\uc591\uc73c\ub85c \ucd9c\ub825\n",
      "- \uc0ac\uc804, \ub9ac\uc2a4\ud2b8, \ud29c\ud50c \ub9ce\uc740 \uac1d\uccb4\uc5d0 \ub300\ud574 \ub0b4\uc7a5 pprint \ubaa8\ub4c8\uc744 \uc0ac\uc6a9\ud558\uba74 \uba4b\uc9c4 \ubaa8\uc591\uc73c\ub85c \ucd9c\ub825\n",
      "- \ud558\uc9c0\ub9cc \uc0ac\uc6a9\uc790 \uc815\uc758 \ud074\ub798\uc2a4\uc758 \uacbd\uc6b0\uc5d0\ub294 \uc9c1\uc811 \uc6d0\ud558\ub294 \ud615\uc2dd\uc758 \ubb38\uc790\uc5f4 \ucd9c\ub825\uc744 \uc0dd\uc131\ud574\uc918\uc57c\ub9cc \ud55c\ub2e4."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "class Message:\n",
      "    def __init__(self, msg):\n",
      "        self.msg = msg"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 95
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "x = Message('I have a secret')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 96
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# \ud074\ub798\uc2a4\uc758 \uae30\ubcf8 \ubb38\uc790\uc5f4 \ud45c\ud604\uc774 \uadf8\ub9ac \ubcf4\uae30 \uc88b\uc9c0 \uc54a\ub2e4.\n",
      "x"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 97,
       "text": [
        "<__main__.Message instance at 0x10a272f80>"
       ]
      }
     ],
     "prompt_number": 97
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "- IPython\uc740 \\_\\_repr\\_\\_ \ub9e4\uc9c1 \uba54\uc11c\ub4dc\uc5d0\uc11c \ubc18\ud658\ub418\ub294 \ubb38\uc790\uc5f4\uc744 \ubc1b\uc544\uc11c(output = repr(obj)) \ucf58\uc194\ub85c \ucd9c\ub825\ud55c\ub2e4. \ub530\ub77c\uc11c \uc774 \ud074\ub798\uc2a4\uc5d0 \\_\\_repr\\_\\_ \uba54\uc11c\ub4dc\ub97c \ucd94\uac00\ud558\uc5ec \ucd9c\ub825\uc744 \uc880 \ub354 \ubcf4\uae30 \uc88b\uac8c \ud574\ubcf4\uc790."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "class Message:\n",
      "    def __init__(self, msg):\n",
      "        self.msg = msg\n",
      "    def __repr__(self):\n",
      "        return 'Message %s' % self.msg"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 98
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "x = Message('I have a secret')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 99
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "x"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 100,
       "text": [
        "Message I have a secret"
       ]
      }
     ],
     "prompt_number": 100
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "### 3.7.2 \ud504\ub85c\ud30c\uc77c\uacfc \uc124\uc815\n",
      "\n",
      "- \uc0c9\uc0c1, \ud504\ub86c\ud504\ud2b8, \uc904 \uac04\uaca9 \ub4f1 \uc678\ud615\uacfc IPython \uc258\uc758 \ub3d9\uc791\uc5d0 \uad00\ud55c \ub300\ubd80\ubd84\uc758 \ud56d\ubaa9\uc740 \ud3ed\ub113\uc740 \uc124\uc815 \uc2dc\uc2a4\ud15c\uc744 \ud1b5\ud574 \ubcc0\uacbd \uac00\ub2a5\n",
      "- \uc0c9\uc0c1 \uc2a4\ud0a4\ub9c8 \ubcc0\uacbd\n",
      "- \uc785\u2219\ucd9c\ub825 \ud504\ub86c\ud504\ud2b8 \ubaa8\uc591 \ubcc0\uacbd, Out \ud504\ub86c\ud504\ud2b8\uc640 \uadf8 \ub2e4\uc74c In \ud504\ub86c\ud504\ud2b8 \uc0ac\uc774\uc758 \ube48 \uc904 \uc81c\uac70\n",
      "- \uc5ec\ub7ec \uac1c\uc758 \uc784\uc758\uc758 \ud30c\uc774\uc36c \ubb38\uc7a5 \uc2e4\ud589. \uc774 \uc124\uc815\uc744 \ud1b5\ud574 \ud56d\uc0c1 \uc0ac\uc6a9\ud558\ub294 \ubaa8\ub4c8\uc744 import \ud558\uac70\ub098 IPython\uc744 \uc2e4\ud589\ud560 \ub54c\ub9c8\ub2e4 \uc2e4\ud589\ub418\uae30\ub97c \uc6d0\ud558\ub294 \ucf54\ub4dc \ucd94\uac00\uac00 \uac00\ub2a5\n",
      "- line_profiler\uc758 \ub9e4\uc9c1 \ud568\uc218\uc778 %lprun \uac19\uc740 IPython \ud655\uc7a5 \ud65c\uc131\ud654\n",
      "- \uc0ac\uc6a9\uc790 \ub9e4\uc9c1 \ud568\uc218 \uc815\uc758, \uc2dc\uc2a4\ud15c \ubcc4\uce6d \uc815\uc758\n",
      "- UNIX: ~/.config/ipython/\n",
      "- Windows: %HOME%/.ipython/\n",
      "- \ub514\ub809\ud1a0\ub9ac\uc5d0 \uc788\ub294 ipython_config.py \ud30c\uc77c\uc5d0 \uc9c0\uc815\n",
      "- \uc0ac\uc6a9\uc790 \ud648 \ub514\ub809\ud1a0\ub9ac\ub294 \uc2dc\uc2a4\ud15c\uc5d0 \ub530\ub77c \ub2e4\ub974\ub2e4.\n",
      "- \uc124\uc815\uc740 \ud2b9\uc815 \ud504\ub85c\ud30c\uc77c\uc5d0 \uae30\ubc18\ud574\uc11c \uc218\ud589\n",
      "- \uc77c\ubc18\uc801\uc73c\ub85c IPython\uc744 \uc2e4\ud589\ud558\uba74 \uae30\ubcf8\uc801\uc73c\ub85c profiler_defualt \ub514\ub809\ud1a0\ub9ac\uc5d0 \uc800\uc7a5\ub41c default \ud504\ub85c\ud30c\uc77c\uc744 \ubd88\ub7ec\uc628\ub2e4. \n",
      "- \ub2e4\ud589\uc2a4\ub7fd\uac8c\ub3c4 \uac01 \uc124\uc815 \ud56d\ubaa9\ub9c8\ub2e4 \uc5b4\ub5a4 \ub0b4\uc6a9\uc778\uc9c0 \uc124\uba85\ud574\uc8fc\ub294 \uc8fc\uc11d\uc774 \ub2ec\ub824\uc788\uae30 \ub54c\ubb38\uc5d0 \ub3c5\uc790\uac00 \uc9c1\uc811 \uace0\uccd0\ubcf4\ub3c4\ub85d \uc219\uc81c\ub85c \ub0a8\uaca8\ub450\uaca0\ub2e4."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#### Mac \uc0ac\uc6a9\uc790 \ud504\ub85c\ud30c\uc77c \ud30c\uc77c \uc704\uce58\n",
      "\n",
      "- /Users/re4lfl0w/.ipython/profile_default/ipython_config.py\n",
      "- ipython\ub9cc \uc124\uce58\ud55c \ud6c4\uc5d0\ub294 \uc774 **\uc0ac\uc6a9\uc790 \ud504\ub85c\ud30c\uc77c\uc774 \uc808\ub300 \ubcf4\uc774\uc9c0 \uc54a\ub294\ub2e4**. ipython profile create secret_project \ucc98\ub7fc \ud504\ub85c\ud30c\uc77c\uc744 \ud558\ub098 \ub9cc\ub4e4\uc5b4\uc918\uc57c \uc774 \ud3f4\ub354\uac00 \uc0dd\uc131\uc774 \ub41c\ub2e4. \ucc45\uc758 \uc21c\uc11c\uac00 \uc57d\uac04 \uc798\ubabb\ub418\uc5b4\uc11c \uc5c4\uccad\ub09c \uc0bd\uc9c8 \ud6c4\uc5d0 \uc54c\uc544\ub0c8\ub2e4."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "    # Configuration file for ipython.\n",
      "\n",
      "    c = get_config()\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # InteractiveShellApp configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # A Mixin for applications that start InteractiveShell instances.\n",
      "    # \n",
      "    # Provides configurables for loading extensions and executing files as part of\n",
      "    # configuring a Shell environment.\n",
      "    # \n",
      "    # The following methods should be called by the :meth:`initialize` method of the\n",
      "    # subclass:\n",
      "    # \n",
      "    #   - :meth:`init_path`\n",
      "    #   - :meth:`init_shell` (to be implemented by the subclass)\n",
      "    #   - :meth:`init_gui_pylab`\n",
      "    #   - :meth:`init_extensions`\n",
      "    #   - :meth:`init_code`\n",
      "\n",
      "    # Execute the given command string.\n",
      "    # c.InteractiveShellApp.code_to_run = ''\n",
      "\n",
      "    # lines of code to run at IPython startup.\n",
      "    # c.InteractiveShellApp.exec_lines = []\n",
      "\n",
      "    # Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'none',\n",
      "    # 'osx', 'pyglet', 'qt', 'qt4', 'tk', 'wx').\n",
      "    # c.InteractiveShellApp.gui = None\n",
      "\n",
      "    # Pre-load matplotlib and numpy for interactive use, selecting a particular\n",
      "    # matplotlib backend and loop integration.\n",
      "    # c.InteractiveShellApp.pylab = None\n",
      "\n",
      "    # Configure matplotlib for interactive use with the default matplotlib backend.\n",
      "    # c.InteractiveShellApp.matplotlib = None\n",
      "\n",
      "    # If true, IPython will populate the user namespace with numpy, pylab, etc. and\n",
      "    # an 'import *' is done from numpy and pylab, when using pylab mode.\n",
      "    # \n",
      "    # When False, pylab mode should not import any names into the user namespace.\n",
      "    # c.InteractiveShellApp.pylab_import_all = True\n",
      "\n",
      "    # A list of dotted module names of IPython extensions to load.\n",
      "    # c.InteractiveShellApp.extensions = []\n",
      "\n",
      "    # Run the module as a script.\n",
      "    # c.InteractiveShellApp.module_to_run = ''\n",
      "\n",
      "    # dotted module name of an IPython extension to load.\n",
      "    # c.InteractiveShellApp.extra_extension = ''\n",
      "\n",
      "    # List of files to run at IPython startup.\n",
      "    # c.InteractiveShellApp.exec_files = []\n",
      "\n",
      "    # A file to be run\n",
      "    # c.InteractiveShellApp.file_to_run = ''\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # TerminalIPythonApp configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # TerminalIPythonApp will inherit config from: BaseIPythonApplication,\n",
      "    # Application, InteractiveShellApp\n",
      "\n",
      "    # Pre-load matplotlib and numpy for interactive use, selecting a particular\n",
      "    # matplotlib backend and loop integration.\n",
      "    # c.TerminalIPythonApp.pylab = None\n",
      "\n",
      "    # Create a massive crash report when IPython encounters what may be an internal\n",
      "    # error.  The default is to append a short message to the usual traceback\n",
      "    # c.TerminalIPythonApp.verbose_crash = False\n",
      "\n",
      "    # Run the module as a script.\n",
      "    # c.TerminalIPythonApp.module_to_run = ''\n",
      "\n",
      "    # The date format used by logging formatters for %(asctime)s\n",
      "    # c.TerminalIPythonApp.log_datefmt = '%Y-%m-%d %H:%M:%S'\n",
      "\n",
      "    # Whether to overwrite existing config files when copying\n",
      "    # c.TerminalIPythonApp.overwrite = False\n",
      "\n",
      "    # Execute the given command string.\n",
      "    # c.TerminalIPythonApp.code_to_run = ''\n",
      "\n",
      "    # Set the log level by value or name.\n",
      "    # c.TerminalIPythonApp.log_level = 30\n",
      "\n",
      "    # lines of code to run at IPython startup.\n",
      "    # c.TerminalIPythonApp.exec_lines = []\n",
      "\n",
      "    # Suppress warning messages about legacy config files\n",
      "    # c.TerminalIPythonApp.ignore_old_config = False\n",
      "\n",
      "    # Path to an extra config file to load.\n",
      "    # \n",
      "    # If specified, load this config file in addition to any other IPython config.\n",
      "    # c.TerminalIPythonApp.extra_config_file = u''\n",
      "\n",
      "    # dotted module name of an IPython extension to load.\n",
      "    # c.TerminalIPythonApp.extra_extension = ''\n",
      "\n",
      "    # A file to be run\n",
      "    # c.TerminalIPythonApp.file_to_run = ''\n",
      "\n",
      "    # The IPython profile to use.\n",
      "    # c.TerminalIPythonApp.profile = u'default'\n",
      "\n",
      "    # Configure matplotlib for interactive use with the default matplotlib backend.\n",
      "    # c.TerminalIPythonApp.matplotlib = None\n",
      "\n",
      "    # If a command or file is given via the command-line, e.g. 'ipython foo.py\n",
      "    # c.TerminalIPythonApp.force_interact = False\n",
      "\n",
      "    # If true, IPython will populate the user namespace with numpy, pylab, etc. and\n",
      "    # an 'import *' is done from numpy and pylab, when using pylab mode.\n",
      "    # \n",
      "    # When False, pylab mode should not import any names into the user namespace.\n",
      "    # c.TerminalIPythonApp.pylab_import_all = True\n",
      "\n",
      "    # The name of the IPython directory. This directory is used for logging\n",
      "    # configuration (through profiles), history storage, etc. The default is usually\n",
      "    # $HOME/.ipython. This options can also be specified through the environment\n",
      "    # variable IPYTHONDIR.\n",
      "    # c.TerminalIPythonApp.ipython_dir = u'/Users/re4lfl0w/.ipython'\n",
      "\n",
      "    # Whether to display a banner upon starting IPython.\n",
      "    # c.TerminalIPythonApp.display_banner = True\n",
      "\n",
      "    # Whether to install the default config files into the profile dir. If a new\n",
      "    # profile is being created, and IPython contains config files for that profile,\n",
      "    # then they will be staged into the new directory.  Otherwise, default config\n",
      "    # files will be automatically generated.\n",
      "    # c.TerminalIPythonApp.copy_config_files = False\n",
      "\n",
      "    # List of files to run at IPython startup.\n",
      "    # c.TerminalIPythonApp.exec_files = []\n",
      "\n",
      "    # Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'none',\n",
      "    # 'osx', 'pyglet', 'qt', 'qt4', 'tk', 'wx').\n",
      "    # c.TerminalIPythonApp.gui = None\n",
      "\n",
      "    # A list of dotted module names of IPython extensions to load.\n",
      "    # c.TerminalIPythonApp.extensions = []\n",
      "\n",
      "    # Start IPython quickly by skipping the loading of config files.\n",
      "    # c.TerminalIPythonApp.quick = False\n",
      "\n",
      "    # The Logging format template\n",
      "    # c.TerminalIPythonApp.log_format = '[%(name)s]%(highlevel)s %(message)s'\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # TerminalInteractiveShell configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # TerminalInteractiveShell will inherit config from: InteractiveShell\n",
      "\n",
      "    # auto editing of files with syntax errors.\n",
      "    # c.TerminalInteractiveShell.autoedit_syntax = False\n",
      "\n",
      "    # Use colors for displaying information about objects. Because this information\n",
      "    # is passed through a pager (like 'less'), and some pagers get confused with\n",
      "    # color codes, this capability can be turned off.\n",
      "    # c.TerminalInteractiveShell.color_info = True\n",
      "\n",
      "    # A list of ast.NodeTransformer subclass instances, which will be applied to\n",
      "    # user input before code is run.\n",
      "    # c.TerminalInteractiveShell.ast_transformers = []\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.history_length = 10000\n",
      "\n",
      "    # Don't call post-execute functions that have failed in the past.\n",
      "    # c.TerminalInteractiveShell.disable_failing_post_execute = False\n",
      "\n",
      "    # Show rewritten input, e.g. for autocall.\n",
      "    # c.TerminalInteractiveShell.show_rewritten_input = True\n",
      "\n",
      "    # Set the color scheme (NoColor, Linux, or LightBG).\n",
      "    # c.TerminalInteractiveShell.colors = 'LightBG'\n",
      "\n",
      "    # Autoindent IPython code entered interactively.\n",
      "    # c.TerminalInteractiveShell.autoindent = True\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.separate_in = '\\n'\n",
      "\n",
      "    # Deprecated, use PromptManager.in2_template\n",
      "    # c.TerminalInteractiveShell.prompt_in2 = '   .\\\\D.: '\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.separate_out = ''\n",
      "\n",
      "    # Deprecated, use PromptManager.in_template\n",
      "    # c.TerminalInteractiveShell.prompt_in1 = 'In [\\\\#]: '\n",
      "\n",
      "    # Make IPython automatically call any callable object even if you didn't type\n",
      "    # explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically.\n",
      "    # The value can be '0' to disable the feature, '1' for 'smart' autocall, where\n",
      "    # it is not applied if there are no more arguments on the line, and '2' for\n",
      "    # 'full' autocall, where all callable objects are automatically called (even if\n",
      "    # no arguments are present).\n",
      "    # c.TerminalInteractiveShell.autocall = 0\n",
      "\n",
      "    # Number of lines of your screen, used to control printing of very long strings.\n",
      "    # Strings longer than this number of lines will be sent through a pager instead\n",
      "    # of directly printed.  The default value for this is 0, which means IPython\n",
      "    # will auto-detect your screen size every time it needs to print certain\n",
      "    # potentially long strings (this doesn't change the behavior of the 'print'\n",
      "    # keyword, it's only triggered internally). If for some reason this isn't\n",
      "    # working well (it needs curses support), specify it yourself. Otherwise don't\n",
      "    # change the default.\n",
      "    # c.TerminalInteractiveShell.screen_length = 0\n",
      "\n",
      "    # Set the editor used by IPython (default to $EDITOR/vi/notepad).\n",
      "    # c.TerminalInteractiveShell.editor = 'vi'\n",
      "\n",
      "    # Deprecated, use PromptManager.justify\n",
      "    # c.TerminalInteractiveShell.prompts_pad_left = True\n",
      "\n",
      "    # The part of the banner to be printed before the profile\n",
      "    # c.TerminalInteractiveShell.banner1 = 'Python 2.7.2 (default, Oct 11 2012, 20:14:37) \\nType \"copyright\", \"credits\" or \"license\" for more information.\\n\\nIPython 1.1.0 -- An enhanced Interactive Python.\\n?         -> Introduction and overview of IPython\\'s features.\\n%quickref -> Quick reference.\\nhelp      -> Python\\'s own help system.\\nobject?   -> Details about \\'object\\', use \\'object??\\' for extra details.\\n'\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.readline_parse_and_bind = ['tab: complete', '\"\\\\C-l\": clear-screen', 'set show-all-if-ambiguous on', '\"\\\\C-o\": tab-insert', '\"\\\\C-r\": reverse-search-history', '\"\\\\C-s\": forward-search-history', '\"\\\\C-p\": history-search-backward', '\"\\\\C-n\": history-search-forward', '\"\\\\e[A\": history-search-backward', '\"\\\\e[B\": history-search-forward', '\"\\\\C-k\": kill-line', '\"\\\\C-u\": unix-line-discard']\n",
      "\n",
      "    # The part of the banner to be printed after the profile\n",
      "    # c.TerminalInteractiveShell.banner2 = ''\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.separate_out2 = ''\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.wildcards_case_sensitive = True\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.debug = False\n",
      "\n",
      "    # Set to confirm when you try to exit IPython with an EOF (Control-D in Unix,\n",
      "    # Control-Z/Enter in Windows). By typing 'exit' or 'quit', you can force a\n",
      "    # direct exit without any confirmation.\n",
      "    # c.TerminalInteractiveShell.confirm_exit = True\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.ipython_dir = ''\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.readline_remove_delims = '-/~'\n",
      "\n",
      "    # Start logging to the default log file.\n",
      "    # c.TerminalInteractiveShell.logstart = False\n",
      "\n",
      "    # The name of the logfile to use.\n",
      "    # c.TerminalInteractiveShell.logfile = ''\n",
      "\n",
      "    # The shell program to be used for paging.\n",
      "    # c.TerminalInteractiveShell.pager = 'less'\n",
      "\n",
      "    # Enable magic commands to be called without the leading %.\n",
      "    # c.TerminalInteractiveShell.automagic = True\n",
      "\n",
      "    # Save multi-line entries as one entry in readline history\n",
      "    # c.TerminalInteractiveShell.multiline_history = True\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.readline_use = True\n",
      "\n",
      "    # Enable deep (recursive) reloading by default. IPython can use the deep_reload\n",
      "    # module which reloads changes in modules recursively (it replaces the reload()\n",
      "    # function, so you don't need to change anything to use it). deep_reload()\n",
      "    # forces a full reload of modules whose code may have changed, which the default\n",
      "    # reload() function does not.  When deep_reload is off, IPython will use the\n",
      "    # normal reload(), but deep_reload will still be available as dreload().\n",
      "    # c.TerminalInteractiveShell.deep_reload = False\n",
      "\n",
      "    # Start logging to the given file in append mode.\n",
      "    # c.TerminalInteractiveShell.logappend = ''\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.xmode = 'Context'\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.quiet = False\n",
      "\n",
      "    # Enable auto setting the terminal title.\n",
      "    # c.TerminalInteractiveShell.term_title = False\n",
      "\n",
      "    # \n",
      "    # c.TerminalInteractiveShell.object_info_string_level = 0\n",
      "\n",
      "    # Deprecated, use PromptManager.out_template\n",
      "    # c.TerminalInteractiveShell.prompt_out = 'Out[\\\\#]: '\n",
      "\n",
      "    # Set the size of the output cache.  The default is 1000, you can change it\n",
      "    # permanently in your config file.  Setting it to 0 completely disables the\n",
      "    # caching system, and the minimum value accepted is 20 (if you provide a value\n",
      "    # less than 20, it is reset to 0 and a warning is issued).  This limit is\n",
      "    # defined because otherwise you'll spend more time re-flushing a too small cache\n",
      "    # than working\n",
      "    # c.TerminalInteractiveShell.cache_size = 1000\n",
      "\n",
      "    # 'all', 'last', 'last_expr' or 'none', specifying which nodes should be run\n",
      "    # interactively (displaying output from expressions).\n",
      "    # c.TerminalInteractiveShell.ast_node_interactivity = 'last_expr'\n",
      "\n",
      "    # Automatically call the pdb debugger after every exception.\n",
      "    # c.TerminalInteractiveShell.pdb = False\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # PromptManager configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # This is the primary interface for producing IPython's prompts.\n",
      "\n",
      "    # Output prompt. '\\#' will be transformed to the prompt number\n",
      "    # c.PromptManager.out_template = 'Out[\\\\#]: '\n",
      "\n",
      "    # Continuation prompt.\n",
      "    # c.PromptManager.in2_template = '   .\\\\D.: '\n",
      "\n",
      "    # If True (default), each prompt will be right-aligned with the preceding one.\n",
      "    # c.PromptManager.justify = True\n",
      "\n",
      "    # Input prompt.  '\\#' will be transformed to the prompt number\n",
      "    # c.PromptManager.in_template = 'In [\\\\#]: '\n",
      "\n",
      "    # \n",
      "    # c.PromptManager.color_scheme = 'Linux'\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # HistoryManager configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # A class to organize all history-related functionality in one place.\n",
      "\n",
      "    # HistoryManager will inherit config from: HistoryAccessor\n",
      "\n",
      "    # \n",
      "    # c.HistoryManager.db_log_output = False\n",
      "\n",
      "    # \n",
      "    # c.HistoryManager.db_cache_size = 0\n",
      "\n",
      "    # Path to file to use for SQLite history database.\n",
      "    # \n",
      "    # By default, IPython will put the history database in the IPython profile\n",
      "    # directory.  If you would rather share one history among profiles, you can set\n",
      "    # this value in each, so that they are consistent.\n",
      "    # \n",
      "    # Due to an issue with fcntl, SQLite is known to misbehave on some NFS mounts.\n",
      "    # If you see IPython hanging, try setting this to something on a local disk,\n",
      "    # e.g::\n",
      "    # \n",
      "    #     ipython --HistoryManager.hist_file=/tmp/ipython_hist.sqlite\n",
      "    # c.HistoryManager.hist_file = u''\n",
      "\n",
      "    # Options for configuring the SQLite connection\n",
      "    # \n",
      "    # These options are passed as keyword args to sqlite3.connect when establishing\n",
      "    # database conenctions.\n",
      "    # c.HistoryManager.connection_options = {}\n",
      "\n",
      "    # enable the SQLite history\n",
      "    # \n",
      "    # set enabled=False to disable the SQLite history, in which case there will be\n",
      "    # no stored history, no SQLite connection, and no background saving thread.\n",
      "    # This may be necessary in some threaded environments where IPython is embedded.\n",
      "    # c.HistoryManager.enabled = True\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # ProfileDir configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # An object to manage the profile directory and its resources.\n",
      "    # \n",
      "    # The profile directory is used by all IPython applications, to manage\n",
      "    # configuration, logging and security.\n",
      "    # \n",
      "    # This object knows how to find, create and manage these directories. This\n",
      "    # should be used by any code that wants to handle profiles.\n",
      "\n",
      "    # Set the profile location directly. This overrides the logic used by the\n",
      "    # `profile` option.\n",
      "    # c.ProfileDir.location = u''\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # PlainTextFormatter configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # The default pretty-printer.\n",
      "    # \n",
      "    # This uses :mod:`IPython.lib.pretty` to compute the format data of the object.\n",
      "    # If the object cannot be pretty printed, :func:`repr` is used. See the\n",
      "    # documentation of :mod:`IPython.lib.pretty` for details on how to write pretty\n",
      "    # printers.  Here is a simple example::\n",
      "    # \n",
      "    #     def dtype_pprinter(obj, p, cycle):\n",
      "    #         if cycle:\n",
      "    #             return p.text('dtype(...)')\n",
      "    #         if hasattr(obj, 'fields'):\n",
      "    #             if obj.fields is None:\n",
      "    #                 p.text(repr(obj))\n",
      "    #             else:\n",
      "    #                 p.begin_group(7, 'dtype([')\n",
      "    #                 for i, field in enumerate(obj.descr):\n",
      "    #                     if i > 0:\n",
      "    #                         p.text(',')\n",
      "    #                         p.breakable()\n",
      "    #                     p.pretty(field)\n",
      "    #                 p.end_group(7, '])')\n",
      "\n",
      "    # PlainTextFormatter will inherit config from: BaseFormatter\n",
      "\n",
      "    # \n",
      "    # c.PlainTextFormatter.type_printers = {}\n",
      "\n",
      "    # \n",
      "    # c.PlainTextFormatter.newline = '\\n'\n",
      "\n",
      "    # \n",
      "    # c.PlainTextFormatter.float_precision = ''\n",
      "\n",
      "    # \n",
      "    # c.PlainTextFormatter.verbose = False\n",
      "\n",
      "    # \n",
      "    # c.PlainTextFormatter.deferred_printers = {}\n",
      "\n",
      "    # \n",
      "    # c.PlainTextFormatter.pprint = True\n",
      "\n",
      "    # \n",
      "    # c.PlainTextFormatter.max_width = 79\n",
      "\n",
      "    # \n",
      "    # c.PlainTextFormatter.singleton_printers = {}\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # IPCompleter configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # Extension of the completer class with IPython-specific features\n",
      "\n",
      "    # IPCompleter will inherit config from: Completer\n",
      "\n",
      "    # Instruct the completer to omit private method names\n",
      "    # \n",
      "    # Specifically, when completing on ``object.``.\n",
      "    # \n",
      "    # When 2 [default]: all names that start with '_' will be excluded.\n",
      "    # \n",
      "    # When 1: all 'magic' names (``__foo__``) will be excluded.\n",
      "    # \n",
      "    # When 0: nothing will be excluded.\n",
      "    # c.IPCompleter.omit__names = 2\n",
      "\n",
      "    # Whether to merge completion results into a single list\n",
      "    # \n",
      "    # If False, only the completion results from the first non-empty completer will\n",
      "    # be returned.\n",
      "    # c.IPCompleter.merge_completions = True\n",
      "\n",
      "    # Instruct the completer to use __all__ for the completion\n",
      "    # \n",
      "    # Specifically, when completing on ``object.``.\n",
      "    # \n",
      "    # When True: only those names in obj.__all__ will be included.\n",
      "    # \n",
      "    # When False [default]: the __all__ attribute is ignored\n",
      "    # c.IPCompleter.limit_to__all__ = False\n",
      "\n",
      "    # Activate greedy completion\n",
      "    # \n",
      "    # This will enable completion on elements of lists, results of function calls,\n",
      "    # etc., but can be unsafe because the code is actually evaluated on TAB.\n",
      "    # c.IPCompleter.greedy = False\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # ScriptMagics configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # Magics for talking to scripts\n",
      "    # \n",
      "    # This defines a base `%%script` cell magic for running a cell with a program in\n",
      "    # a subprocess, and registers a few top-level magics that call %%script with\n",
      "    # common interpreters.\n",
      "\n",
      "    # Extra script cell magics to define\n",
      "    # \n",
      "    # This generates simple wrappers of `%%script foo` as `%%foo`.\n",
      "    # \n",
      "    # If you want to add script magics that aren't on your path, specify them in\n",
      "    # script_paths\n",
      "    # c.ScriptMagics.script_magics = []\n",
      "\n",
      "    # Dict mapping short 'ruby' names to full paths, such as '/opt/secret/bin/ruby'\n",
      "    # \n",
      "    # Only necessary for items in script_magics where the default path will not find\n",
      "    # the right interpreter.\n",
      "    # c.ScriptMagics.script_paths = {}\n",
      "\n",
      "    #------------------------------------------------------------------------------\n",
      "    # StoreMagics configuration\n",
      "    #------------------------------------------------------------------------------\n",
      "\n",
      "    # Lightweight persistence for python variables.\n",
      "    # \n",
      "    # Provides the %store magic.\n",
      "\n",
      "    # If True, any %store-d variables will be automatically restored when IPython\n",
      "    # starts.\n",
      "    # c.StoreMagics.autorestore = False\n",
      "\n",
      "    #c.TerminalIPythonApp.extensions = [\n",
      "    #            'line_profiler'\n",
      "    #            ]\n",
      "\n",
      "    #c.TerminalIPythonApp.extensions = ['line_profiler']\n"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#### IPython \uc0c8\ub85c\uc6b4 \ud504\ub85c\ud30c\uc77c \uc0dd\uc131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "!ipython profile create secret_project"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 101
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "    [ProfileCreate] Generating default config file: u'/Users/re4lfl0w/.ipython/profile_secret_project/ipython_config.py'\n",
      "    [ProfileCreate] Generating default config file: u'/Users/re4lfl0w/.ipython/profile_secret_project/ipython_notebook_config.py'\n",
      "    [ProfileCreate] Generating default config file: u'/Users/re4lfl0w/.ipython/profile_secret_project/ipython_nbconvert_config.py'"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "    $ ipython --profile=secret_project\n",
      "    Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45) \n",
      "    Type \"copyright\", \"credits\" or \"license\" for more information.\n",
      "\n",
      "    IPython 1.2.1 -- An enhanced Interactive Python.\n",
      "    ?         -> Introduction and overview of IPython's features.\n",
      "    %quickref -> Quick reference.\n",
      "    help      -> Python's own help system.\n",
      "    object?   -> Details about 'object', use 'object??' for extra details.\n",
      "\n",
      "    IPython profile: secret_project"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "- [Introduction to IPython configuration](http://ipython.org/ipython-doc/dev/config/intro.html#profiles)"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## 3.8 \uac10\uc0ac\uc758 \uae00\n",
      "\n",
      "- IPython \uac1c\ubc1c\ud300\uc774 \uc791\uc131\ud55c \ud6cc\ub96d\ud55c \ubb38\uc11c\uc5d0\uc11c \ub9ce\uc740 \ubd80\ubd84 \uc778\uc6a9"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## IPython \ucc38\uace0 \uc790\ub8cc\n",
      "\n",
      "- [PyConZA2013 presentation](http://nbviewer.ipython.org/github/Tooblippe/zapycon2013_ipython_science/blob/master/src/pycon13_ipython.ipynb)\n",
      "- [IPython Notebook \uacf5\uc2dd \ubb38\uc11c](http://ipython.org/ipython-doc/dev/notebook/index.html)\n",
      "- [\ud30c\uc774\uc36c(Python) \uac1c\ubc1c\uc790\uc758 \ud14c\ud06c\ub2c8\uceec \uc774\uc288(\uc774\uac15\uc131 \uad50\uc218)](http://www.youtube.com/watch?v=mJ2msJ5d5Ec): IPython \uc18c\uac1c, \ub370\ucf54\ub808\uc774\ud130, \uba54\ud0c0 \ud504\ub85c\uadf8\ub798\ubc0d \ub4f1 \uc911\u2219\uace0\uae09 \uae30\ubc95 \uc18c\uac1c\n",
      "- [\ubcf4\uc548\uc744 \uc704\ud55c \uac15\ub825\ud55c \ud30c\uc774\uc36c(Python) \uc2a4\ud06c\ub9bd\ud2b8 \uc5b8\uc5b4(\ucd5c\uc6d0\ud601 \uc774\uc0ac)](http://www.youtube.com/watch?v=galZ5TIQANc): \uc774\uac74 \ubcf4\uc548\ucabd \uc774\uc57c\uae30\uc774\uc9c0\ub9cc \uac19\uc774 \ubcf4\uba74 \uc88b\ub2e4.\n",
      "- [IPython in Depth, SciPy2013 Tutorial, Part 1 of 3](http://www.youtube.com/watch?v=xe_ATRmw0KM)"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from IPython.display import YouTubeVideo"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "### The IPython Notebook Revolution\n",
      "\n",
      "- \uc774 \ub3d9\uc601\uc0c1\uc5d0 \uad49\uc7a5\ud788 \uc7ac\ubbf8\uc788\ub294 \uac83\ub4e4\uc774 \ub9ce\uc774 \uc18c\uac1c\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4. \ucd94\ucc9c\ud569\ub2c8\ub2e4."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "YouTubeVideo('t_TzRaK9kpU')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "html": [
        "\n",
        "        \n",
        "        "
       ],
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 5,
       "text": [
        ""
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## [About my IPython in github](https://github.com/re4lfl0w/ipython)"
     ]
    }
   ],
   "metadata": {}
  }
 ]
}