Module Expr Str Import alias ImportFrom alias Assign NameStore NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body If Call NameLoad NameLoad Str body Return Call AttributeLoad Call NameLoad NameLoad attr NameLoad Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body If Call NameLoad NameLoad Str body Assign NameStore Call AttributeLoad Call NameLoad NameLoad attr NameLoad orelse Assign NameStore Call NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Return NameLoad orelse Return Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body If Call NameLoad NameLoad Str body Return Call AttributeLoad Call NameLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body If UnaryOpNot Call NameLoad NameLoad Str body Return NameLoad Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad NameLoad decorator_list decorator_list Assign NameStore ListLoad Str
N/A N/A 
An object subclass for Python 2 that gives new-style classes written in the
style of Python 3 (with ``__next__`` and unicode-returning ``__str__`` methods)
the appropriate Python 2-style ``next`` and ``__unicode__`` methods for compatible.

Example use::

    from builtins import object

    my_unicode_str = u'Unicode string: \u5b54\u5b50'

    class A(object):
        def __str__(self):
            return my_unicode_str

    a = A()
    print(str(a))
    
    # On Python 2, these relations hold:
    assert unicode(a) == my_unicode_string
    assert str(a) == my_unicode_string.encode('utf-8') 


Another example::

    from builtins import object

    class Upper(object):
        def __init__(self, iterable):
            self._iter = iter(iterable)
        def __next__(self):                 # note the Py3 interface
            return next(self._iter).upper()
        def __iter__(self):
            return self
    
    assert list(Upper('hello')) == list('HELLO')

 N/A sys future.utils with_metaclass N/A _builtin_object object N/A ver N/A N/A sys version_info N/A 2 newobject N/A object N/A N/A 
    A magical object class that provides Python 2 compatibility methods::
        next
        __unicode__
        __nonzero__
    
    Subclasses of this class can merely define the Python 3 methods (__next__,
    __str__, and __bool__).
     next N/A N/A self N/A N/A N/A N/A hasattr self __next__ N/A N/A N/A N/A N/A type self __next__ self N/A N/A TypeError newobject is not an iterator N/A __unicode__ N/A N/A self N/A N/A N/A N/A hasattr self __str__ N/A N/A s N/A N/A N/A type self __str__ self N/A N/A s N/A str self N/A N/A isinstance s unicode N/A N/A s N/A N/A N/A N/A s decode utf-8 N/A __nonzero__ N/A N/A self N/A N/A N/A N/A hasattr self __bool__ N/A N/A N/A N/A N/A type self __bool__ self N/A True N/A __long__ N/A N/A self N/A N/A N/A N/A N/A hasattr self __int__ N/A N/A NotImplemented N/A N/A N/A self __int__ N/A __native__ N/A N/A self N/A N/A N/A 
        Hook for the future.utils.native() function
         N/A N/A object self N/A N/A N/A __all__ N/A newobject