4-1python objects
All Python objects has three Attributes:type,id,and value.
All was readonly with a possible expection of the value (which can being changed only if the object is mutable).
4-5str () and repr ()
Repr () is a built-in function while STR () was a built-in function, changed to a factory function Inpython2.2.they would Both returns a string representation of an OBJECT;HOWEVER,STR () returns a printable string representation while repr () ret Urns an evaluatable string representation of an object,meaning that it's astring that represents a Python object that Wou LD is created if passed to eval ().
4-6object Equality
Type (a) = = Type (b) whether the value of type (a) is the same as the value of type (b) ... = = is a value compare
Type (a) is type (b) whether the type objects returned by type (a) and type (b) is the same object
Since there exists only one (type) object for each built-in type, there are no need to check their values; Hence, only the latter form should is used.
Isinstance (object, class-or-type-or-tuple), BOOL
Return whether an object are an instance of a class or of a subclass thereof.
With a type as second argument, return whether this is the object ' s type.
The form using a tuple, isinstance (x, (A, B, ...)), is a shortcut for
Isinstance (x, A) or isinstance (x, B) or ... (etc.).
Python Core Programming Chapter 4th Answer (second edition 75 pages)