code something called function decorators and explore python' assert statement-alternatives that can do the validity test for us automatically during development in for examplewe'll write tool that lets us validate with strange incantations like the following@rangetest(percent=( )use decorator to validate def giveraise(selfpercent)self pay int(self pay ( percent)step operator overloading at this pointwe have fairly full-featured class that generates and initializes instancesalong with two new bits of behavior for processing instances in the form of methods so farso good as it standsthoughtesting is still bit less convenient than it needs to be--to trace our objectswe have to manually fetch and print individual attributes ( bob namesue payit would be nice if displaying an instance all at once actually gave us some useful information unfortunatelythe default display format for an instance object isn' very good--it displays the object' class nameand its address in memory (which is essentially useless in pythonexcept as unique identifierto see thischange the last line in the script to print(sueso it displays the object as whole here' what you'll get--the output says that sue is an "objectin xand an "instancein as codedbob smith sue jones smith jones providing print displays fortunatelyit' easy to do better by employing operator overloading--coding methods in class that intercept and process built-in operations when run on the class' instances specificallywe can make use of what are probably the second most commonly used operator overloading methods in pythonafter __init__the __repr__ method we'll deploy hereand its __str__ twin introduced in the preceding these methods are run automatically every time an instance is converted to its print string because that' what printing an object doesthe net transitive effect is that printing an object displays whatever is returned by the object' __str__ or __repr__ methodif the object either defines one itself or inherits one from superclass doubleunderscored names are inherited just like any other technically__str__ is preferred by print and strand __repr__ is used as fallback for these roles and in all other contexts although the two can be used to implement more realistic example