Re: critique this little script, if you like

2006-05-01 Thread Alexis Roda
John Salerno escribió: > Alexis Roda wrote: >> >> > The >> > try block seems nicer because it doesn't have such an ugly-looking >> check >> > to make. >> > > Why do you think that this try block is preferred over what I have (if I > were to stick with the try block)? My example has nothing t

Re: critique this little script, if you like

2006-05-01 Thread John Salerno
Alexis Roda wrote: > John Salerno escribió: >> 2. Between the if block or the try block, which is more Pythonic? > > Since the command line argument is optional I don't think it should be > considered and exceptional condition if it's missing, so the "if" block > looks better to me. No idea if

Re: critique this little script, if you like

2006-05-01 Thread John Salerno
Roel Schroeven wrote: > But watch out with leading backslashes, as in > > subdirs = [r'\cgi-bin', r'\images', r'\styles'] > > os.path.join will assume they are meant to be absolute paths, and will > discard all previous components: > > >>> os.path.join('base', 'subdomain', r'\images') > '\\im

Re: critique this little script, if you like

2006-05-01 Thread Roel Schroeven
John Salerno schreef: > John Salerno wrote: >> Dave Jones wrote: >>> Hi John! >>> >>> About the path and the \'s, take a look at the os.path.join function. >>> The function is smart enough to add the correct slash when joining >>> directories. >>> >>> Dave >> Interesting, thanks! I was reading abou

Re: critique this little script, if you like

2006-05-01 Thread Roel Schroeven
Dave Jones schreef: > Hi John! > > About the path and the \'s, take a look at the os.path.join function. > The function is smart enough to add the correct slash when joining > directories. But watch out with leading backslashes, as in subdirs = [r'\cgi-bin', r'\images', r'\styles'] os.path.join

Re: critique this little script, if you like

2006-05-01 Thread Alexis Roda
John Salerno escribió: > 2. Between the if block or the try block, which is more Pythonic? Since the command line argument is optional I don't think it should be considered and exceptional condition if it's missing, so the "if" block looks better to me. No idea if this is more pythonic. > The

Re: critique this little script, if you like

2006-04-30 Thread John Salerno
John Salerno wrote: > Dave Jones wrote: >> Hi John! >> >> About the path and the \'s, take a look at the os.path.join function. >> The function is smart enough to add the correct slash when joining >> directories. >> >> Dave > > Interesting, thanks! I was reading about the normcase() function, but

Re: critique this little script, if you like

2006-04-30 Thread John Salerno
Dave Jones wrote: > Hi John! > > About the path and the \'s, take a look at the os.path.join function. > The function is smart enough to add the correct slash when joining > directories. > > Dave Interesting, thanks! I was reading about the normcase() function, but your suggestion might be bett

Re: critique this little script, if you like

2006-04-30 Thread Dave Jones
Hi John! About the path and the \'s, take a look at the os.path.join function. The function is smart enough to add the correct slash when joining directories. Dave -- http://mail.python.org/mailman/listinfo/python-list

critique this little script, if you like

2006-04-30 Thread John Salerno
# Create new subdomain directory (with subdirectories) in my 1and1 folder import os import sys subdirs = [r'\cgi-bin', r'\images', r'\styles'] #if len(sys.argv) == 1: # subdomain = raw_input('Enter subdomain name: ') #else: # subdomain = sys.argv[1] try: subdomain = sys.argv[1] except