Re: Re-thinking my if-thens - a software engineering question

2007-01-24 Thread Steven D'Aprano
On Wed, 24 Jan 2007 11:51:27 -0800, metaperl wrote: > Ok, I have a module called textgen.py. The point of this module is to > generate a csv file from an array of dictionaries. You probably should use the csv module to do the grunt work, leaving your module just to massage the dicts into a form t

Re: Re-thinking my if-thens - a software engineering question

2007-01-24 Thread Neil Cerutti
On 2007-01-24, metaperl <[EMAIL PROTECTED]> wrote: > if dict_key == 'PCN': > fields = dict_val.split("/") > mo = re.match( '(\w{2})(\d{2})(\d{2})' , fields[1] ) > if mo: > dict_val = "%s/%s%s/%s" % (fields[0], mo.group(1), >

Re: Re-thinking my if-thens - a software engineering question

2007-01-24 Thread Bruno Desthuilliers
metaperl a écrit : > Ok, I have a module called textgen.py. The point of this module is to > generate a csv file from an array of dictionaries. Err... You know there's a csv module in the stdlib, don't you ? > As I iterate through > each dictionary, I "massage" the dictionary values before writin

Re-thinking my if-thens - a software engineering question

2007-01-24 Thread metaperl
Ok, I have a module called textgen.py. The point of this module is to generate a csv file from an array of dictionaries. As I iterate through each dictionary, I "massage" the dictionary values before writing them out to csv. Now, for one dictionary entry, I have the following code: if