REFACTORME

Mar 04, 2009 18:49


def _otherParty(n=0): """Return function that converts input fields [and state] to other party number/URL. The conversion function will return at most `n' characters; 0 stands for infinity (default). """ def conv(fs, *_): if _channel(fs, ['VOICE']): if n: return fs[29][:n] else: return fs[29] if _channel(fs, ['WAP', 'WEB']): if n: return _cropURL(fs[26][:n]) else: return _cropURL(fs[26]) if n: return fs[26][:n] else: return fs[26] return conv
What are your refactoring ideas?
(I'm not fond of these "if n: / else:" sections...)

lazyweb, code, english, python

Previous post Next post
Up