From jurgis.pralgauskis at gmail.com Thu Mar 8 06:02:51 2018
From: jurgis.pralgauskis at gmail.com (Jurgis Pralgauskis)
Date: Thu, 8 Mar 2018 13:02:51 +0200
Subject: [Edu-sig] Online Python (and other scripts) debug tool
(onlinegdb.com)
Message-ID:
Nice for education purposes :)
https://www.onlinegdb.com/blog/introducing-python-debugger-mode-with-pdb-console/
--
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From wes.turner at gmail.com Thu Mar 8 11:25:46 2018
From: wes.turner at gmail.com (Wes Turner)
Date: Thu, 8 Mar 2018 11:25:46 -0500
Subject: [Edu-sig] Online Python (and other scripts) debug tool
(onlinegdb.com)
In-Reply-To:
References:
Message-ID:
+1 Do ipdb or pdb++ work?
https://github.com/gotcha/ipdb
https://pypi.org/project/ipdb
import ipdb
ipdb.set_trace()
https://github.com/antocuni/pdb
https://pypi.org/project/pdbpp/
pdb.set_trace()
breakpoint() # Python 3.7+
... https://github.com/quobit/awesome-python-in-education
#interactive-environments #debuggers
On Thursday, March 8, 2018, Jurgis Pralgauskis
wrote:
> Nice for education purposes :)
> https://www.onlinegdb.com/blog/introducing-python-debugger-mode-with-pdb-
> console/
>
> --
> Jurgis Pralgauskis
> tel: 8-616 77613;
> Don't worry, be happy and make things better ;)
> http://galvosukykla.lt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From kirby.urner at gmail.com Tue Mar 20 13:47:13 2018
From: kirby.urner at gmail.com (kirby urner)
Date: Tue, 20 Mar 2018 10:47:13 -0700
Subject: [Edu-sig] generic objects (including lambdas) as dict keys?: not
usually a problem
Message-ID:
I just discovered for myself what many must already know: lambda
expressions may serve as dict keys (I knew values). That means they may
partake of the mutability of some functions, in having mutable default
parameter values.
In [122]: d = {lambda x=[10]: print(x.append(11), x) : 3}
In [123]: list(d.keys())[0]()
None [10, 11]
In [124]: list(d.keys())[0]()
None [10, 11, 11]
In [125]: list(d.keys())[0]()
None [10, 11, 11, 11]
In [126]: list(d.keys())[0]()
None [10, 11, 11, 11, 11]
That's not going to corrupt the dict though. In general, callable objects
may serve as keys, with lambda expressions a special case. So what if the
object points to mutable content.
In [127]: class Callable:
...: def __init__(self):
...: self.the_list = []
...: def __call__(self, *args):
...: self.the_list.extend(args)
In [128]: obj = Callable()
In [129]: the_dict = {obj : 3}
In [130]: list(the_dict.keys())[0]("troll farm")
In [131]: obj.__dict__
Out[131]: {'the_list': ['troll farm']}
On the other hand, if you define __eq__ vis-a-vis something mutable, then
the dict-maker will have 2nd thoughts about the viability of your
enterprise.
So nothing that earth-shaking. It's the Python we all know.
Just thought I'd say hi. More soon.
Kirby Urner
Portland, OR
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From kirby.urner at gmail.com Fri Mar 23 01:53:02 2018
From: kirby.urner at gmail.com (kirby urner)
Date: Thu, 22 Mar 2018 22:53:02 -0700
Subject: [Edu-sig] still admiring J
Message-ID:
Greetings edu-siggers!
Way back in the archives you'll find me extolling a language known as J, by
Kenneth Iverson, his son Eric, and Roger Hui. I never met any of these guys
in person, but knew of Iverson through APL, which I discovered at
Princeton, and fell in love with. Iverson helped me squish some typos in
my Jiving with J.[1]
What I admire about J, as about R and Python via Numpy, is the inclusion of
an n-Dimensional Block (array, addressable memory with multiple axes), as a
language native, a core star. J reads like a right-to-left pipeline with
an nD Block going through it. I guess we'd need to call that a Functional
Programming language right?
As the former high school math teacher (long ago -- though I'm still in the
schools, as recently as today in fact, as an after school Python
instructor), I still chafe at the fact that we don't dive in with these
tools at that age level, except in rare cases, and instead insist on
students buying all those TIs year after year. But that's me the broken
record.
For those schools that break out, charter or public (nevermind, how they
talk in the US makes noooo sense), there's a world of wonderful technology
to explore, while learning the math that matters. y = mx + b. Turn m over
for w, and b is for bias.[2]
Kirby
[1] http://www.4dsolutions.net/ocn/Jlang.html
[2]
https://www.google.com/search?q=mcdonalds+upside+down+w&safe=off&source=lnms&tbm=isch
(recent meme)
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From wes.turner at gmail.com Fri Mar 23 04:33:57 2018
From: wes.turner at gmail.com (Wes Turner)
Date: Fri, 23 Mar 2018 04:33:57 -0400
Subject: [Edu-sig] still admiring J
In-Reply-To:
References:
Message-ID:
On Friday, March 23, 2018, kirby urner wrote:
>
> Greetings edu-siggers!
>
> Way back in the archives you'll find me extolling a language known as J,
> by Kenneth Iverson, his son Eric, and Roger Hui. I never met any of these
> guys in person, but knew of Iverson through APL, which I discovered at
> Princeton, and fell in love with. Iverson helped me squish some typos in
> my Jiving with J.[1]
>
> What I admire about J, as about R and Python via Numpy, is the inclusion
> of an n-Dimensional Block (array, addressable memory with multiple axes),
> as a language native, a core star.
>
xarray.Dataset is n-dimensional
https://xarray.pydata.org/en/stable/
>From a tweet a few days ago
https://twitter.com/westurner/status/973058715149578240 :
Exercise:
- Describe the 3D vertices of a cube: (x,y,z).
- Apply a linear transformation (e.g. rotation): (t, x, y, z)
- Determine how to project 3D points into 2D (first with wireframes, then
with clipping)
#Mayavi and #Blender can do 3D + time in Python.
#Matplotlib can do 2D animated GIFs and, with #mplot3d, 3D animated GIFs
And then view point density from one perspective with a hexbin chart and
binned marginal distributions
https://t.co/59fO6c6JSf
#hexbin plot w/ marginal distributions #seaborn
https://t.co/FHe3L4oOSw https://t.co/K6WI8NcF4i
2D "Linear transformations and matrices | Essence of linear algebra,
chapter 3" by @3Blue1Brown
https://youtube.com/watch?v=kYB8IZa5AuE
... And then special relativity and Lorentz transformations of spacetime
with tensors: https://en.wikipedia.org/wiki/Lorentz_transformation
"Lorentz transformation for change in coordinates | Physics | Khan Academy"
https://youtube.com/watch?v=1F1tFouUGTU
"Introduction to the Lorentz transformation | Special relativity | Physics
| Khan Academy"
https://youtube.com/watch?v=HIQ5hnm61LQ
... With time t, the cube exercise coordinates are really 4D (*), but they
can be projected into a table with columns like:
t, v1x, v1y, v1z, ..., v8x, v8y, v8z
This (and other multidimensional data) can be represented with
pandas.DataFrame or pandas.Panel, though pandas.Panel is being deprecated
in favor of xarray or just multidimensional indices and pd.DataFrame:
https://pandas.pydata.org/pandas-docs/stable/dsintro.html#deprecate-panel
* Actually, it's all 2D: https://en.wikipedia.org/wiki/Holographic_principle
> In a larger sense, the theory suggests that the entire universe can be
seen as two-dimensional information on the cosmological horizon, the event
horizon from which information may still be gathered and not lost due to
the natural limitations of spacetime supporting a black hole, an observer
and a given setting of these specific elements,[clarification needed] such
that the three dimensions we observe are an effective description only at
macroscopic scales and at low energies. Cosmological holography has not
been made mathematically precise, partly because the particle horizon has a
non-zero area and grows with time.
>
> J reads like a right-to-left pipeline with an nD Block going through it.
> I guess we'd need to call that a Functional Programming language right?
>
> As the former high school math teacher (long ago -- though I'm still in
> the schools, as recently as today in fact, as an after school Python
> instructor), I still chafe at the fact that we don't dive in with these
> tools at that age level, except in rare cases, and instead insist on
> students buying all those TIs year after year. But that's me the broken
> record.
>
> For those schools that break out, charter or public (nevermind, how they
> talk in the US makes noooo sense), there's a world of wonderful technology
> to explore, while learning the math that matters. y = mx + b. Turn m over
> for w, and b is for bias.[2]
>
> Kirby
>
> [1] http://www.4dsolutions.net/ocn/Jlang.html
>
> [2] https://www.google.com/search?q=mcdonalds+upside+down+w&
> safe=off&source=lnms&tbm=isch (recent meme)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From kirby.urner at gmail.com Fri Mar 23 15:12:25 2018
From: kirby.urner at gmail.com (kirby urner)
Date: Fri, 23 Mar 2018 12:12:25 -0700
Subject: [Edu-sig] still admiring J
In-Reply-To:
References:
Message-ID:
On Fri, Mar 23, 2018 at 1:33 AM, Wes Turner wrote:
>
> xarray.Dataset is n-dimensional
> https://xarray.pydata.org/en/stable/
>
> From a tweet a few days ago https://twitter.com/westurner/
> status/973058715149578240 :
>
>
?Excellent pointers!
I anticipate a steady stream of new math teachers (sort of like I was some
decades back, teaching high school level in Jersey City, first job outta
college), and getting to where they're hungry to include more coding, and
need appropriately mathy topics.
Lots out there already, a steadily growing stash since the early days, of
Logo and OLPC (One Laptop per Child), SugarLabs... The Learning to Code
movement (code.org etc.) is but the latest in a series of chapters.
BTW, one of my code school mentors just showed me this one:
http://www.codebymath.com/index.php/welcome/lesson_menu
My own contributions to this genre go back to what I called the "Numeracy
Series". That's closer to when I first came across Python. I'd already
played with "quadrays" in Visual Foxpro.[0]
http://4dsolutions.net/ocn/numeracy0.html (that's part 1 of 4, early 2000s)
I was into mixing Python with POV-Ray, the free ray-tracer, to get simple
geometric figures.
These days mathy high school level topics might include...
-----
*1* Crypto: a gateway to group theory. Since my day, we've added more to
the "fun reading" shelf, such as with Cryptonomicon (Stephenson, historical
science fiction) and The Theory that Would Not Die (i.e. Bayesianism) by
McGrayne. As clear from the cover (https://flic.kr/p/22z1vAy) she's
covering a lot of the same territory: Bletchley Park, Alan Turing, enigma
machines. You've got prime numbers, RSA, Elliptic Curves and hashlib SHA
stuff. Introduce blockchain. A great way to access recent history.
*2* Geometry: and in my case a genre of "mental geometry". My topic is the
somewhat off-beat solid geometry of the geodesic dome dude (another movie
coming up [2]), and my modality is often Python. One of the slides shows a
Tetrahedron class with our formula for its volume, a public sandbox at
REPL.IT. https://repl.it/@kurner/tetravolumes
I don't remember if I've already shared this link ( https://goo.gl/zoVYF1 )
to my slide deck (Google Slides) for a recent talk at Systems Science
building, Portland State [1].
That's probably still too off beat for most, whereas Fractals (dynamical
systems, strange attractors, Wolfram automata), if counted as "geometry"
(certainly visual) already have a strong following and both connect back to
deeper math. I've done work around those topics too and attest to Python's
applicability.
*3* Data Science: which is where the nD-array ("xray", "tensor") and
Linear Algebra come in, and Calculus (which they're learning anyway). When
not connect Calc to Stats with a thicker pipeline right from the start?
So what if the Gaussian Distribution doesn't have a closed form integral or
whatever (https://goo.gl/9XyzN5 )? Not an issue. We just wanna make sense
of the curves in some lessons, and both the CDF (the integral) and
derivative of the PDF (normal curve) are worth talking about visually, and
coding in Python.[3]
-----
In sum: if you're a math teacher chomping at the bit for something fresh,
and not already over-exploited by the test-maker economy (you still have a
free hand), then we have riches in:
Crypto (web browser TLS, eCommerce, Supermarket Math [4]);
Geometry, including off-beat whole-number volumed polyhedrons from New
England Transcendentalist literature (v 2.0);
Machine Learning / Data Science. All accessible to high schoolers.
Kirby
[0] Quadrays are a weird coordinate system featuring a "caltrop" of basis
rays to tetrahedron corner points (1,0,0,0) (0,1,0,0) (0,0,1,0) (0,0,0,1)
from origin (0,0,0,0) -- but there's nothing "4D" in the sense of
non-visualizable hyper-dimensional, just ordinary space mapping, 1-to-1
with XYZ if you stick to the unique canonical representation.
http://mathforum.org/library/view/6236.html
[1] http://worldgame.blogspot.com/2018/03/systems-science.html
[2] https://youtu.be/oyLWPWydvyo
[3] one of my Jupyter Notebooks about the bell curve:
https://github.com/4dsolutions/Python5/blob/master/BellCurve.ipynb
?
?[4] http://wikieducator.org/Supermarket_Math
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From wes.turner at gmail.com Fri Mar 23 16:29:41 2018
From: wes.turner at gmail.com (Wes Turner)
Date: Fri, 23 Mar 2018 16:29:41 -0400
Subject: [Edu-sig] still admiring J
In-Reply-To:
References:
Message-ID:
On Friday, March 23, 2018, kirby urner wrote:
>
> On Fri, Mar 23, 2018 at 1:33 AM, Wes Turner wrote:
>
>>
>> xarray.Dataset is n-dimensional
>> https://xarray.pydata.org/en/stable/
>>
>> From a tweet a few days ago https://twitter.com/westurner/
>> status/973058715149578240 :
>>
>>
> ?Excellent pointers!
>
> I anticipate a steady stream of new math teachers (sort of like I was some
> decades back, teaching high school level in Jersey City, first job outta
> college), and getting to where they're hungry to include more coding, and
> need appropriately mathy topics.
>
> Lots out there already, a steadily growing stash since the early days, of
> Logo and OLPC (One Laptop per Child), SugarLabs... The Learning to Code
> movement (code.org etc.) is but the latest in a series of chapters.
>
> BTW, one of my code school mentors just showed me this one:
> http://www.codebymath.com/index.php/welcome/lesson_menu
>
> My own contributions to this genre go back to what I called the "Numeracy
> Series". That's closer to when I first came across Python. I'd already
> played with "quadrays" in Visual Foxpro.[0]
>
> http://4dsolutions.net/ocn/numeracy0.html (that's part 1 of 4, early
> 2000s)
>
> I was into mixing Python with POV-Ray, the free ray-tracer, to get simple
> geometric figures.
>
> These days mathy high school level topics might include...
>
> -----
>
> *1* Crypto: a gateway to group theory. Since my day, we've added more to
> the "fun reading" shelf, such as with Cryptonomicon (Stephenson, historical
> science fiction) and The Theory that Would Not Die (i.e. Bayesianism) by
> McGrayne. As clear from the cover (https://flic.kr/p/22z1vAy) she's
> covering a lot of the same territory: Bletchley Park, Alan Turing, enigma
> machines. You've got prime numbers, RSA, Elliptic Curves and hashlib SHA
> stuff. Introduce blockchain. A great way to access recent history.
>
"Show HN: An educational blockchain implementation in Python"
https://news.ycombinator.com/item?id=15945490
https://github.com/julienr/ipynb_playground/blob/master/bitc
oin/dumbcoin/dumbcoin.ipynb
https://cryptography.io/en/latest/
recommends
https://www.crypto101.io/ (PDF)
https://github.com/pyca/cryptography/blob/master/src/cryptography/hazmat/
primitives/ciphers/algorithms.py
https://en.wikipedia.org/wiki/Fermat%27s_little_theorem
https://en.wikipedia.org/wiki/RSA_(cryptosystem)
"How secure is 256 bit security?" by @3blue1brown
https://youtu.be/S9JGmA5_unY
https://en.wikipedia.org/wiki/EdDSA#Ed25519
> *2* Geometry: and in my case a genre of "mental geometry". My topic is
> the somewhat off-beat solid geometry of the geodesic dome dude (another
> movie coming up [2]), and my modality is often Python. One of the slides
> shows a Tetrahedron class with our formula for its volume, a public sandbox
> at REPL.IT. https://repl.it/@kurner/tetravolumes
>
> I don't remember if I've already shared this link ( https://goo.gl/zoVYF1
> ) to my slide deck (Google Slides) for a recent talk at Systems Science
> building, Portland State [1].
>
> That's probably still too off beat for most, whereas Fractals (dynamical
> systems, strange attractors, Wolfram automata), if counted as "geometry"
> (certainly visual) already have a strong following and both connect back to
> deeper math. I've done work around those topics too and attest to Python's
> applicability.
>
Fractals... Mandelbrot
https://en.wikipedia.org/wiki/Chaos:_Making_a_New_Science
IDK what's a good Python package for fractals?
>
>
> *3* Data Science: which is where the nD-array ("xray", "tensor") and
> Linear Algebra come in, and Calculus (which they're learning anyway). When
> not connect Calc to Stats with a thicker pipeline right from the start?
> So what if the Gaussian Distribution doesn't have a closed form integral
> or whatever (https://goo.gl/9XyzN5 )? Not an issue. We just wanna make
> sense of the curves in some lessons, and both the CDF (the integral) and
> derivative of the PDF (normal curve) are worth talking about visually, and
> coding in Python.[3]
>
http://docs.sympy.org/latest/modules/stats.html#sympy.stats.Normal
http://docs.sympy.org/latest/modules/integrals/integrals.html
>
>
> -----
>
>
>
In sum: if you're a math teacher chomping at the bit for something fresh,
> and not already over-exploited by the test-maker economy (you still have a
> free hand), then we have riches in:
>
> Crypto (web browser TLS, eCommerce, Supermarket Math [4]);
>
> Geometry, including off-beat whole-number volumed polyhedrons from New
> England Transcendentalist literature (v 2.0);
>
> Machine Learning / Data Science. All accessible to high schoolers.
>
https://www.kaggle.com/learn
https://jakevdp.github.io/PythonDataScienceHandbook/
https://developers.google.com/machine-learning/crash-course/ml-intro
> Kirby
>
> [0] Quadrays are a weird coordinate system featuring a "caltrop" of basis
> rays to tetrahedron corner points (1,0,0,0) (0,1,0,0) (0,0,1,0) (0,0,0,1)
> from origin (0,0,0,0) -- but there's nothing "4D" in the sense of
> non-visualizable hyper-dimensional, just ordinary space mapping, 1-to-1
> with XYZ if you stick to the unique canonical representation.
> http://mathforum.org/library/view/6236.html
>
> [1] http://worldgame.blogspot.com/2018/03/systems-science.html
>
> [2] https://youtu.be/oyLWPWydvyo
>
> [3] one of my Jupyter Notebooks about the bell curve:
> https://github.com/4dsolutions/Python5/blob/master/BellCurve.ipynb
>
> ?
> ?[4] http://wikieducator.org/Supermarket_Math
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From aivar.annamaa at ut.ee Wed Mar 28 03:18:54 2018
From: aivar.annamaa at ut.ee (Aivar Annamaa)
Date: Wed, 28 Mar 2018 10:18:54 +0300
Subject: [Edu-sig] Simplest webapps
Message-ID: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
Hi!
Let's say my students are able to write programs like this:
name = input("name")
if name == "Pete":
??? greeting = "Hi"
else:
??? greeting = "Hello!"
print(f"""
{greeting} {name}!
""")
I'd like to allow them start writing web-apps without introducing
functions first (most web-frameworks require functions).
It occurred to me that it's not hard to create a wrapper, which presents
this code as a web-app (input would be patched to look up GET or POST
parameters with given name).
This approach would allow simple debugging of the code on local machine
and no extra libraries are required in this phase.
Any opinions on this? Has this been tried before?
best regards,
Aivar
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From andre.roberge at gmail.com Wed Mar 28 06:08:40 2018
From: andre.roberge at gmail.com (Andre Roberge)
Date: Wed, 28 Mar 2018 07:08:40 -0300
Subject: [Edu-sig] Simplest webapps
In-Reply-To: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
References: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
Message-ID:
See below for comments.
On Wed, Mar 28, 2018 at 4:18 AM, Aivar Annamaa wrote:
> Hi!
> Let's say my students are able to write programs like this:
>
> name = input("name")
>
> if name == "Pete":
> greeting = "Hi"
> else:
> greeting = "Hello!"
>
> print(f"""
>
>
> {greeting} {name}!
>
>
> """)
>
> I'd like to allow them start writing web-apps without introducing
> functions first (most web-frameworks require functions).
>
input() and print() *are* functions. And they are not even the simplest
possible functions as they require arguments. Since input and print are not
normally used that way in web apps, I would use the appropriate functions
from a web framework.
> It occurred to me that it's not hard to create a wrapper, which presents
> this code as a web-app (input would be patched to look up GET or POST
> parameters with given name).
>
Python's input() function is something that interactively prompts the user
for input, generally asking a question and expecting the user to enter an
answer. If you patch it to use a GET or POST, you transform it into
something that is no longer interactive, but passively read from some other
source.
Brython (a web-based Python implementation) uses a javascript prompt() as
a hook for Python's input - thus reproducing the intent of the input()
function.
> This approach would allow simple debugging of the code on local machine
> and no extra libraries are required in this phase.
>
> Any opinions on this?
>
My first impression is that wanting to have students write web apps as
their introduction to Python is needlessly complicating things for them as
it tries to do too much all at once. My preferred approach is based on
Pattis's Karel the robot which *starts* with simple functions, requiring no
arguments, and build from there. (See http://reeborg.ca/reeborg.html for
an example; tutorial at http://reeborg.ca/docs/en/.)
> Has this been tried before?
>
Not that I aware of.
Best of luck,
Andr?
> best regards,
> Aivar
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> https://mail.python.org/mailman/listinfo/edu-sig
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From sebastian at fuentelibre.org Wed Mar 28 09:33:46 2018
From: sebastian at fuentelibre.org (Sebastian Silva)
Date: Wed, 28 Mar 2018 08:33:46 -0500
Subject: [Edu-sig] Simplest webapps
In-Reply-To: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
References: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
Message-ID: <41f2424c-9cf0-17b1-a35f-dfdc4122c118@fuentelibre.org>
Hi,
I wrote a Python IDE / runner for the web, that supports the code you
wrote as-is: https://educa.juegos/
As Andre Roberge, `input` works like `prompt` in Javascript.
You can try copy pasting the code in the IDE - your feedback is welcome
at the repository .
It will be hard to avoid functions in Javascript since it wants to use
callback functions all the time.
Regards,
Sebastian
On 28/03/18 02:18, Aivar Annamaa wrote:
>
> Hi!
>
> Let's say my students are able to write programs like this:
>
> name = input("name")
>
> if name == "Pete":
> ??? greeting = "Hi"
> else:
> ??? greeting = "Hello!"
>
> print(f"""
>
>
> {greeting} {name}!
>
>
> """)
>
> I'd like to allow them start writing web-apps without introducing
> functions first (most web-frameworks require functions).
>
> It occurred to me that it's not hard to create a wrapper, which
> presents this code as a web-app (input would be patched to look up GET
> or POST parameters with given name).
>
> This approach would allow simple debugging of the code on local
> machine and no extra libraries are required in this phase.
>
> Any opinions on this? Has this been tried before?
>
> best regards,
> Aivar
>
>
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> https://mail.python.org/mailman/listinfo/edu-sig
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From kirby.urner at gmail.com Fri Mar 30 14:05:38 2018
From: kirby.urner at gmail.com (kirby urner)
Date: Fri, 30 Mar 2018 11:05:38 -0700
Subject: [Edu-sig] Simplest webapps
In-Reply-To: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
References: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
Message-ID:
Hi Aivar --
I think it's a fine idea to write simple Python scripts that write HTML
files, which you may then pull up in the browser.
There's no need to put a server behind static web pages. So, for example,
I'll have my students write a page of bookmarks:
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 4 18:02:30 2015
@author: Kirby Urner
"""
# tuple of tuples
bookmarks = (
("Anaconda.org", "http://anaconda.org"),
("Python.org", "http://python.org"),
("Python Docs", "https://docs.python.org/3/"),
("Spaghetti Code", "http://c2.com/cgi/wiki?SpaghettiCode"),
("Structured Programming", "http://c2.com/cgi/wiki?StructuredProgramming
"),
("Map of Languages", "
http://archive.oreilly.com/pub/a/oreilly//news/languageposter_0504.html"),
("XKCD", "http://xkcd.com"),
)
page = '''\
{}
'''
html = """\
Bookmarks for Python
Bookmarks
""".lower()
the_body = ""
for place, url in bookmarks:
the_body += "{}\n".format(url, place)
webpage = open("links.html", "w")
print(page.format(html.format(the_body)), file=webpage)
webpage.close()
All you need add to your example is using print() to save to a file, so the
browser has something to open.
I would not call this a "web app" yet it's instructive in showing how
Python can write HTML files.
Kirby
On Wed, Mar 28, 2018 at 12:18 AM, Aivar Annamaa wrote:
> Hi!
> Let's say my students are able to write programs like this:
>
> name = input("name")
>
> if name == "Pete":
> greeting = "Hi"
> else:
> greeting = "Hello!"
>
> print(f"""
>
>
> {greeting} {name}!
>
>
> """)
>
> I'd like to allow them start writing web-apps without introducing
> functions first (most web-frameworks require functions).
>
> It occurred to me that it's not hard to create a wrapper, which presents
> this code as a web-app (input would be patched to look up GET or POST
> parameters with given name).
>
> This approach would allow simple debugging of the code on local machine
> and no extra libraries are required in this phase.
>
> Any opinions on this? Has this been tried before?
>
> best regards,
> Aivar
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> https://mail.python.org/mailman/listinfo/edu-sig
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From kirby.urner at gmail.com Fri Mar 30 15:02:06 2018
From: kirby.urner at gmail.com (kirby urner)
Date: Fri, 30 Mar 2018 12:02:06 -0700
Subject: [Edu-sig] Simplest webapps
In-Reply-To:
References: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
Message-ID:
Very interesting. I note that free users are relegated to Python 2.7
Server modules can be Python 3.6 (outside the free version)
Client stuff compiles to JavaScript and is approximately 2.7
That's a bit confusing maybe. I try to avoid 2.7 but that's not easy.
In my Coding with Kids work, we use Codesters.com to teach Python, which
depends on Skulpt. Also 2.x ish.
Kirby
On Fri, Mar 30, 2018 at 11:49 AM, Jason Blum wrote:
> http://anvil.works/ is a pretty interesting approach to Python web
> applications.
>
> On Fri, Mar 30, 2018 at 2:05 PM, kirby urner
> wrote:
>
>>
>> Hi Aivar --
>>
>> I think it's a fine idea to write simple Python scripts that write HTML
>> files, which you may then pull up in the browser.
>>
>> There's no need to put a server behind static web pages. So, for
>> example, I'll have my students write a page of bookmarks:
>>
>> # -*- coding: utf-8 -*-
>> """
>> Created on Wed Nov 4 18:02:30 2015
>>
>> @author: Kirby Urner
>> """
>>
>> # tuple of tuples
>> bookmarks = (
>> ("Anaconda.org", "http://anaconda.org"),
>> ("Python.org", "http://python.org"),
>> ("Python Docs", "https://docs.python.org/3/"),
>> ("Spaghetti Code", "http://c2.com/cgi/wiki?SpaghettiCode"),
>> ("Structured Programming", "http://c2.com/cgi/wiki?Struct
>> uredProgramming"),
>> ("Map of Languages", "http://archive.oreilly.com/pu
>> b/a/oreilly//news/languageposter_0504.html"),
>> ("XKCD", "http://xkcd.com"),
>> )
>>
>> page = '''\
>>
>> {}
>> '''
>>
>> html = """\
>>
>>
>> Bookmarks for Python
>>
>>
>> Bookmarks
>>
>>
>>
>>
>> """.lower()
>>
>> the_body = ""
>> for place, url in bookmarks:
>> the_body += "{}\n".format(url, place)
>>
>> webpage = open("links.html", "w")
>> print(page.format(html.format(the_body)), file=webpage)
>> webpage.close()
>>
>> All you need add to your example is using print() to save to a file, so
>> the browser has something to open.
>>
>> I would not call this a "web app" yet it's instructive in showing how
>> Python can write HTML files.
>>
>> Kirby
>>
>>
>>
>> On Wed, Mar 28, 2018 at 12:18 AM, Aivar Annamaa
>> wrote:
>>
>>> Hi!
>>> Let's say my students are able to write programs like this:
>>>
>>> name = input("name")
>>>
>>> if name == "Pete":
>>> greeting = "Hi"
>>> else:
>>> greeting = "Hello!"
>>>
>>> print(f"""
>>>
>>>
>>> {greeting} {name}!
>>>
>>>
>>> """)
>>>
>>> I'd like to allow them start writing web-apps without introducing
>>> functions first (most web-frameworks require functions).
>>>
>>> It occurred to me that it's not hard to create a wrapper, which presents
>>> this code as a web-app (input would be patched to look up GET or POST
>>> parameters with given name).
>>>
>>> This approach would allow simple debugging of the code on local machine
>>> and no extra libraries are required in this phase.
>>>
>>> Any opinions on this? Has this been tried before?
>>>
>>> best regards,
>>> Aivar
>>>
>>> _______________________________________________
>>> Edu-sig mailing list
>>> Edu-sig at python.org
>>> https://mail.python.org/mailman/listinfo/edu-sig
>>>
>>>
>>
>> _______________________________________________
>> Edu-sig mailing list
>> Edu-sig at python.org
>> https://mail.python.org/mailman/listinfo/edu-sig
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From jason.blum at gmail.com Fri Mar 30 14:49:02 2018
From: jason.blum at gmail.com (Jason Blum)
Date: Fri, 30 Mar 2018 14:49:02 -0400
Subject: [Edu-sig] Simplest webapps
In-Reply-To:
References: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
Message-ID:
http://anvil.works/ is a pretty interesting approach to Python web
applications.
On Fri, Mar 30, 2018 at 2:05 PM, kirby urner wrote:
>
> Hi Aivar --
>
> I think it's a fine idea to write simple Python scripts that write HTML
> files, which you may then pull up in the browser.
>
> There's no need to put a server behind static web pages. So, for example,
> I'll have my students write a page of bookmarks:
>
> # -*- coding: utf-8 -*-
> """
> Created on Wed Nov 4 18:02:30 2015
>
> @author: Kirby Urner
> """
>
> # tuple of tuples
> bookmarks = (
> ("Anaconda.org", "http://anaconda.org"),
> ("Python.org", "http://python.org"),
> ("Python Docs", "https://docs.python.org/3/"),
> ("Spaghetti Code", "http://c2.com/cgi/wiki?SpaghettiCode"),
> ("Structured Programming", "http://c2.com/cgi/wiki?
> StructuredProgramming"),
> ("Map of Languages", "http://archive.oreilly.com/pub/a/oreilly//news/
> languageposter_0504.html"),
> ("XKCD", "http://xkcd.com"),
> )
>
> page = '''\
>
> {}
> '''
>
> html = """\
>
>
> Bookmarks for Python
>
>
> Bookmarks
>
>
>
>
> """.lower()
>
> the_body = ""
> for place, url in bookmarks:
> the_body += "{}\n".format(url, place)
>
> webpage = open("links.html", "w")
> print(page.format(html.format(the_body)), file=webpage)
> webpage.close()
>
> All you need add to your example is using print() to save to a file, so
> the browser has something to open.
>
> I would not call this a "web app" yet it's instructive in showing how
> Python can write HTML files.
>
> Kirby
>
>
>
> On Wed, Mar 28, 2018 at 12:18 AM, Aivar Annamaa
> wrote:
>
>> Hi!
>> Let's say my students are able to write programs like this:
>>
>> name = input("name")
>>
>> if name == "Pete":
>> greeting = "Hi"
>> else:
>> greeting = "Hello!"
>>
>> print(f"""
>>
>>
>> {greeting} {name}!
>>
>>
>> """)
>>
>> I'd like to allow them start writing web-apps without introducing
>> functions first (most web-frameworks require functions).
>>
>> It occurred to me that it's not hard to create a wrapper, which presents
>> this code as a web-app (input would be patched to look up GET or POST
>> parameters with given name).
>>
>> This approach would allow simple debugging of the code on local machine
>> and no extra libraries are required in this phase.
>>
>> Any opinions on this? Has this been tried before?
>>
>> best regards,
>> Aivar
>>
>> _______________________________________________
>> Edu-sig mailing list
>> Edu-sig at python.org
>> https://mail.python.org/mailman/listinfo/edu-sig
>>
>>
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> https://mail.python.org/mailman/listinfo/edu-sig
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From perrygrossman2008 at gmail.com Fri Mar 30 16:26:02 2018
From: perrygrossman2008 at gmail.com (Perry Grossman)
Date: Fri, 30 Mar 2018 16:26:02 -0400
Subject: [Edu-sig] probability and statistics demo for kids
In-Reply-To:
References:
Message-ID:
Hi All,
Thanks for the great comments. Sorry for the delay. I have reviewed most of
the materials and will review more. I drafted a presentation plan for next
Friday here:
https://docs.google.com/document/d/1MNIwqjJ2kVS80zy69606TEPLZGy_e-5W0Ae7L5BeaNE/edit?usp=sharing
If you have any more comments let me know.
Perry
On Sat, Feb 24, 2018 at 9:28 PM, kirby urner wrote:
>
>
> On Sat, Feb 24, 2018 at 5:21 PM, Wes Turner wrote:
>
>>
>>
>> +1. "Python Data Science Handbook" (by Jake VanderPlas) is available in
>> print and as free Jupyter notebooks:
>> https://github.com/jakevdp/PythonDataScienceHandbook
>>
>> It covers IPython, NumPy, Pandas, Matplotlib, and Scikit-Learn.
>>
>>
>>
>
> ?Yes! Open on my desk in front of me.
>
> Kirby
>
>
>
--
PerryGrossman2008 at gmail.com
(617) 383-9061
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From wes.turner at gmail.com Sat Mar 31 20:16:51 2018
From: wes.turner at gmail.com (Wes Turner)
Date: Sat, 31 Mar 2018 20:16:51 -0400
Subject: [Edu-sig] Simplest webapps
In-Reply-To:
References: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
Message-ID:
Bottle is a single file web microframework.
https://github.com/bottlepy/bottle
https://github.com/bottlepy/bottle/blob/master/bottle.py
> Example: "Hello World" in a bottle
```python
from bottle import route, run, template
@route('/hello/')
def index(name):
return template('Hello {{name}}!',
name=name)
run(host='localhost', port=8080)
```
There are docs and every function is Ctrl-F'able within bottle.py.
On Friday, March 30, 2018, kirby urner wrote:
>
> Very interesting. I note that free users are relegated to Python 2.7
>
> Server modules can be Python 3.6 (outside the free version)
>
> Client stuff compiles to JavaScript and is approximately 2.7
>
> That's a bit confusing maybe. I try to avoid 2.7 but that's not easy.
>
> In my Coding with Kids work, we use Codesters.com to teach Python, which
> depends on Skulpt. Also 2.x ish.
>
> Kirby
>
>
>
> On Fri, Mar 30, 2018 at 11:49 AM, Jason Blum wrote:
>
>> http://anvil.works/ is a pretty interesting approach to Python web
>> applications.
>>
>> On Fri, Mar 30, 2018 at 2:05 PM, kirby urner
>> wrote:
>>
>>>
>>> Hi Aivar --
>>>
>>> I think it's a fine idea to write simple Python scripts that write HTML
>>> files, which you may then pull up in the browser.
>>>
>>> There's no need to put a server behind static web pages. So, for
>>> example, I'll have my students write a page of bookmarks:
>>>
>>> # -*- coding: utf-8 -*-
>>> """
>>> Created on Wed Nov 4 18:02:30 2015
>>>
>>> @author: Kirby Urner
>>> """
>>>
>>> # tuple of tuples
>>> bookmarks = (
>>> ("Anaconda.org", "http://anaconda.org"),
>>> ("Python.org", "http://python.org"),
>>> ("Python Docs", "https://docs.python.org/3/"),
>>> ("Spaghetti Code", "http://c2.com/cgi/wiki?SpaghettiCode"),
>>> ("Structured Programming", "http://c2.com/cgi/wiki?Struct
>>> uredProgramming"),
>>> ("Map of Languages", "http://archive.oreilly.com/pu
>>> b/a/oreilly//news/languageposter_0504.html"),
>>> ("XKCD", "http://xkcd.com"),
>>> )
>>>
>>> page = '''\
>>>
>>> {}
>>> '''
>>>
>>> html = """\
>>>
>>>
>>> Bookmarks for Python
>>>
>>>
>>> Bookmarks
>>>
>>>
>>>
>>>
>>> """.lower()
>>>
>>> the_body = ""
>>> for place, url in bookmarks:
>>> the_body += "{}\n".format(url, place)
>>>
>>> webpage = open("links.html", "w")
>>> print(page.format(html.format(the_body)), file=webpage)
>>> webpage.close()
>>>
>>> All you need add to your example is using print() to save to a file, so
>>> the browser has something to open.
>>>
>>> I would not call this a "web app" yet it's instructive in showing how
>>> Python can write HTML files.
>>>
>>> Kirby
>>>
>>>
>>>
>>> On Wed, Mar 28, 2018 at 12:18 AM, Aivar Annamaa
>>> wrote:
>>>
>>>> Hi!
>>>> Let's say my students are able to write programs like this:
>>>>
>>>> name = input("name")
>>>>
>>>> if name == "Pete":
>>>> greeting = "Hi"
>>>> else:
>>>> greeting = "Hello!"
>>>>
>>>> print(f"""
>>>>
>>>>
>>>> {greeting} {name}!
>>>>
>>>>
>>>> """)
>>>>
>>>> I'd like to allow them start writing web-apps without introducing
>>>> functions first (most web-frameworks require functions).
>>>>
>>>> It occurred to me that it's not hard to create a wrapper, which
>>>> presents this code as a web-app (input would be patched to look up GET
>>>> or POST parameters with given name).
>>>>
>>>> This approach would allow simple debugging of the code on local machine
>>>> and no extra libraries are required in this phase.
>>>>
>>>> Any opinions on this? Has this been tried before?
>>>>
>>>> best regards,
>>>> Aivar
>>>>
>>>> _______________________________________________
>>>> Edu-sig mailing list
>>>> Edu-sig at python.org
>>>> https://mail.python.org/mailman/listinfo/edu-sig
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Edu-sig mailing list
>>> Edu-sig at python.org
>>> https://mail.python.org/mailman/listinfo/edu-sig
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From wes.turner at gmail.com Sat Mar 31 20:20:57 2018
From: wes.turner at gmail.com (Wes Turner)
Date: Sat, 31 Mar 2018 20:20:57 -0400
Subject: [Edu-sig] Simplest webapps
In-Reply-To:
References: <4bee909c-1437-4ed9-57b7-ce2dd709e0d2@ut.ee>
Message-ID:
Web programming is fun but dangerous.
Things as simple as 'it reads a file off the disk and sends it to the user'
can unintentionally expose every readable file to whoever or whatever can
access localhost.
```python
os.path.join('here', '/etc/shadow')
path = 'here/' + '../../../../etc/shadow'
```
All of the examples in this thread are susceptible to XSS (Cross Site
Scripting) and CSRF (Cross-site Request Forgery). Don't feel bad; many
college web programming courses teach dangerous methods, too.
XSS:
```
x = """
{x}'
"""
Bottle has multiple templating engines which escape user-supplied input (in
order to maintain a separation between data and code).
Like XSS, SQLi is also a 'code injection' issue. pypi:Records can use
SQLAlchemy. Django is a great framework with a built-in ORM that also
escapes SQL queries.
CSRF:
- X posts an XSS to site A that POSTs to site B
- 100 users view site A
- [...]
http://bottle-utils.readthedocs.io/en/latest/csrf.html
https://bottlepy.org/docs/dev/tutorial.html#html-form-handling
OWASP has a lot of information on WebSec:
OWASP Top 10
https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project
The OWASP Vulnerable Web Applications Directory Project (VWAD)
https://github.com/OWASP/OWASP-VWAD
Any program or user on the system can read and write to localhost.
On Saturday, March 31, 2018, Wes Turner wrote:
> Bottle is a single file web microframework.
>
> https://github.com/bottlepy/bottle
> https://github.com/bottlepy/bottle/blob/master/bottle.py
>
> > Example: "Hello World" in a bottle
>
> ```python
> from bottle import route, run, template
>
> @route('/hello/')
> def index(name):
> return template('Hello {{name}}!',
> name=name)
>
> run(host='localhost', port=8080)
> ```
>
> There are docs and every function is Ctrl-F'able within bottle.py.
>
> On Friday, March 30, 2018, kirby urner wrote:
>
>>
>> Very interesting. I note that free users are relegated to Python 2.7
>>
>> Server modules can be Python 3.6 (outside the free version)
>>
>> Client stuff compiles to JavaScript and is approximately 2.7
>>
>> That's a bit confusing maybe. I try to avoid 2.7 but that's not easy.
>>
>> In my Coding with Kids work, we use Codesters.com to teach Python, which
>> depends on Skulpt. Also 2.x ish.
>>
>> Kirby
>>
>>
>>
>> On Fri, Mar 30, 2018 at 11:49 AM, Jason Blum
>> wrote:
>>
>>> http://anvil.works/ is a pretty interesting approach to Python web
>>> applications.
>>>
>>> On Fri, Mar 30, 2018 at 2:05 PM, kirby urner
>>> wrote:
>>>
>>>>
>>>> Hi Aivar --
>>>>
>>>> I think it's a fine idea to write simple Python scripts that write HTML
>>>> files, which you may then pull up in the browser.
>>>>
>>>> There's no need to put a server behind static web pages. So, for
>>>> example, I'll have my students write a page of bookmarks:
>>>>
>>>> # -*- coding: utf-8 -*-
>>>> """
>>>> Created on Wed Nov 4 18:02:30 2015
>>>>
>>>> @author: Kirby Urner
>>>> """
>>>>
>>>> # tuple of tuples
>>>> bookmarks = (
>>>> ("Anaconda.org", "http://anaconda.org"),
>>>> ("Python.org", "http://python.org"),
>>>> ("Python Docs", "https://docs.python.org/3/"),
>>>> ("Spaghetti Code", "http://c2.com/cgi/wiki?SpaghettiCode"),
>>>> ("Structured Programming", "http://c2.com/cgi/wiki?Struct
>>>> uredProgramming"),
>>>> ("Map of Languages", "http://archive.oreilly.com/pu
>>>> b/a/oreilly//news/languageposter_0504.html"),
>>>> ("XKCD", "http://xkcd.com"),
>>>> )
>>>>
>>>> page = '''\
>>>>
>>>> {}
>>>> '''
>>>>
>>>> html = """\
>>>>
>>>>
>>>> Bookmarks for Python
>>>>
>>>>
>>>> Bookmarks
>>>>
>>>>
>>>>
>>>>
>>>> """.lower()
>>>>
>>>> the_body = ""
>>>> for place, url in bookmarks:
>>>> the_body += "{}\n".format(url, place)
>>>>
>>>> webpage = open("links.html", "w")
>>>> print(page.format(html.format(the_body)), file=webpage)
>>>> webpage.close()
>>>>
>>>> All you need add to your example is using print() to save to a file, so
>>>> the browser has something to open.
>>>>
>>>> I would not call this a "web app" yet it's instructive in showing how
>>>> Python can write HTML files.
>>>>
>>>> Kirby
>>>>
>>>>
>>>>
>>>> On Wed, Mar 28, 2018 at 12:18 AM, Aivar Annamaa
>>>> wrote:
>>>>
>>>>> Hi!
>>>>> Let's say my students are able to write programs like this:
>>>>>
>>>>> name = input("name")
>>>>>
>>>>> if name == "Pete":
>>>>> greeting = "Hi"
>>>>> else:
>>>>> greeting = "Hello!"
>>>>>
>>>>> print(f"""
>>>>>
>>>>>
>>>>> {greeting} {name}!
>>>>>
>>>>>
>>>>> """)
>>>>>
>>>>> I'd like to allow them start writing web-apps without introducing
>>>>> functions first (most web-frameworks require functions).
>>>>>
>>>>> It occurred to me that it's not hard to create a wrapper, which
>>>>> presents this code as a web-app (input would be patched to look up
>>>>> GET or POST parameters with given name).
>>>>>
>>>>> This approach would allow simple debugging of the code on local
>>>>> machine and no extra libraries are required in this phase.
>>>>>
>>>>> Any opinions on this? Has this been tried before?
>>>>>
>>>>> best regards,
>>>>> Aivar
>>>>>
>>>>> _______________________________________________
>>>>> Edu-sig mailing list
>>>>> Edu-sig at python.org
>>>>> https://mail.python.org/mailman/listinfo/edu-sig
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Edu-sig mailing list
>>>> Edu-sig at python.org
>>>> https://mail.python.org/mailman/listinfo/edu-sig
>>>>
>>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: