In env.py:
#Decorator for overriding builtins
def return_subclass_from(specials):
specialnames = ['__%s__' % s for s in specials.split()]
def wrapit(cls, method):
return lambda *a: cls(method(*a))
def dowrap(cls):
for n in specialnames:
method = getattr(cls, n)
setattr(cls, n, wrapit(cls, method))
return cls
return dowrap
#The real number type
@return_subclass_from('abs add floordiv mod mul neg pow radd rdivmod rfloordiv rmod rmul rpow rsub rtruediv sub truediv trunc')
class Real(Fraction):
Generate the clues for a nonogram
Here's a simplified sample nonogram:
2123
1344433322
2 ##
12# ##
11# #
2 ##
1 #
3 ###
3 ###
22 ## ##
21 ## #
221 ## ## #
23 ## ###
22## ##
As you can see there are clue numbers above and to the left of the solution ...
My girlfriend's friend is over working on homework and I overheard her working on a programming assignment. "I'll call it liststuff. You can't go wrong with stuff."