Honeycombs/Python: Difference between revisions

m
changed comment
mNo edit summary
m (changed comment)
 
(6 intermediate revisions by 2 users not shown)
Line 3:
 
'''
TheThis codeprogram, not a translation from tcl, includes doctests. Suggested program use:
This code proves mostly that I write the longest programs.
I did not investigate a direct translation from the tcl version to python.
The code includes doctests. Suggested program use:
 
$ python3 -m doctest hexagons.py
Line 81 ⟶ 79:
str(mandatory_arguments))
self.kwargs = kwargs
for kv in kwargs.items():
return setattr(self.kwargs[item],*kv)
 
def __repr__(self):
return self.__class__.__name__+'(**'+pprint.pformat(self.kwargs)+')'
 
def __getattr__(self,item):
try:
return self.kwargs[item]
except KeyError:
raise AttributeError(item)
 
class Ngon(Base):
Line 144 ⟶ 138:
 
'''
Of course I could have used numpy. (scipy). is Unavailableunavailable
asfrom athe standard library function, so I wrote Vector.
 
>>> P = Vector(P=(1,2,))
Line 308 ⟶ 302:
UC = list(string.ascii_uppercase)
random.shuffle(UC)
HC = HoneyComb(s=UC,rotation=0 and not 0.52)
print(HC()) # HC object retains selection order record
 
# ha ha, Turns out I always wanted to invoke main during tests.
# (module name is not __main__ when invoked from doctest)
 
if '__main__' == __name__:
main()
Line 327 ⟶ 323:
# ........ x
</lang>
--LambertDW 17:19, 27 March 2012 (UTC)
Anonymous user