def changeWordSize ( words, inSize, outSize ):
"""
>>> list( changeWordSize( [255, 18], 8, 1 ) )
...
Python changeWordSize
from itertools import groupby import doctest ...
Python On Count word occurrences in a...
by Leif Ryge,
October 31, 2008 20:37
Here is another version whi...
def mk_index(seq):
"""Index a sequence
>>> sorted(mk_index("abcba").items())
...
Python On Count word occurrences in a...
by Leif Ryge,
October 31, 2008 19:58
This prints not only the co...
Python On Computing permutations with...
by Leif Ryge,
October 31, 2008 06:55
Answering my own question: ...
idiom_A = lambda x,y,z: (x and [y] or [z])[0] idiom_B = lambda x,y,z: (z, y)[x] idiom_C = lambda x,y,z: y if x else z # introduced in Python 2.5
Python On Computing permutations with...
by Leif Ryge,
October 30, 2008 20:23
Thanks! I was actually unaw...
#!/usr/bin/python2.5
def permute(li):
"""Generate all permutations of a sequence
...
Python Computing permutations with...
by Leif Ryge,
October 22, 2008 04:16,
6 refactorings, tagged with recursion, generator, permutations, permutate
I suspect there is a better...

Generator which transforms ...