Instead of deciding between Python or Lisp for a programming intro course...What about an intro course that uses *BOTH*? Good idea?

Rustom Mody rustompmody at gmail.com
Wed May 13 01:56:57 EDT 2015


On Wednesday, May 13, 2015 at 10:25:18 AM UTC+5:30, Chris Angelico wrote:
> On Wed, May 13, 2015 at 11:14 AM, Steven D'Aprano wrote:
> > On Wed, 13 May 2015 02:05 am, Chris Angelico wrote:
> >
> >> So if you're writing a library function, it probably shouldn't use
> >> print()... but your application is most welcome to. You usually know
> >> which one you're writing at any given time.
> >
> > You might be, but beginners are not.
> 
> I meant the generic "you" there. A beginner may well not know whether
> to use / or //, whether it's better to use a list or a dict, etc etc
> etc. That's what instructors are for. Make the distinction that
> library functions shouldn't use print but application code can, and
> then examples like this...
> 
> > I'm not sure I accept Rustom's fix for the problem (I think that his cure is
> > worse than the disease), but it is *hard* to get some beginners to use
> > return instead of print:
> >
> > def add_twice(x, y):
> >     """Add twice y to x."""
> >     print x + 2*y
> >
> >
> > sort of thing.
> 
> ... can be answered simply by explaining that "add_twice" ought to be
> written as a library function rather than an application. It's the
> exact same answer as this:

And later

> Yep. I'd also use clear function/procedure names to make it more
> visible, and probably tie this in with loops to show how you can print
> more than one thing but can only return one. (Generators are a more
> advanced topic.)

[Structure of] Library function: basic
Generator: advanced

?¿?¿

If you ask me that's sdrawkcab



More information about the Python-list mailing list