From d18421fbea42d968dd55c56a6dc4fcbfe5b526cb Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <MichielCottaar@gmail.com>
Date: Sun, 18 Feb 2018 20:04:22 +0000
Subject: [PATCH] debugging example was not crashing...

---
 talks/packages/packages.ipynb | 34 +++++++---------------------------
 talks/packages/packages.md    | 19 ++++++++-----------
 2 files changed, 15 insertions(+), 38 deletions(-)

diff --git a/talks/packages/packages.ipynb b/talks/packages/packages.ipynb
index 934f6f3..aec5c25 100644
--- a/talks/packages/packages.ipynb
+++ b/talks/packages/packages.ipynb
@@ -133,26 +133,7 @@
     "- [Bokeh](https://bokeh.pydata.org/en/latest/) among many others: interactive plots in the browser (i.e., in javascript)\n",
     "\n",
     "## [Ipython](http://ipython.org/)/[Jupyter](https://jupyter.org/) notebook: interactive python environments\n",
-    "Supports:\n",
-    "- run code in multiple languages"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "%%bash\n",
-    "for name in python ruby ; do\n",
-    "    echo $name\n",
-    "done"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
+    "Features:\n",
     "- debugging"
    ]
   },
@@ -164,8 +145,10 @@
    "source": [
     "from scipy import optimize\n",
     "def costfunc(params):\n",
-    "    return 1 / params[0] ** 2\n",
-    "optimize.minimize(costfunc, x0=[0], method='l-bfgs-b')"
+    "    if params[0] <= 0:\n",
+    "        raise ValueError('Input variable is too low')\n",
+    "    return 1 / params[0]\n",
+    "optimize.minimize(costfunc, x0=[3], method='l-bfgs-b')"
    ]
   },
   {
@@ -877,6 +860,7 @@
     "Wrapper around [Cuda](https://developer.nvidia.com/cuda-zone).\n",
     "- The alternative [Pyopencl](https://documen.tician.de/pyopencl/) provides a very similar wrapper around [OpenCL](https://www.khronos.org/opencl/).\n",
     "- Also see [pyopenGL](http://pyopengl.sourceforge.net/): graphics programming in python (used in FSLeyes)\n",
+    "\n",
     "## Testing\n",
     "- [unittest](https://docs.python.org/3.6/library/unittest.html): python built-in testing"
    ]
@@ -1003,6 +987,7 @@
     "- [pylint](https://pypi.python.org/pypi/pylint): most extensive linter\n",
     "- [pyflake](https://pypi.python.org/pypi/pyflakes): if you think pylint is too strict\n",
     "- [pep8](https://pypi.python.org/pypi/pep8): just checks for style errors\n",
+    "\n",
     "### Optional static typing\n",
     "- Document how your method/function should be called\n",
     "  - Static checking of whether your type hints are still up to date\n",
@@ -1049,19 +1034,14 @@
     "- [psychopy](http://www.psychopy.org/): equivalent of psychtoolbox (workshop coming up in April in Nottingham)\n",
     "- [Sphinx](http://www.sphinx-doc.org/en/master/): documentation generator\n",
     "- [Buit-in libraries](https://docs.python.org/3/py-modindex.html)\n",
-    "    - [collections](https://docs.python.org/3.6/library/collections.html): deque, OrderedDict, namedtuple, and more\n",
-    "    - [datetime](https://docs.python.org/3/library/datetime.html): Basic date and time types\n",
     "    - [functools](https://docs.python.org/3/library/functools.html): caching, decorators, and support for functional programming\n",
     "    - [json](https://docs.python.org/3/library/json.html)/[ipaddress](https://docs.python.org/3/library/ipaddress.html)/[xml](https://docs.python.org/3/library/xml.html#module-xml): parsing/writing\n",
-    "    - [itertools](https://docs.python.org/3/library/itertools.html): more tools to loop over sequences\n",
     "    - [logging](https://docs.python.org/3/library/logging.htm): log your output to stdout or a file (more flexible than print statements)\n",
     "    - [multiprocessing](https://docs.python.org/3/library/multiprocessing.html)\n",
     "    - [os](https://docs.python.org/3/library/os.html#module-os)/[sys](https://docs.python.org/3/library/sys.html): Miscellaneous operating system interfaces\n",
     "    - [os.path](https://docs.python.org/3/library/os.path.html)/[pathlib](https://docs.python.org/3/library/pathlib.html): utilities to deal with filesystem paths (latter provides an object-oriented interface)\n",
     "    - [pickle](https://docs.python.org/3/library/pickle.html): Store/load any python object\n",
-    "    - [shutil](https://docs.python.org/3/library/shutil.html): copy/move files\n",
     "    - [subprocess](https://docs.python.org/3/library/subprocess.html): call shell commands\n",
-    "    - [time](https://docs.python.org/3/library/time.html)/[timeit](https://docs.python.org/3/library/timeit.html): Timing your code\n",
     "    - [warnings](https://docs.python.org/3/library/warnings.html#module-warnings): tell people they are not using your code properly"
    ]
   },
diff --git a/talks/packages/packages.md b/talks/packages/packages.md
index 4a2471b..4b63a72 100644
--- a/talks/packages/packages.md
+++ b/talks/packages/packages.md
@@ -72,22 +72,17 @@ Alternatives:
 - [Bokeh](https://bokeh.pydata.org/en/latest/) among many others: interactive plots in the browser (i.e., in javascript)
 
 ## [Ipython](http://ipython.org/)/[Jupyter](https://jupyter.org/) notebook: interactive python environments
-Supports:
-- run code in multiple languages
-```
-%%bash
-for name in python ruby ; do
-    echo $name
-done
-```
-
+Features:
 - debugging
 ```
 from scipy import optimize
 def costfunc(params):
-    return 1 / params[0] ** 2
-optimize.minimize(costfunc, x0=[0], method='l-bfgs-b')
+    if params[0] <= 0:
+        raise ValueError('Input variable is too low')
+    return 1 / params[0]
+optimize.minimize(costfunc, x0=[3], method='l-bfgs-b')
 ```
+
 ```
 %debug
 ```
@@ -564,6 +559,7 @@ Alternatives:
 Wrapper around [Cuda](https://developer.nvidia.com/cuda-zone).
 - The alternative [Pyopencl](https://documen.tician.de/pyopencl/) provides a very similar wrapper around [OpenCL](https://www.khronos.org/opencl/).
 - Also see [pyopenGL](http://pyopengl.sourceforge.net/): graphics programming in python (used in FSLeyes)
+
 ## Testing
 - [unittest](https://docs.python.org/3.6/library/unittest.html): python built-in testing
 ```
@@ -655,6 +651,7 @@ Linters check the code for any syntax errors, [style errors](https://www.python.
 - [pylint](https://pypi.python.org/pypi/pylint): most extensive linter
 - [pyflake](https://pypi.python.org/pypi/pyflakes): if you think pylint is too strict
 - [pep8](https://pypi.python.org/pypi/pep8): just checks for style errors
+
 ### Optional static typing
 - Document how your method/function should be called
   - Static checking of whether your type hints are still up to date
-- 
GitLab