1

The Python source code of the ujson library is as follows.

# encoding: utf-8
# module ujson
# from /home/marty/dj/local/lib/python2.7/site-packages/ujson.so
# by generator 1.136
# no doc
# no imports

# Variables with simple values

__version__ = '1.33'

# functions

def decode(*args, **kwargs): # real signature unknown
    """ Converts JSON as string to dict object structure. Use precise_float=True to use high precision float decoder. """
    pass

def dump(*args, **kwargs): # real signature unknown
    """ Converts arbitrary object recursively into JSON file. Use ensure_ascii=false to output UTF-8. Pass in double_precision to alter the maximum digit precision of doubles. Set encode_html_chars=True to encode < > & as unicode escape sequences. """
    pass

def dumps(*args, **kwargs): # real signature unknown
    """ Converts arbitrary object recursivly into JSON. Use ensure_ascii=false to output UTF-8. Pass in double_precision to alter the maximum digit precision of doubles. Set encode_html_chars=True to encode < > & as unicode escape sequences. """
    pass

def encode(*args, **kwargs): # real signature unknown
    """ Converts arbitrary object recursivly into JSON. Use ensure_ascii=false to output UTF-8. Pass in double_precision to alter the maximum digit precision of doubles. Set encode_html_chars=True to encode < > & as unicode escape sequences. """
    pass

def load(*args, **kwargs): # real signature unknown
    """ Converts JSON as file to dict object structure. Use precise_float=True to use high precision float decoder. """
    pass

def loads(*args, **kwargs): # real signature unknown
    """ Converts JSON as string to dict object structure. Use precise_float=True to use high precision float decoder. """
    pass

# no classes

ujson execute any methods just with this code. The external file named ujson.so is a shared library.

do the # from, # module, # by generator, # no doc, no imports comments have any effect on this code (I know # encoding specifies the encoding of the file)

From pypi
UltraJSON is an ultra fast JSON encoder and decoder written in pure C with bindings for Python 2.5+ and 3.

My questions,

  1. How do calling a method (for example ujson.loads(my_string)) executes?
  2. How is the python method redirected/linked to the shared object?
  3. What is this method of Python programming called?
All Іѕ Vаиітy
  • 24,861
  • 16
  • 87
  • 111

0 Answers0