1

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共有ライブラリです。

, # from, # module,コメントはこのコードに何らかの影響を与えますか (ファイルのエンコーディングを指定していることはわかっ# by generator# no docいます)no imports# encoding

pypi
の UltraJSON は、Python 2.5+ および 3 のバインディングを備えた純粋な C で記述された超高速の JSON エンコーダーおよびデコーダーです。

私の質問、

  1. メソッド (たとえばujson.loads(my_string)) の呼び出しはどのように実行されますか?
  2. Python メソッドは共有オブジェクトにどのようにリダイレクト/リンクされていますか?
  3. この Python プログラミングの方法は何と呼ばれますか?
4

0 に答える 0