内存高效的python对象

atom的Python项目详细描述


https://travis-ci.org/nucleic/atom.svg?branch=masterhttps://codecov.io/gh/nucleic/atom/branch/master/graph/badge.svg

Atom是一个框架,用于创建具有增强的 的动态初始化、验证和更改通知等功能 对象属性。它为 Enaml用户界面框架。

示例:

fromatom.apiimportAtom,Unicode,Range,Bool,observeclassPerson(Atom):""" A simple class representing a person object.

    """last_name=Unicode()first_name=Unicode()age=Range(low=0)debug=Bool(False)@observe('age')defdebug_print(self,change):""" Prints out a debug message whenever the person's age changes.

        """ifself.debug:templ="{first} {last} is {age} years old."s=templ.format(first=self.first_name,last=self.last_name,age=self.age,)print(s)def_default_first_name(self):return'John'john=Person(last_name='Doe',age=42)john.debug=Truejohn.age=43# prints messagejohn.age='forty three'# raises TypeError

有关版本信息,请参见the Revision History

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
当使用RequestDispatcher时,servlets Java最终没有被调用   java生成对具有可变参数数的方法的调用   java如何使用select子句中的参数化列映射iBATIS的查询?   java无法创建类型为org的插件。阿帕奇。登录中。log4j。果心阿佩德。元素RollingFile的RollingFileAppender   java当子实体和父实体之间存在OneTONE JPA关系时,是否可以将其与父实体一起持久化?   Android上的java Facebook集成fbconnect断开链接   获取方法调用方的java机制   从列表创建Oracle阵列时出现java问题   添加和检索元素的ArrayList的java ArrayList   在java中从字符串中删除无效的XML字符   java如何构建完整生成的maven模块   java如何准确地改变播放所有分辨率midi文件的速度?   shell javac:无效标志:/src/中位_度。ubuntu中的java   java使用从其他类的方法检索到的信息