operator.abs()

operator.abs(obj) operator.__abs__(obj) Return the absolute value of obj.

open()

open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) Open file and return a corresponding file object. If the file cannot be opened, an OSError is raised. file is either a string or bytes object giving the pathname (absolute or relative to the current working directory) of the file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it is closed when the returned I/O object is closed, unless

oct()

oct(x) Convert an integer number to an octal string. The result is a valid Python expression. If x is not a Python int object, it has to define an __index__() method that returns an integer.

object.__setstate__()

object.__setstate__(state) Upon unpickling, if the class defines __setstate__(), it is called with the unpickled state. In that case, there is no requirement for the state object to be a dictionary. Otherwise, the pickled state must be a dictionary and its items are assigned to the new instance’s dictionary. Note If __getstate__() returns a false value, the __setstate__() method will not be called upon unpickling.

object.__reduce__()

object.__reduce__() The interface is currently defined as follows. The __reduce__() method takes no argument and shall return either a string or preferably a tuple (the returned object is often referred to as the “reduce value”). If a string is returned, the string should be interpreted as the name of a global variable. It should be the object’s local name relative to its module; the pickle module searches the module namespace to determine the object’s module. This behaviour is typically use

object.__reduce_ex__()

object.__reduce_ex__(protocol) Alternatively, a __reduce_ex__() method may be defined. The only difference is this method should take a single integer argument, the protocol version. When defined, pickle will prefer it over the __reduce__() method. In addition, __reduce__() automatically becomes a synonym for the extended version. The main use for this method is to provide backwards-compatible reduce values for older Python releases.

object.__getstate__()

object.__getstate__() Classes can further influence how their instances are pickled; if the class defines the method __getstate__(), it is called and the returned object is pickled as the contents for the instance, instead of the contents of the instance’s dictionary. If the __getstate__() method is absent, the instance’s __dict__ is pickled as usual.

object.__getnewargs__()

object.__getnewargs__() This method serve a similar purpose as __getnewargs_ex__() but for protocols 2 and newer. It must return a tuple of arguments args which will be passed to the __new__() method upon unpickling. In protocols 4 and newer, __getnewargs__() will not be called if __getnewargs_ex__() is defined.

object.__getnewargs_ex__()

object.__getnewargs_ex__() In protocols 4 and newer, classes that implements the __getnewargs_ex__() method can dictate the values passed to the __new__() method upon unpickling. The method must return a pair (args, kwargs) where args is a tuple of positional arguments and kwargs a dictionary of named arguments for constructing the object. Those will be passed to the __new__() method upon unpickling. You should implement this method if the __new__() method of your class requires keyword-only

object.__dict__

object.__dict__ A dictionary or other mapping object used to store an object’s (writable) attributes.