Using a function straight off a library might work. So might cropping an
image, which only needs array indexing... The possibilities are endless! =)

On Thu, Dec 3, 2015 at 8:47 PM, Greg Wilson <[email protected]
> wrote:

> I used to teach functions before loops, but then there wasn't anything
> useful to put in the functions :-)
>
>
> On 2015-12-03 9:37 AM, Juan Nunez-Iglesias wrote:
>
> I had trouble with this at our recent workshop in Adelaide. My current
> thinking is that we should introduce for loops *after* functions so that we
> can do something like:
>
> def do_something_useful_to_image(input_image):
>     ...
>
> for each_image in all_images_in_directory:
>     processed_image = do_something_useful_to_image(each_image)
>     save(processed_image)
>
> Obviously I need to work on the output part, so that we can save the
> effect of the loop but not use things like modifying lists in-place, which
> was also confusing to some. But my general idea is to get the for-loop
> reading as close to an Engish sentence as possible. Despite Python's
> strengths, this is difficult to do with builtins.
>
> Juan.
>
> On Thu, Dec 3, 2015 at 8:24 PM, Karin Lagesen <[email protected]>
> wrote:
>
>> The more I teach, the more I realize that I am not really able to convey
>> what a for loop does to everybody. Do any of you have a metaphor or
>> something that you use for teaching it? I explain about variables and
>> collections, and the body of the loop, and I show examples, but I am still
>> not able to get through all the time.
>>
>> Karin
>>
>> _______________________________________________
>> Discuss mailing list
>> [email protected]
>>
>> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
>>
>
>
>
> _______________________________________________
> Discuss mailing 
> [email protected]http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
>
>
> --
> Dr. Greg Wilson    | [email protected]
> Software Carpentry | http://software-carpentry.org
>
>
> _______________________________________________
> Discuss mailing list
> [email protected]
>
> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
>
_______________________________________________
Discuss mailing list
[email protected]
http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org

Reply via email to