Share code on github is all well and good, but sharing in a Jupyter
Notebook such as colab.research.google.com makes it executable in your
browser right away!

On Sun, Jun 22, 2025, 2:01 PM Wes Turner via Edu-sig <edu-sig@python.org>
wrote:

> Here's the link to that PR, which makes things testable and then verifies
> with test assertions:
>
> https://github.com/4dsolutions/python_camp/pull/4
>
> ... @staticmethod is for when you want to add a method on a class that
> doesn't take self as the first parameter.
>
> On Sun, Jun 22, 2025, 1:52 PM Wes Turner <wes.tur...@gmail.com> wrote:
>
>> How to best phase in Python?
>>
>> It can check your answers every time something is changed:
>>
>> ```py
>> 1+1
>>
>> print(1+1)
>>
>> x = 1 +1
>> print(x)
>>
>> 1+1 == True
>>
>> print(1+1 == True)
>>
>> assert 1+1 == True
>> print("It did not raise AssertionError")
>>
>> assert 1+1 == False
>> print("This won't run, because AssertionError is an Exception, and
>> control flow is interrupted on Exception")
>>
>>
>> # %%
>> import unittest
>> test = unittest.TestCase()
>>
>> test.assertEqual(1+1, 0)
>> ```
>>
>> We verify our assumptions about types and values of parameters and return
>> values at runtime; we check preconditions and post conditions.
>>
>> I am reminded of camper_program.py from 2020:
>>
>> https://mail.python.org/archives/list/edu-sig@python.org/message/OYZ2QPDYDFRV2PPJXEOHUTFWFPZVOCJO/
>>
>> Maybe a good prompt to lock in that automated testing is much more
>> efficient than attempting to manually test everything after every change:
>>
>> "Write your own test assertion library; starting with `def assertEqual(a,
>> b, msg)`"
>>
>> On Sun, Jun 22, 2025, 1:19 PM kirby urner via Edu-sig <edu-sig@python.org>
>> wrote:
>>
>>>
>>> From an educator's perspective, how to best phase-in Python is often a
>>> core question.
>>>
>>> One answer is: use it the same way you might use a calculator in the
>>> classroom, but show off why it's better.
>>>
>>> An example (new today) of what I share with my student and peer faculty,
>>> perhaps new to Python:
>>>
>>>
>>> https://github.com/4dsolutions/School_of_Tomorrow/blob/master/smod_play.py
>>>
>>> A mix of Python + geometric content already familiar to those using my
>>> curriculum.
>>>
>>> The docstring itself contains a link to the famous Using Python as a
>>> Calculator tutorial at the Python dot org site.
>>>
>>> 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
>>> Member address: wes.tur...@gmail.com
>>>
>> _______________________________________________
> 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
> Member address: calcp...@gmail.com
>
_______________________________________________
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
Member address: arch...@mail-archive.com

Reply via email to