Instead of deciding between Python or Lisp for a programming intro course...What about an intro course that uses *BOTH*? Good idea?
zipher
dreamingforward at gmail.com
Tue May 12 22:47:39 EDT 2015
On Tuesday, May 12, 2015 at 8:15:07 PM UTC-5, 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'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.
>
> Personally, I think that banning print is only useful if you wish to
> encourage cargo-cult programming:
>
> "Don't use print!"
> "Why not?"
> "My CS lecture said not to use it! I dunno, maybe it has a virus or
> something."
No, no, no. There's a very simple reason that you don't put extraneous I/O into your functions: you want your functions to be as general as possible for the given focus for re-usability. Otherwise, why write as a separate function? It's called separability of domains.
See Hacking with the Tao: http://wiki.hackerspaces.org/Hacking_with_the_Tao.
Mark
More information about the Python-list
mailing list