On Tue, 25 Oct 2005, Beni Cherniavsky wrote: > On Tue, 2005-10-25 at 18:52 +0200, Noam Raphael wrote: > > <אני מציע להשתמש בסביבת הפיתון האינטראקטיבית. כך אין צורך להתעסק עם > <ארגומנטים לתוכנית, אלא אפשר לקרוא מיד לפונקציות. חוץ מזה, זה מאפשר > <כשלומדים עוד דברים פשוט להוסיף פונקציות למודול (יעני, קובץ עם > <פונקציות) שכבר קיים, ואז לא צריך לכתוב את הפונקציות שוב. > <חוץ מזה, הסביבה האינטראקטיבית היא טובה מאוד ללימוד סתם ככה - אפשר > <לכתוב משהו וישר לראות מה הוא עושה, ואפשרלנסות את מה שכתבנו בצורות > <שונות מאוד בקלות. > > I heartly agree with Noam.If you want to teach them script-writing and > command-line argument parsing as an end in itself, then writing scripts > is a good idea.But as along as your goal is writing parametrised code > focused on the topic at hand, don't write scripts at all -- write > functions!Functions take parameters (no need to parse anything) and > return values (no need to format results).And they are trivial to > re-use.
the problem with writing things via the interactive prompt, is that they "go away" when you log out. you can't look at a listing of your code (or can you?) - you cannot re-edit a function (or can you?). > If you don't have enough experience with Python's interactive prompt, > you might not realise its power yet.When experimenting with Python > code it's much more convenient than the shell.Heavily relying on > interactive work calls all the stronger for an IDE (like IDLE).If you > are really limited to a textual terminal, there are still some nice > environments (e.g. ipython).I'll study the offerings and give a > reccomendation soon.Perhaps I will even adjust the editor/prompt > keybindings to match one another. please check them and see if they fit the bill. i have some personal disliking for IDEs generally - but if the IDE does not hide the program's structure, and does not require too much teaching, i'll consider using it for the course. > BTW, I suggest that code examples in the reference document be written > with outputs from the interactive prompt.E.g. don't just write:: > > "hello " * 3 > > but write:: > > >>> "hello " * 3 > 'hello hello hello ' are you interested in updating the current document and completing it in this format? i'm in favor ;) > (It's also good policy to run all examples to make sure they are > correct.) i write them in a script and run the script. that's how i like to do things - much easier to edit and repeat the tests this way (and you don't always test things in a FIFO order). -- guy "For world domination - press 1, or dial 0, and please hold, for the creator." -- nob o. dy