[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-11 Thread Wes Turner
Glad to help! There's so much time to learn during quarantine!
Writing tests for myself because I <3 them so much;
and because they're the missing half of the code.

Like camper_program.py, IPython is a REPL (Read Evaluate Print Loop :)

```bash
$ pip install ipython; ipython
```

```python
>>> ?
>>> %?
>>> %logstart -h
>>> %logstart -o output_from_this.shell.py
```

## Contents
- Quick Git/GitHub tutorial (and a link to the relevant diff of the PR
(after syntax cleanup); should've `git tag` -ed this revision)
- GitLab tutorial
- Jupyter Notebook / JupyterLab keyboard shortcuts

## Quick Git/GitHub tutorial:
- Open the GitHub repo:
  https://github.com/4dsolutions/python_camp

- Navigate to the file:
  - Type `t` to activate the file finder ('?' shows help)
  - Type `camper_`
  - Press 
  https://github.com/4dsolutions/python_camp/blob/master/camper_program.py

- Click the **History** button at the top right
  `git log --oneline ./camper_program.py`
  `git log --pretty=oneline; git log --help`

https://github.com/4dsolutions/python_camp/commits/master/camper_program.py

- Find "CLN: camper_program.py: pyflakes: is False, not in" (b95fff4)
  `git show b95fff4`

- Click the **<>** button to "Browse the repository at this point in the
history"

https://github.com/4dsolutions/python_camp/tree/b95fff439ef3750ad7eaac146f6c97be64f7e2c0
  https://github.com/4dsolutions/python_camp/tree/b95fff4

- Navigate to the `camper_program.py` file:

https://github.com/4dsolutions/python_camp/blob/b95fff439ef3750ad7eaac146f6c97be64f7e2c0/camper_program.py
  https://github.com/4dsolutions/python_camp/blob/b95fff4/camper_program.py

- Compare between commits
  `git diff b95fff4 master -- camper_program.py`

  - vim:
`git difftool --tool=vimdiff b95fff4 master -- camper_program.py` (
requires vim )
  - vscode:
`git difftool -x "code --wait --diff" b95fff4 master --
camper_program.py`

https://stackoverflow.com/questions/51316233/how-can-i-see-git-diff-on-visual-studio-code-side-by-side-file/56237464#56237464

  - github:

https://help.github.com/en/github/committing-changes-to-your-project/comparing-commits

https://github.com/4dsolutions/python_camp/compare/b95fff4..master

- Click the Unified / **Split** button at the top right
- Click the Showing '5 changed files` link
- Click 'camper_program.py' (to jump to that file in the diff)

https://github.com/4dsolutions/python_camp/compare/b95fff4..master?diff=split#diff-eeb571aff0d4c7b51323fda6f2211df7

GitHub Keyboard Shortcuts:
https://help.github.com/en/github/getting-started-with-github/keyboard-shortcuts

...

GitLab's interface is a bit different:

Here's the *merge request* that added Markdown support to HyperKitty:
https://gitlab.com/mailman/hyperkitty/-/merge_requests/160

# Review the pipeline job log
- Click "Pipelines"
- Click the check mark in the status column (or the build number) of the
first row (the most recent GitLab CI Pipeline)
- Click the "py37-django-3.0" job in the Test column
- Scroll through the job log
  - Find "Creating test database for alias 'default'..."
  - Find "Ran 288 tests in 210.467s"

# Review the merge request (the MR diff)
- Click and hold the browser back arrow (to see history); move the mouse to
the merge request page title; release the mouse
- Click the "Changes" tab
- Click the icon to the left of "Compare"

GitLab Keyboard Shortcuts:
https://docs.gitlab.com/ce/user/shortcuts.html
https://docs.gitlab.com/ee/user/shortcuts.html

...
I could create a Jupyter notebook from this almost- Markdown email.
I could've just created a notebook and saved it as markdown manually (or
automatically with jupytext) and pasted it as this email.

To create a notebook from this:

- Single-click at the beginning of this email, Click at the End,
 to Copy
- Create new notebook- Select the first cell, press  (to enter command
mode), then press M (to make a markdown cell)- Press  (to enter edit
mode)
-  to paste-  [  ] to split the cell at
the cursor

Jupyter Notebook keyboard shortcuts:
- Open a notebook
- Help > Keyboard Shortcuts

Jupyter Lab keyboard shortcuts:
-  to open the Command Palette

On Sat, Apr 11, 2020 at 3:56 PM kirby urner  wrote:

>
> Yikes. My attempt at hand-coding markdown links formatting as [word](
> http://address) didn't work well at all in the HyperKitty Mailman3 view,
> my apologies.
>
> Here are the links again, in the order linked...
>
> This thread:
>
> https://mail.python.org/archives/list/edu-sig@python.org/thread/H6KKJR57V7G4CIPDPJ7FUCXWDHMRUYUT/
>
> My context manager pattern:
> https://github.com/4dsolutions/python_camp/blob/master/ContextManager.ipynb
>
>
> Super fluent thanks to Wes (pull requests):
> https://github.com/4dsolutions/python_camp/blob/master/camper_program.py
>
> "Covid Camps" (souvenir):
>  https://flic.kr/p/2iLG2qU
>
> Kirby
>
>
> ___
> Edu-sig mailing list -- edu-sig@python.org
> To unsubscribe send an email to edu-sig-le...@python.org
> 

[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-11 Thread kirby urner
Yikes. My attempt at hand-coding markdown links formatting as [word](
http://address) didn't work well at all in the HyperKitty Mailman3 view, my
apologies.

Here are the links again, in the order linked...

This thread:
https://mail.python.org/archives/list/edu-sig@python.org/thread/H6KKJR57V7G4CIPDPJ7FUCXWDHMRUYUT/

My context manager pattern:
https://github.com/4dsolutions/python_camp/blob/master/ContextManager.ipynb

Super fluent thanks to Wes (pull requests):
https://github.com/4dsolutions/python_camp/blob/master/camper_program.py

"Covid Camps" (souvenir):
 https://flic.kr/p/2iLG2qU

Kirby
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-11 Thread kirby urner
I decided to try replying through the HyperKitty archived interface, where I’ve 
been examining the cosmetics of [our 
thread](https://mail.python.org/archives/list/edu-sig@python.org/thread/H6KKJR57V7G4CIPDPJ7FUCXWDHMRUYUT/
 
)
 to date with a critical eye.  

Also, I see I said “construct manager” a few times when I was meaning “context 
manager” — oh well.

Hyperkitty pops me into an Apple mail client I never use.  Some default Apple 
setting somewhere I suppose I could dig up.  Lets see if this sends or will I 
end up cutting and pasting to Gmail in Chrome.

Yes Wes, you’re pretty close on your educated guess/memory re that 
semi-esoteric species of class (the context manager), wherein ```__enter__``` 
is what actually returns the object of the optional “as” as in:

with DB(“users”) as db:  # <— optional object returned by ```__enter__``` which 
takes no args
indented block
```__exit__``` triggered on exit, has info in args re any exceptions, I use 
*oops to gather up the 3-tuple.
outdented (db stays available but __exit__ will have likely closed the 
connection, e.g. hung up the phone on the database)

The arguments to class DB() go to the optional ```__init__``` as always, 
however ```__enter__``` gets to return the “db” (above) which then becomes 
available to the indented block (suite as Holden calls it) as a potentially 
useful object.  Most typically ```__enter__``` simply returns the self (the 
instance of the context manager class itself). However in principle it’s free 
to return any object it likes, similar to ```__iter__``` (which should at least 
return an iterator, but only self if self is already such, per class generator 
API where ```__next__``` must also be there).

[My 
pattern](https://github.com/4dsolutions/python_camp/blob/master/ContextManager.ipynb
 ) 
is to load up the target object db with a lot of tools for working with the 
database at hand, much as open(filename) may be use with with to create the 
filetype object.  On ```__exit__``` the database closes.  In between, I might 
even db.zap_tables() and db.create_tables().  Sometimes my DB is very 
customized to work with a very specific database. Other times I separate the 
```__enter__``` ```__exit__``` part, could be a parent helper.  The linked 
Notebook gives more context.

Yes, completely agree on Jake Vanderplas as a go to guy for anything both 
pythonic and data scientific.  

From my campsite FAQ:
Q: Where's a good place to begin with data science?
A: Follow Jake Vanderplas  and study his work.

Wes, your pull requests came in smoothly and my current plan is to exhibit this 
program as is, as an example of what [super duper fluent 
Python](https://github.com/4dsolutions/python_camp/blob/master/camper_program.py
 ) 
actually looks like, with unit testing and the whole business.  

I might use git to dig up an old version (say from this last Monday), showing 
how ancient drafts might still be excavated in a repo, and then roll forward 
again, to the way it is now.  That’s what git’s good for kids!

I did the pull request process online for campers to observe, and commented on 
closing the request, how smoothly it all went.

I’m hoping my practice of outlining a course in a hyperlink-rich Jupyter 
Notebook will continue to spread, not that I invented it or anything.  I’m 
telling my campers this generic Notebook technology (not just Jupyter) is what 
their high schools might well be using soon, if not already. 

I’m eager to pack in a lot of serious academic content given these ["covid 
camps”](https://flic.kr/p/2iLG2qU ) aren’t just 
“summer camp”.  They’re a continuation of their ordinary schooling, in a 
homeschooling context.

Kirby 

___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-10 Thread Wes Turner
Here's the list of cookiecutters:
https://cookiecutter.readthedocs.io/en/latest/README.html#a-pantry-full-of-cookiecutters
https://github.com/cookiecutter/cookiecutter#a-pantry-full-of-cookiecutters

One great thing about starting with a cookiecutter is you don't need to
understand how it all works;
`make test` just works, you can configure CI (with e.g. .travis.yml and
tox.ini) and it just works.

It should be pretty easy to create a cookiecutter (or just add a
conditional to the pypackage template) that's setup for GitHub Actions:
https://help.github.com/en/actions

GitHub Classroom builds upon the Pull Request workflow and GitHub Actions
CI (Continuous Integration)
https://classroom.github.com/classrooms

In lieu of explaning how to configure jupytext so that pull request diffs
of notebook.py files are more readable than the notebook.ipynb JSON,
https://jupyterhub.github.io/nbgitpuller/ is ~free, nbgrader is ~free,
CoCalc Courses includes nbgrader and is free
https://cocalc.com/doc/teaching.html

https://cocalc.com/doc/compare.html

On Fri, Apr 10, 2020 at 6:34 PM Wes Turner  wrote:

> That link to GitHub Learning Lab should be: https://lab.github.com/
> - https://lab.github.com/githubtraining/introduction-to-github (57m)
> -
> https://lab.github.com/githubtraining/github-actions:-continuous-integration
> (171m)
> -
> https://lab.github.com/githubtraining/continuous-integration-with-travis-ci
> (79m)
>   - You can generate a whole project skeleton with CI, tests, and all in
> like 2 minutes:
> pip install cookiecutter
> cookiecutter https://github.com/audreyr/cookiecutter-pypackage
> cookiecutter gh:audreyr/cookiecutter-pypackage
> cookiecutter https://github.com/drivendata/cookiecutter-data-science
> - https://lab.github.com/githubtraining/create-a-release-based-workflow
> (90m)
>
> On Fri, Apr 10, 2020 at 5:52 PM Wes Turner  wrote:
>
>>
>>
>> On Fri, Apr 10, 2020 at 4:40 PM kirby urner 
>> wrote:
>>
>>>
>>> Thank you very much for the pull requests Wes!  I got notification by
>>> email.
>>>
>>> They may be against a version that no longer exists, but no matter.
>>> We're gonna poke around live on camera, starting in about 30 minutes. We go
>>> for 2.25 hours with one or two breaks.
>>>
>>
>> Cool. Good timing
>>
>>
>>>
>>> I'm taking my campers right into my mailbox and showing through Github
>>> how it all might work, even if I don't actually make it work.
>>>
>>> I've got the Daniel Shiffman "Git for Poets" playlist queued up through
>>> [the main Notebook](
>>> https://github.com/4dsolutions/python_camp/blob/master/PyCampNextLevel.ipynb
>>> ).
>>>
>>> Providing opportunities to soak up knowledge about Git and Github has
>>> been a primary focus of this camp.
>>>
>>
>> GitHub has resources for learning Git and GitHub:
>> https://try.github.io/
>> https://lab.github.io/
>>
>> I can't recommend Learn Git Branching enough:
>> https://learngitbranching.js.org/
>>
>>
>>>
>>> My two cohorts so far have differed quite a bit in character.
>>>
>>> The first group featured teens eager to dive into deep topics, per the
>>> camp blurb, and got antsy when I didn't talk machine learning right away.
>>> This might be too much a camp for noobs.  I didn't have the Jupyter
>>> Notebook four day outline yet.  They're nervousness is partly what drove me
>>> to get it out there, reassure them our content would match the camp
>>> description.
>>>
>>
>> https://jakevdp.github.io/PythonDataScienceHandbook/
>> https://github.com/jakevdp/PythonDataScienceHandbook
>> - Launch in Binder, Colab links
>>
>>
>>>
>>> The second group is younger, considers itself adept and into
>>> programming, yet is patiently learning a lot of core Python.  One camper
>>> had worked with his dad on solving that "1/3 --> float" problem.  I
>>> incorporated their code verbatim as a part of our shared process.
>>>
>>
>> IMHO, your strategy for finding answers to questions is maybe the most
>> important aspect of learning to code:
>>
>> - find the docs and bookmark them
>> - find the source and bookmark it
>> - list every possible word for the thing you're describing
>> - try adding "double quotes" around certain terms and error messages
>> - exclude with minus: -"this or that"
>>
>> ### Mailing Lists
>> - Google search with "site:mail.python.org" and/or "inurl:" queries
>>   https://www.google.com/search?q=site%3Amail.python.org
>>   (inurl doesn't match mm3-migrated lists too)
>> - Google Groups, if the list is set up there too
>> - Gmail "list:python.org" queries
>>   - This doesn't find messages that you didn't receive because you
>> weren't subscribed yet.
>> - Gmail "from:l...@mail.python.org" queries
>>   - This doesn't find messages that you didn't receive because you
>> weren't subscribed yet.
>> - Markmai:l "list:org.python.edu-sig" queries
>>   https://markmail.org/search/?q=list%3Aorg.python
>>   https://markmail.org/search/?q=list%3Aorg.python.edu-sig
>>
>> [1] "[Edu-sig] Learning Code IRC for kids?"
>> [2] "REQ: HOWTO 

[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-10 Thread Wes Turner
That link to GitHub Learning Lab should be: https://lab.github.com/
- https://lab.github.com/githubtraining/introduction-to-github (57m)
-
https://lab.github.com/githubtraining/github-actions:-continuous-integration
(171m)
-
https://lab.github.com/githubtraining/continuous-integration-with-travis-ci
(79m)
  - You can generate a whole project skeleton with CI, tests, and all in
like 2 minutes:
pip install cookiecutter
cookiecutter https://github.com/audreyr/cookiecutter-pypackage
cookiecutter gh:audreyr/cookiecutter-pypackage
cookiecutter https://github.com/drivendata/cookiecutter-data-science
- https://lab.github.com/githubtraining/create-a-release-based-workflow
(90m)

On Fri, Apr 10, 2020 at 5:52 PM Wes Turner  wrote:

>
>
> On Fri, Apr 10, 2020 at 4:40 PM kirby urner  wrote:
>
>>
>> Thank you very much for the pull requests Wes!  I got notification by
>> email.
>>
>> They may be against a version that no longer exists, but no matter.
>> We're gonna poke around live on camera, starting in about 30 minutes. We go
>> for 2.25 hours with one or two breaks.
>>
>
> Cool. Good timing
>
>
>>
>> I'm taking my campers right into my mailbox and showing through Github
>> how it all might work, even if I don't actually make it work.
>>
>> I've got the Daniel Shiffman "Git for Poets" playlist queued up through
>> [the main Notebook](
>> https://github.com/4dsolutions/python_camp/blob/master/PyCampNextLevel.ipynb
>> ).
>>
>> Providing opportunities to soak up knowledge about Git and Github has
>> been a primary focus of this camp.
>>
>
> GitHub has resources for learning Git and GitHub:
> https://try.github.io/
> https://lab.github.io/
>
> I can't recommend Learn Git Branching enough:
> https://learngitbranching.js.org/
>
>
>>
>> My two cohorts so far have differed quite a bit in character.
>>
>> The first group featured teens eager to dive into deep topics, per the
>> camp blurb, and got antsy when I didn't talk machine learning right away.
>> This might be too much a camp for noobs.  I didn't have the Jupyter
>> Notebook four day outline yet.  They're nervousness is partly what drove me
>> to get it out there, reassure them our content would match the camp
>> description.
>>
>
> https://jakevdp.github.io/PythonDataScienceHandbook/
> https://github.com/jakevdp/PythonDataScienceHandbook
> - Launch in Binder, Colab links
>
>
>>
>> The second group is younger, considers itself adept and into programming,
>> yet is patiently learning a lot of core Python.  One camper had worked with
>> his dad on solving that "1/3 --> float" problem.  I incorporated their code
>> verbatim as a part of our shared process.
>>
>
> IMHO, your strategy for finding answers to questions is maybe the most
> important aspect of learning to code:
>
> - find the docs and bookmark them
> - find the source and bookmark it
> - list every possible word for the thing you're describing
> - try adding "double quotes" around certain terms and error messages
> - exclude with minus: -"this or that"
>
> ### Mailing Lists
> - Google search with "site:mail.python.org" and/or "inurl:" queries
>   https://www.google.com/search?q=site%3Amail.python.org
>   (inurl doesn't match mm3-migrated lists too)
> - Google Groups, if the list is set up there too
> - Gmail "list:python.org" queries
>   - This doesn't find messages that you didn't receive because you weren't
> subscribed yet.
> - Gmail "from:l...@mail.python.org" queries
>   - This doesn't find messages that you didn't receive because you weren't
> subscribed yet.
> - Markmai:l "list:org.python.edu-sig" queries
>   https://markmail.org/search/?q=list%3Aorg.python
>   https://markmail.org/search/?q=list%3Aorg.python.edu-sig
>
> [1] "[Edu-sig] Learning Code IRC for kids?"
> [2] "REQ: HOWTO mailing lists resources"
>
>
>>
>> I've never shared about the construct manager construct with like middle
>> schoolers before, however that's a big part of the plan for today. I
>> [showcase that construct](
>> https://github.com/4dsolutions/python_camp/blob/master/ContextManager.ipynb) 
>> for
>> connecting to / working with / disconnecting from databases (in our case
>> sqlite3 databases).  I tell them they're previewing the high school of
>> tomorrow.
>>
>
> Is this how context managers work?
>
> ```python
> class MyManager:
> def __enter__(*args, **kwargs):
> print("entering")
> print((args, kwargs))
>
>def __exit__(*args, **kwargs):
> print("exiting")
>
>def hello(*args, **kwargs):
>print("hello")
>
> with MyManager(1, two="three") as mgr:
> mgr.hello()
> ```
>
> https://www.google.com/search?client=firefox-b-1-d=site%3Adocs.python.org+context+manager
> -
> https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers
>
> Can't remember whether args go to __init__ to __enter__
>
>
>>
>> The School of Tomorrow is a neighboring repo, and crosslinks (hyperlinks)
>> between that, and this camp, have already appeared.
>>
>> My recommendation 

[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-10 Thread Wes Turner
On Fri, Apr 10, 2020 at 4:40 PM kirby urner  wrote:

>
> Thank you very much for the pull requests Wes!  I got notification by
> email.
>
> They may be against a version that no longer exists, but no matter.  We're
> gonna poke around live on camera, starting in about 30 minutes. We go for
> 2.25 hours with one or two breaks.
>

Cool. Good timing


>
> I'm taking my campers right into my mailbox and showing through Github how
> it all might work, even if I don't actually make it work.
>
> I've got the Daniel Shiffman "Git for Poets" playlist queued up through
> [the main Notebook](
> https://github.com/4dsolutions/python_camp/blob/master/PyCampNextLevel.ipynb
> ).
>
> Providing opportunities to soak up knowledge about Git and Github has been
> a primary focus of this camp.
>

GitHub has resources for learning Git and GitHub:
https://try.github.io/
https://lab.github.io/

I can't recommend Learn Git Branching enough:
https://learngitbranching.js.org/


>
> My two cohorts so far have differed quite a bit in character.
>
> The first group featured teens eager to dive into deep topics, per the
> camp blurb, and got antsy when I didn't talk machine learning right away.
> This might be too much a camp for noobs.  I didn't have the Jupyter
> Notebook four day outline yet.  They're nervousness is partly what drove me
> to get it out there, reassure them our content would match the camp
> description.
>

https://jakevdp.github.io/PythonDataScienceHandbook/
https://github.com/jakevdp/PythonDataScienceHandbook
- Launch in Binder, Colab links


>
> The second group is younger, considers itself adept and into programming,
> yet is patiently learning a lot of core Python.  One camper had worked with
> his dad on solving that "1/3 --> float" problem.  I incorporated their code
> verbatim as a part of our shared process.
>

IMHO, your strategy for finding answers to questions is maybe the most
important aspect of learning to code:

- find the docs and bookmark them
- find the source and bookmark it
- list every possible word for the thing you're describing
- try adding "double quotes" around certain terms and error messages
- exclude with minus: -"this or that"

### Mailing Lists
- Google search with "site:mail.python.org" and/or "inurl:" queries
  https://www.google.com/search?q=site%3Amail.python.org
  (inurl doesn't match mm3-migrated lists too)
- Google Groups, if the list is set up there too
- Gmail "list:python.org" queries
  - This doesn't find messages that you didn't receive because you weren't
subscribed yet.
- Gmail "from:l...@mail.python.org" queries
  - This doesn't find messages that you didn't receive because you weren't
subscribed yet.
- Markmai:l "list:org.python.edu-sig" queries
  https://markmail.org/search/?q=list%3Aorg.python
  https://markmail.org/search/?q=list%3Aorg.python.edu-sig

[1] "[Edu-sig] Learning Code IRC for kids?"
[2] "REQ: HOWTO mailing lists resources"


>
> I've never shared about the construct manager construct with like middle
> schoolers before, however that's a big part of the plan for today. I
> [showcase that construct](
> https://github.com/4dsolutions/python_camp/blob/master/ContextManager.ipynb) 
> for
> connecting to / working with / disconnecting from databases (in our case
> sqlite3 databases).  I tell them they're previewing the high school of
> tomorrow.
>

Is this how context managers work?

```python
class MyManager:
def __enter__(*args, **kwargs):
print("entering")
print((args, kwargs))

   def __exit__(*args, **kwargs):
print("exiting")

   def hello(*args, **kwargs):
   print("hello")

with MyManager(1, two="three") as mgr:
mgr.hello()
```
https://www.google.com/search?client=firefox-b-1-d=site%3Adocs.python.org+context+manager
-
https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers

Can't remember whether args go to __init__ to __enter__


>
> The School of Tomorrow is a neighboring repo, and crosslinks (hyperlinks)
> between that, and this camp, have already appeared.
>
> My recommendation to campers starting from day one is they:
>
> (a) install git locally
> (b) git clone the camp repo
> (c) create a Github account
> (d) fork the camp repo
> (e) git clone the forked camp repo
>
> Then they should treat the (b) structure as something to keep updating
> with git pull.  Treat my version of the repo as read-only.
>

So you have two working directories; instead of one working directory with
multiple remotes (git remote -v)

In my .gitconfig, I have an `r` alias, so I can just type `git r` and it
runs `git remote -v`:
https://github.com/westurner/dotfiles/blob/master/etc/.gitconfig


>
> However, they can modify and elaborate on their own version of the forked
> repo (e), and push changes at will. Harvest ideas from my updates for their
> own works in progress. Share links to their own repos through Zoom chat.
>

Do you give feedback with pull requests?
AFAIU, GitHub Classroom improves the PR for 

[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-10 Thread kirby urner
Thank you very much for the pull requests Wes!  I got notification by
email.

They may be against a version that no longer exists, but no matter.  We're
gonna poke around live on camera, starting in about 30 minutes. We go for
2.25 hours with one or two breaks.

I'm taking my campers right into my mailbox and showing through Github how
it all might work, even if I don't actually make it work.

I've got the Daniel Shiffman "Git for Poets" playlist queued up through
[the main Notebook](
https://github.com/4dsolutions/python_camp/blob/master/PyCampNextLevel.ipynb
).

Providing opportunities to soak up knowledge about Git and Github has been
a primary focus of this camp.

My two cohorts so far have differed quite a bit in character.

The first group featured teens eager to dive into deep topics, per the camp
blurb, and got antsy when I didn't talk machine learning right away. This
might be too much a camp for noobs.  I didn't have the Jupyter Notebook
four day outline yet.  They're nervousness is partly what drove me to get
it out there, reassure them our content would match the camp description.

The second group is younger, considers itself adept and into programming,
yet is patiently learning a lot of core Python.  One camper had worked with
his dad on solving that "1/3 --> float" problem.  I incorporated their code
verbatim as a part of our shared process.

I've never shared about the construct manager construct with like middle
schoolers before, however that's a big part of the plan for today. I
[showcase that construct](
https://github.com/4dsolutions/python_camp/blob/master/ContextManager.ipynb)
for
connecting to / working with / disconnecting from databases (in our case
sqlite3 databases).  I tell them they're previewing the high school of
tomorrow.

The School of Tomorrow is a neighboring repo, and crosslinks (hyperlinks)
between that, and this camp, have already appeared.

My recommendation to campers starting from day one is they:

(a) install git locally
(b) git clone the camp repo
(c) create a Github account
(d) fork the camp repo
(e) git clone the forked camp repo

Then they should treat the (b) structure as something to keep updating with
git pull.  Treat my version of the repo as read-only.

However, they can modify and elaborate on their own version of the forked
repo (e), and push changes at will. Harvest ideas from my updates for their
own works in progress. Share links to their own repos through Zoom chat.

My schedule is such that I'm expected on more week of piloting this
curriculum, then shelving it to work on something more data science
oriented, returning to the kid camp scene in early June.  I'll be looking
for ideas on how a strong data science course should go, assuming beginners
but with some Python experience.  Obviously we'll be using numpy,
matplotlib, sklearn and like that.

Kirby
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-10 Thread Wes Turner
Should've re-read your first message before I replied:

- "CLN: camper_program.py: Cleanup camper program codestyle with black and
pyflakes"
  https://github.com/4dsolutions/python_camp/pull/3
- "TST: camper_program.py: tests and exception handlin"
  https://github.com/4dsolutions/python_camp/pull/4
  - IDK if camper_program_with_tests.py or camper_program_pro.py would be
more or less helpful than just reviewing the (commits in the) PR


https://github.com/4dsolutions/python_camp/blob/master/PyCampNextLevel.ipynb
- Git
  - https://learngitbranching.js.org/ is an excellent interactive resource
for learning git
- Password Hashes
  - argon2 is a chosen cryptographic hash function:
https://en.wikipedia.org/wiki/Argon2
  - Django now defaults to PBKDF2

https://docs.djangoproject.com/en/3.0/topics/auth/passwords/#how-django-stores-passwords
  - https://en.wikipedia.org/wiki/Hashcat is really fast at password hashing
  - Bitcoin has a number of SHA256 implementations; that may be the fastest
int eh whole world
- https://github.com/bitcoin/bitcoin/tree/master/src/crypto
- https://github.com/bitcoin/bitcoin/blob/master/src/crypto/sha256.cpp
- "Dumbcoin - An educational python implementation of a bitcoin-like
blockchain"

https://github.com/julienr/ipynb_playground/blob/master/bitcoin/dumbcoin/dumbcoin.ipynb
- https://en.wikipedia.org/wiki/Hyperledger#Members_and_governance

On Thu, Apr 9, 2020 at 10:30 PM Wes Turner  wrote:

> Are there unit tests for the supported operations?
> Is the UI logic a separate testable unit?
> Does it just fatal exception when parsing fails; or does the REPL loop
> catch the e.g. Value error?
>
> Instead of a CLI eval wrapper with regex, you could use ipywidgets in a
> notebook:
> https://ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html
> https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html
>
> You can pair a notebook to a markdown file with jupytext so that the
> notebook autosaves as markdown, which works with mailman 3 mailing list
> archives
>
> On Thu, Apr 9, 2020, 1:44 PM kirby urner  wrote:
>
>>
>>> Try the following:
>>>
>>> from fractions import Fraction
>>> float(Fraction("1/3"))
>>>
>>> Knowing you, I'm sure you can figure out plenty of useful applications
>>> of this. :-)
>>>
>>> André
>>>
>>>
>> A totally excellent suggestion!
>>
>> I'm going to share that, by bringing campers here on tour, saying "this
>> is where Python educators hang out!"
>>
>> Maybe some of them will want to join us someday.
>>
>> Kirby
>>
>>
>> ___
>> Edu-sig mailing list -- edu-sig@python.org
>> To unsubscribe send an email to edu-sig-le...@python.org
>> https://mail.python.org/mailman3/lists/edu-sig.python.org/
>>
>
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-09 Thread Wes Turner
Are there unit tests for the supported operations?
Is the UI logic a separate testable unit?
Does it just fatal exception when parsing fails; or does the REPL loop
catch the e.g. Value error?

Instead of a CLI eval wrapper with regex, you could use ipywidgets in a
notebook:
https://ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html
https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html

You can pair a notebook to a markdown file with jupytext so that the
notebook autosaves as markdown, which works with mailman 3 mailing list
archives

On Thu, Apr 9, 2020, 1:44 PM kirby urner  wrote:

>
>> Try the following:
>>
>> from fractions import Fraction
>> float(Fraction("1/3"))
>>
>> Knowing you, I'm sure you can figure out plenty of useful applications of
>> this. :-)
>>
>> André
>>
>>
> A totally excellent suggestion!
>
> I'm going to share that, by bringing campers here on tour, saying "this is
> where Python educators hang out!"
>
> Maybe some of them will want to join us someday.
>
> Kirby
>
>
> ___
> Edu-sig mailing list -- edu-sig@python.org
> To unsubscribe send an email to edu-sig-le...@python.org
> https://mail.python.org/mailman3/lists/edu-sig.python.org/
>
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-09 Thread kirby urner
>
>
> Try the following:
>
> from fractions import Fraction
> float(Fraction("1/3"))
>
> Knowing you, I'm sure you can figure out plenty of useful applications of
> this. :-)
>
> André
>
>
A totally excellent suggestion!

I'm going to share that, by bringing campers here on tour, saying "this is
where Python educators hang out!"

Maybe some of them will want to join us someday.

Kirby
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/


[Edu-sig] Re: back to school... "1/3" --> float question, just eval?

2020-04-09 Thread André Roberge
On Thu, Apr 9, 2020 at 2:02 PM kirby urner  wrote:

> Here's a thread I'm starting with my campers taking a PyCamp course.
>
> Yesterday we were co-evolving a calculator driven by looping menu.  It
> does squares and square roots (one of the campers supplied this logic) and
> I was just getting around to introducing the y^x key as some call it, i.e.
> any number to any power, Python's pow(num, exp).
>
> Today we'll pick up where we left off.
>
> We used the shared whiteboard to draw radical signs as I intoned about how
> pow(3, 3) means like ```3 * 3 * 3```.  Math Adventures in Python.  We might
> also say ```3 ** 3``` (and not ```3^3``` like in so many languages).
> sqrt(num) is the same as ```num ** (1/2)``` and we can get the 3rd root of
> 27 with ```27 ** (1/3)```.
>
> [ Sorry for all the markdown by the way, if you're getting a plaintext
> version -- an option I'd advocate for browser based viewers of the archives
> someday (to see what it looked like way back when, Before Markdown). ]
>
> So here's what we're up against:  say I want to raise 10 to the 1/3rd
> power, same as taking a "cube root" of 10 (tetrahedral whatever).  The menu
> prompts:
>
> ```python
>
> num = float(input("Your number please: > "))  # yes a bit dangerous
> exp = float(input("...and your exponent: > "))  #  user wants to do 1/3
> ```
>
> Of course that last statement raises an exception because float("1/3")
> doesn't work (isn't supposed to). What shall we do then?
>


Try the following:

from fractions import Fraction
float(Fraction("1/3"))

Knowing you, I'm sure you can figure out plenty of useful applications of
this. :-)

André



>
> I'm thinking we parse anything that looks like a legal fraction and do the
> floating point conversion from int(p)/int(q).  We won't allow input like
> 2.1/3.6 just int/int.  I've already preached against eval() but if it
> passes my regular expression test first...
>
> Anyway, it's a discussion.  These are like middle schoolers previewing
> high school, at a time when kid focused code schools were under some
> pressure to convert to "everything online".  I used to drive to the schools.
>
> We don't have to use a regexp!  A good excuse to say what these are
> though.  Or test for the pattern but then use split("/") to pry numerator
> from denominator, once we know that'll work?
>
> https://github.com/4dsolutions/python_camp/blob/master/camper_program.py
> (snapshot -- part of the camp is they watch me git pushing updates to the
> camp repo).
>
> Rather perversely, I may set things back between camps i.e. I'll
> deliberately revert the code.
>
> Comments?  Code?
>
> Kirby
>
> PS:  I notice Python 3.8 is being rather more generous in its statistics
> module. Campers who wander from the base camp fire are likely to find
> themselves staring at pdfs and cdfs.
> ___
> Edu-sig mailing list -- edu-sig@python.org
> To unsubscribe send an email to edu-sig-le...@python.org
> https://mail.python.org/mailman3/lists/edu-sig.python.org/
>
___
Edu-sig mailing list -- edu-sig@python.org
To unsubscribe send an email to edu-sig-le...@python.org
https://mail.python.org/mailman3/lists/edu-sig.python.org/