On 26 Feb., 14:36, [EMAIL PROTECTED] wrote: > A possible solution to this problem is "optional delimiters". What's > the path of less resistance to implement such "optional delimiters"? > Is to use comments. For example: #} or #: or something similar. > If you use such pairs of symbols in a systematic way, you have cheap > "optional delimiters", for example: > > def insort_right(a, x, lo=0, hi=None): > if hi is None: > hi = len(a) > #} > while lo < hi: > mid = (lo + hi) // 2 > if x < a[mid]: > hi = mid > #} > else: > lo = mid+1 > #} > #} > a.insert(lo, x) > #} > > It looks a bit ugly, but a script is able to take such code even > flattened: > > def insort_right(a, x, lo=0, hi=None): > if hi is None: > hi = len(a) > #} > while lo < hi: > mid = (lo + hi) // 2 > if x < a[mid]: > hi = mid > #} > else: > lo = mid+1 > #} > #} > a.insert(lo, x) > #} > > And build the original Python code (it's possible to do the opposite > too, but it requires a bit more complex script).
Have a look at Tools/Scripts/pindent.py -- Wolfram -- http://mail.python.org/mailman/listinfo/python-list