lambda (and reduce) are valuable
Cameron Laird
claird at lairds.us
Fri Dec 16 14:08:02 EST 2005
In article <mailman.1984.1134375476.18701.python-list at python.org>,
Fredrik Lundh <fredrik at pythonware.com> wrote:
.
.
.
> # create numeric pad
> digit("7", 1, 1); digit("8", 2, 1); digit("9", 3, 1)
> digit("4", 1, 2); digit("5", 2, 2); digit("6", 3, 2)
> digit("1", 1, 3); digit("2", 2, 3); digit("3", 3, 3)
.
.
.
I confess that this sort of thing often tempts me to
for (numeral, row, column) in [
(7, 1, 1), (8, 2, 1), (9, 3, 1),
(4, 1, 2), (5, 2, 2), (6, 3, 2),
(1, 1, 3), (2, 2, 3), (3, 3, 3)]:
digit(str(numeral), row, column)
More information about the Python-list
mailing list