On 10/24/05, guy keren <[EMAIL PROTECTED]> wrote: > > * Don't repeat the same code more then once > > i think you're confusing 2 things here. i was demonstrating 3 _seperate_ > programs - so this is not code-repetition per-ce. > > > * Avoid non relevant command line parsing code > > i had that in order to allow running the program with different > parameters, without altering the code. it is true, however, that in a > script, "changing the code" is not something that should be feared, as > with compiled languages. > > i do have, however, a problem with code that requires changing in order to > change parameters - this is often the difference between scripts that get > used, and scripts that get neglected. once you realise that there's a > difference between the writer of the script and the user of the script - > you tend to favor using command-line arguments. > > in this specific case, your approach might be better. >
אני מציע להשתמש בסביבת הפיתון האינטראקטיבית. כך אין צורך להתעסק עם ארגומנטים לתוכנית, אלא אפשר לקרוא מיד לפונקציות. חוץ מזה, זה מאפשר כשלומדים עוד דברים פשוט להוסיף פונקציות למודול (יעני, קובץ עם פונקציות) שכבר קיים, ואז לא צריך לכתוב את הפונקציות שוב. חוץ מזה, הסביבה האינטראקטיבית היא טובה מאוד ללימוד סתם ככה - אפשר לכתוב משהו וישר לראות מה הוא עושה, ואפשר לנסות את מה שכתבנו בצורות שונות מאוד בקלות. דרך אגב, אני מצטער אם זה כבר הוזכר (לא עקבתי בפירוט אחרי ההתכתבות), אבל ראיתי אתר של קורס תכנות בפיתון לילדים מבוסס משחקים. אולי זה יעזור במשהו. הכתובת היא זו: http://www.livewires.org.uk/python/ וחוץ מזה, אני רוצה לומר שאני חושב שללמד תכנות דרך משחקים זה דבר טוב ומגניב. שנה טובה, נעם
