beginner <[EMAIL PROTECTED]> writes: > def f(n): > l=[] > while n>0: > l.append(n%26) > n /=26 > return l > > I am wondering what is the 'functional' way to do the same.
If you're trying to learn functional programming, maybe you should use a functional language like Haskell or Scheme. But anyway you might be thinking of something like: def f(n): def mseq(n): while n > 0: n,a = divmod(n, 26) yield a return list(mseq(n)) The above is not really "functional", but it's a reasonably natural Python style, at least for me. -- http://mail.python.org/mailman/listinfo/python-list