[pypy-commit] extradoc extradoc: add numpy example
fijal
noreply at buildbot.pypy.org
Wed Feb 29 21:56:22 CET 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: extradoc
Changeset: r4108:a65e0376519b
Date: 2012-02-29 12:55 -0800
http://bitbucket.org/pypy/extradoc/changeset/a65e0376519b/
Log: add numpy example
diff --git a/talk/pycon2012/tutorial/examples.rst b/talk/pycon2012/tutorial/examples.rst
--- a/talk/pycon2012/tutorial/examples.rst
+++ b/talk/pycon2012/tutorial/examples.rst
@@ -1,12 +1,20 @@
* Refcount example, where it won't work
+ 01_refcount
+
* A simple speedup example and show performance
+ 02_speedup
+
* Show memory consumption how it grows for tight instances
+ 03_memory
+
* Some numpy example (?)
+ 04_numpy
+
* An example how to use execnet
* An example how to use matplotlib
diff --git a/talk/pycon2012/tutorial/examples/04_numpy.py b/talk/pycon2012/tutorial/examples/04_numpy.py
new file mode 100644
--- /dev/null
+++ b/talk/pycon2012/tutorial/examples/04_numpy.py
@@ -0,0 +1,15 @@
+try:
+ import numpypy
+except ImportError:
+ pass
+import numpy
+
+def f():
+ a = numpy.zeros(10000, dtype=float)
+ b = numpy.zeros(10000, dtype=float)
+ c = numpy.zeros(10000, dtype=float)
+ (a + b)[0] = 3
+ (a + b * c)[0] = 3
+ (a + b * c).sum()
+
+f()
More information about the pypy-commit
mailing list