當前位置: 首頁>>代碼示例>>Python>>正文


Python core.numerictypes方法代碼示例

本文整理匯總了Python中numpy.core.numerictypes方法的典型用法代碼示例。如果您正苦於以下問題:Python core.numerictypes方法的具體用法?Python core.numerictypes怎麽用?Python core.numerictypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在numpy.core的用法示例。


在下文中一共展示了core.numerictypes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_newdoc_for_scalar_type

# 需要導入模塊: from numpy import core [as 別名]
# 或者: from numpy.core import numerictypes [as 別名]
def add_newdoc_for_scalar_type(obj, fixed_aliases, doc):
    o = getattr(_numerictypes, obj)

    character_code = dtype(o).char
    canonical_name_doc = "" if obj == o.__name__ else "Canonical name: ``np.{}``.\n    ".format(obj)
    alias_doc = ''.join("Alias: ``np.{}``.\n    ".format(alias) for alias in fixed_aliases)
    alias_doc += ''.join("Alias *on this platform*: ``np.{}``: {}.\n    ".format(alias, doc)
                         for (alias_type, alias, doc) in possible_aliases if alias_type is o)

    docstring = """
    {doc}
    Character code: ``'{character_code}'``.
    {canonical_name_doc}{alias_doc}
    """.format(doc=doc.strip(), character_code=character_code,
               canonical_name_doc=canonical_name_doc, alias_doc=alias_doc)

    add_newdoc('numpy.core.numerictypes', obj, docstring) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:19,代碼來源:_add_newdocs.py

示例2: numeric_type_aliases

# 需要導入模塊: from numpy import core [as 別名]
# 或者: from numpy.core import numerictypes [as 別名]
def numeric_type_aliases(aliases):
    def type_aliases_gen():
        for alias, doc in aliases:
            try:
                alias_type = getattr(_numerictypes, alias)
            except AttributeError:
                # The set of aliases that actually exist varies between platforms
                pass
            else:
                yield (alias_type, alias, doc)
    return list(type_aliases_gen()) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:13,代碼來源:_add_newdocs.py


注:本文中的numpy.core.numerictypes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。