Hi Adam.
I am expecting it in mail soon and will let you know of typos/errors...
cheers
|
import maya.cmds as cmds class Human(object):
def __init__(self,**kwargs): self.first_name=kwargs.setdefault('first') self.last_name=kwargs.setdefault('last') self.height=kwargs.setdefault('height') self.weight=kwargs.setdefault('weight') def bmi(self): return self.weight/float(self.height)**2
def human_rep(self): return """Human(%s =%s, %s =%s)"""%(first,first_name,last,last_name) Human.__rep__= human_rep sis = Human(first='Ruth',last='miranda') baby_sis = Human(first='Emily', last='miranda') print (sis,baby_sis) |
|
(<__main__.Human object at 0x95ece50>, <__main__.Human object at 0x95ecf90>) |
--
Thanks for the feedback Ricardo. Unfortunately one of the biggest lessons I learned from this experience is what a pain it is to try to write a book with code samples�especially if they're Python!�Including images was one possibility we discussed, though it unfortunately has other issues of its own. I'll make sure to pass your feedback on to the publisher though.