Python语句、函数与方法的使用技巧总结讲解.doc

Python语句、函数与方法的使用技巧总结讲解.doc

Python语句、函数与方法的使用技巧总结讲解

Python语句、函数与方法的使用技巧总结 显示有限的接口到外部 当发布python第三方package时,并不希望代码中所有的函数或者class可以被外部import,在__init__.py中添加__all__属性,该list中填写可以import的类或者函数名, 可以起到限制的import的作用, 防止外部import其他函数或者类。 #!/usr/bin/env python # -*- coding: utf-8 -*- from base import APIBase from client import Client from decorator import interface, export, stream from server import Server from storage import Storage from util import (LogFormatter, disable_logging_to_stderr, enable_logging_to_kids, info) __all__ = [APIBase, Client, LogFormatter, Server, Storage, disable_logging_to_stderr, enable_logging_to_kids, export, info, interface, s

文档评论(0)

1亿VIP精品文档

相关文档