用法:
register(subclass)將
subclass注冊為此 ABC 的 “virtual subclass”。例如:from abc import ABC class MyABC(ABC): pass MyABC.register(tuple) assert issubclass(tuple, MyABC) assert isinstance((), MyABC)在 3.3 版中更改:返回注冊的子類,以允許用作類裝飾器。
在 3.4 版中更改:檢測調用abc.ABCMeta.register, 你可以使用
get_cache_token()函數。
相關用法
- Python abc.ABCMeta用法及代碼示例
- Python abc.ABC用法及代碼示例
- Python abc.abstractmethod用法及代碼示例
- Python abc.abstractproperty用法及代碼示例
- Python abc.abstractstaticmethod用法及代碼示例
- Python abc.abstractclassmethod用法及代碼示例
- Python abs()用法及代碼示例
- Python ast.MatchClass用法及代碼示例
- Python ast.ListComp用法及代碼示例
- Python ast.Lambda用法及代碼示例
- Python asyncio.BaseTransport.get_extra_info用法及代碼示例
- Python ast.IfExp用法及代碼示例
- Python unittest assertNotIsInstance()用法及代碼示例
- Python ast.Return用法及代碼示例
- Python Tkinter askopenfile()用法及代碼示例
- Python ast.Subscript用法及代碼示例
- Python asyncio.shield用法及代碼示例
- Python asyncio.run用法及代碼示例
- Python argparse.ArgumentParser.convert_arg_line_to_args用法及代碼示例
- Python unittest assertIsNotNone()用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 abc.ABCMeta.register。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
