这段代码是如何工作的?

时间:2015-10-20 11:56:33

标签: python shared-libraries ujson

ujson库的Python源代码如下。

# 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只使用此代码执行任何方法。名为ujson.so的外部文件是shared library.

执行# from# module# by generator# no docno imports条评论对此代码有影响(我知道# encoding指定文件的编码)

  

来自pypi
UltraJSON是一个超纯JSON编码器和解码器,用纯C编写,带有Python 2.5+和3的绑定。

我的问题,

  1. 如何调用方法(例如ujson.loads(my_string))?
  2. 如何将python方法重定向/链接到共享对象?
  3. 这种Python编程方法叫做什么?

0 个答案:

没有答案