Re: Q's on my first python script

2009-05-14 Thread Marius Gedminas
On May 10, 6:56 pm, Steven D'Aprano wrote: > > 4. What's the python way to emit warnings?  (The script below should > >    warn the user that arguments after the first one are ignored.) > > import warnings > warnings.warn("The end of the world is coming!") The warnings module is used for warnings

Re: Q's on my first python script

2009-05-14 Thread Marius Gedminas
On May 11, 12:30 pm, Nick Craig-Wood wrote: >     def __init__(self): >         usage = '''Usage: %prog [options] YYMMDD >            %prog -h|--help > ''' >         parser = OptionParser(usage=usage) >         parser.add_option("-n", "--no-newline", dest="nonl", >                           action

Re: Q's on my first python script

2009-05-11 Thread Nick Craig-Wood
kj wrote: > > Below is my very firs python script. > > This was just a learning exercise; the script doesn't do anything > terribly exciting: for an argument of the form YYMMDD (year, month, > day) it prints out the corresponding string YYMMDDW, where W is a > one-letter abbreviation for th

Re: Q's on my first python script

2009-05-10 Thread kj
Thank you all very much! I really appreciate it. kynn -- NOTE: In my address everything before the first period is backwards; and the last period, and everything after it, should be discarded. -- http://mail.python.org/mailman/listinfo/python-list

Re: Q's on my first python script

2009-05-10 Thread kj
In <0216ec41$0$20647$c3e8...@news.astraweb.com> Steven D'Aprano writes: >On Sun, 10 May 2009 12:52:21 +, kj wrote: >> 1. The name of the BadArgument exception class defined in the script >>does not seem to me sufficiently specific. If one were to import the >>script in order to reu

Re: Q's on my first python script

2009-05-10 Thread Dave Angel
kj wrote: Below is my very firs python script. This was just a learning exercise; the script doesn't do anything terribly exciting: for an argument of the form YYMMDD (year, month, day) it prints out the corresponding string YYMMDDW, where W is a one-letter abbreviation for the day of the week

Re: Q's on my first python script

2009-05-10 Thread MRAB
Andre Engels wrote: On Sun, May 10, 2009 at 5:56 PM, Steven D'Aprano wrote: 5. The variable wd is meant to be "global" to the script. In other languages I've programmed in I've seen some typographic convention used for the name of such variables (e.g. all caps) to signal this widened

Re: Q's on my first python script

2009-05-10 Thread Scott David Daniels
Steven D'Aprano wrote: On Sun, 10 May 2009 12:52:21 +, kj wrote: 5. The variable wd is meant to be "global" to the script. In other languages I've programmed in I've seen some typographic convention used for the name of such variables (e.g. all caps) to signal this widened sco

Re: Q's on my first python script

2009-05-10 Thread Andre Engels
On Sun, May 10, 2009 at 5:56 PM, Steven D'Aprano wrote: >> 5. The variable wd is meant to be "global" to the script.  In other >>    languages I've programmed in I've seen some typographic convention >>    used for the name of such variables (e.g. all caps) to signal this >>    widened scope.  Do

Re: Q's on my first python script

2009-05-10 Thread Steven D'Aprano
On Sun, 10 May 2009 12:52:21 +, kj wrote: > 1. The name of the BadArgument exception class defined in the script >does not seem to me sufficiently specific. If one were to import the >script in order to reuse its wkday_abbrev function, I'd like this >exception's name to be more un

Q's on my first python script

2009-05-10 Thread kj
Below is my very firs python script. This was just a learning exercise; the script doesn't do anything terribly exciting: for an argument of the form YYMMDD (year, month, day) it prints out the corresponding string YYMMDDW, where W is a one-letter abbreviation for the day of the week. E.g. % wd