[IPython-dev] [Discuss] [teaching] how do you display updates to code in lessons?
Brian Granger
ellisonbg at gmail.com
Tue Sep 24 12:13:05 EDT 2013
Hi,
I would probably:
* Define the function twice in the notebook, once wrong and once right.
Or:
* Load one or both versions from a separate file using the %load magic.
On Tue, Sep 24, 2013 at 8:07 AM, Aron Ahmadia <aron at ahmadia.net> wrote:
> Perhaps keep the original function in rendered Markdown, then enter/update
> code cells?
>
> You should definitely get the students used to the idea of a non-linear
> notebook *early* in the lesson. They'll be hopeless confused as soon as
> they start trying to jump around otherwise.
>
> A
>
>
> On Tue, Sep 24, 2013 at 11:06 AM, Greg Wilson
> <gvwilson at software-carpentry.org> wrote:
>>
>> Hi,
>> When I'm teaching programming, I often want to show learners a simple or
>> buggy version of a function, discuss its shortcomings, and then update it
>> (often several times in succession). Doing this is straightforward when I
>> teach using Emacs (or some lesser text editor): I just keep the text file
>> containing the code open and edit the function(s) in question. The
>> drawback, of course, is that learners complain about the old version
>> disappearing, so they have no record of how we got to the final program.
>> When I teach with the IPython Notebook, on the other hand, I just add a
>> new cell and re-define the function in question. This leaves footprints,
>> but learners then complain about being confused by having several versions
>> of the function in the notebook. It becomes particularly problematic when I
>> start doing things like executing cells containing test functions, which may
>> come *before* the cell redefining the function, so that:
>>
>> [22] original definition of some_function()
>> [23] tests for some_function()
>> [24] discussion
>> [25] redefinition of some_function()
>>
>> becomes:
>>
>> [22] original definition of some_function()
>> [26] tests for some_function() # I just re-executed this!
>> [24] discussion
>> [25] redefinition of some_function()
>>
>> How do you manage this when you're teaching? Do you:
>>
>> a) never re-define a function
>> b) do it and not worry about it
>> c) something else entirely (if so, what?)
>>
>> Thanks,
>> Greg
>>
>> _______________________________________________
>> Discuss mailing list
>> Discuss at lists.software-carpentry.org
>>
>> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
--
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com
More information about the IPython-dev
mailing list