Umm, "Niko". (Superfluous Unicode Removed)

The code you have written is very difficult to read because you are doing too 
much inside the conditional and you're repeating things!. For starters you 
could compile those regexps and re-use them:

## BEGIN SESSION ##
py> import re
py> s = """\
... hello.
... I'm  a little   
... multiline
... string"""
... 
py> repr(s)
"hello.\nI'm  a little   \nmultiline\nstring"
py> prog = re.compile(r'e\s*\n')
py> prog.findall(s)
['e   \n', 'e\n']
## END SESSSION ##

Secondly you could wield the power of the built in function "all" to make your 
first "run-on-condition" a bit nicer:

## BEGIN SESSION ##
py> lst = [True, True, False]
py> all(lst)
False
py> if all([True, True, False, True]):
...     print('Doing something')
... else:
...     print("Shucks. I suppose i'll just twiddle my thumbs!")
...     
Shucks. I suppose i'll just twiddle my thumbs!
## END SESSION ##

Lastly, you should write some helper functions to format the command (OUTSIDE 
OF THE CONDITIONAL) so you can shorten those atrociously long lines!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to