erikrose/blessings — Issue #17: An idiom for many moves
Author: erikrose
Created: 2012-02-01 18:50:00+00:00
State: open

This (seen at http://fizmat.kz/downloads/index.php?q=aHR0cHM6Ly9naXN0LmdpdGh1Yi5jb20vMTUxNTMyNQ%3D%3D) is an antipattern:

with self.term.location(x, y):
print '╔' + '═' * (w - 2) + '╗'
for i in range(h - 2):
with self.term.location(x, y + i + 1):
print '║'
with self.term.location(x + w - 1, y + i + 1):
print '║'
with self.term.location(x, y + h - 1):
print '╚' + '═' * (w - 2) + '╝'

I can think of several ways I would refactor this to make it more concise, but perhaps that shouldn't be the caller's responsibility. Think about providing a standard concise spelling.