On Mon, 31 Oct 2005, Amit Aronovitch wrote: > guy keren wrote: > > >i think you're forgetting what it was like when you first learned how to > >write programs - using 3rd-party libraries is something you do after you > >master the basics of the language. and you have to begin with learning to > >use simple things first. > > I'm sure I am - that was more than 20 years ago. And I don't think there > were any libraries to speak of...
actually, there were third-party libraries even in the old BASIC days - they were just not called by that name. > You are probably right - probably better to do manual processing than a > new lib. Just keep it short and simple - tedious manual argparsing might > be even more boring. the args parsing i used in the book so far complies with your int(sys.argv[1]) example. > Also, as other people had been saying, you can completely avoid the > subject by using the interpreter, at least for the cases where a script > would require tedious parsing (I mean anything more than > n=int(sys.argv[1]) ). i'm not going to use the interpreter for writing actual things. only for testing very simple expressions. we're not in BASIC days any longer - and thanks goodness for that ;) > >no, i will not tell them this is the way to go - i don't want to spoil > >them to a level that they'll require re-adapting in order to learn C (or > >other compiled langauges) next year. > > That's what I ment by saying that writing a script is an important > skill (goal). > If we stick to the idea of "simpler first", it might be good to start > with demonstrating inside the interpreter,running longer code with > 'execfile', then (one of the first lessons) show how to make it a > script, with the motivation of wanting others to be able to run it "as a > normal program" from the shell. i don't think i'll even mention execfile - i'll just show how to do simple stuff in the interpreter, and the rest using scripts. > >i want them to learn the concept of a program - not of an interactive > >programming environment. python is a tools - not a means. thus, i don't > >want to teach them everything that can be done in python - it's not real > >interesting. those that will want that, will learn all the bits in the > >future on their own. > > > >you should remember that what you achieve here is efficiency. this is not > >relevant for a first programming course - there are more important skills > >to learn first. it's like teaching touch-typing before teaching > >programming, so they'll spend less time typing their programs - it's nice, > >but realy not what they should learn first. > > > > > No - not efficiency - instructive power and ease of use (my specific > efficiency-related comment (keystrokes...) was clearly marked as > directed to argumentative list readers). instructive power - probably. ease of use? that's a matter of taste, no more. > When you have an interpreter open during lecture (/exercise/demo/...) > , and someone asks "why can't we just do x", or "what object does y > refer to at this stage", you just type x or y (possibly pause to ask > what do you think would happen now), then press enter...This is one > *powerful* instructive tool. ok. i'll see if i can work with it fluently enough. > I don't think many poeple would bother to demonstrate these small > things, if it means editing a new file (or "spoiling" the nice'n clean > program they've been editing at the moment with debug messages), saving > it, going back to the shell, and running it. actually, i don't see why. i usually have one terminal with an editor, and another terminal in which i run the script. the work it takes in this setup is no more (sometimes even less) then using a single interactive interpreter session. the editor is much more convenient for editing then the interactive prompt, for me. > Later, when they will be experimenting on their own, you'd want the > interpreter to behave like the shell, so they would not have to learn > two different environments. this is the problem - the interpreter will never behave like the shell. it canbe "close" - but it's still a seperate environment. i don't want to concentrate on this. -- guy "For world domination - press 1, or dial 0, and please hold, for the creator." -- nob o. dy
