正式开始留痕
2010-02-27 02:23
225 查看
申请这个用户有很长时间了,一直没有好好地利用起来!就从今天开始吧!
2010年农历正月14
从去年七月份到现在自己工作有半年多了,身上依然空空,没有些许积蓄。但是我没有失望,我很充实,因为我的另一半始终在背后支持着我,同时我学习到很多新的技术。现在在公司参与了一个flash播放器的项目,负责AVM(ActionScript Virtual Machine)部分实现。感觉很有意思。其中有一项工作就是要利用Python的C/C++扩展。这里就对这个技术进行简单地记录性学习。
由于涉及到Python的类型扩展,因此更多的是关注一个结构体——PyTypeObject;
对这个结构体能很好的理解就基本上解决了Python的类型扩展,同时能够理解一些Python的类型实现机制。
以下摘自于Python源码(v2.6.4)
2010年农历正月14
从去年七月份到现在自己工作有半年多了,身上依然空空,没有些许积蓄。但是我没有失望,我很充实,因为我的另一半始终在背后支持着我,同时我学习到很多新的技术。现在在公司参与了一个flash播放器的项目,负责AVM(ActionScript Virtual Machine)部分实现。感觉很有意思。其中有一项工作就是要利用Python的C/C++扩展。这里就对这个技术进行简单地记录性学习。
由于涉及到Python的类型扩展,因此更多的是关注一个结构体——PyTypeObject;
对这个结构体能很好的理解就基本上解决了Python的类型扩展,同时能够理解一些Python的类型实现机制。
以下摘自于Python源码(v2.6.4)
typedef struct _typeobject { PyObject_VAR_HEAD
char *tp_name; /* For printing, in format "<module>.<name>" */ int tp_basicsize, tp_itemsize; /* For allocation */ /* Methods to implement standard operations */ destructor tp_dealloc; printfunc tp_print; getattrfunc tp_getattr; setattrfunc tp_setattr; cmpfunc tp_compare; reprfunc tp_repr; /* Method suites for standard classes */ PyNumberMethods *tp_as_number; PySequenceMethods *tp_as_sequence; PyMappingMethods *tp_as_mapping; /* More standard operations (here for binary compatibility) */ hashfunc tp_hash; ternaryfunc tp_call; reprfunc tp_str; getattrofunc tp_getattro; setattrofunc tp_setattro; /* Functions to access object as input/output buffer */ PyBufferProcs *tp_as_buffer; /* Flags to define presence of optional/expanded features */ long tp_flags; char *tp_doc; /* Documentation string */ /* Assigned meaning in release 2.0 */ /* call function for all accessible objects */ traverseproc tp_traverse; /* delete references to contained objects */ inquiry tp_clear; /* Assigned meaning in release 2.1 */ /* rich comparisons */ richcmpfunc tp_richcompare; /* weak reference enabler */ long tp_weaklistoffset; /* Added in release 2.2 */ /* Iterators */ getiterfunc tp_iter; iternextfunc tp_iternext; /* Attribute descriptor and subclassing stuff */ struct PyMethodDef *tp_methods; struct PyMemberDef *tp_members; struct PyGetSetDef *tp_getset; struct _typeobject *tp_base; PyObject *tp_dict; descrgetfunc tp_descr_get; descrsetfunc tp_descr_set; long tp_dictoffset; initproc tp_init; allocfunc tp_alloc; newfunc tp_new; freefunc tp_free; /* Low-level free-memory routine */ inquiry tp_is_gc; /* For PyObject_IS_GC */ PyObject *tp_bases; PyObject *tp_mro; /* method resolution order */ PyObject *tp_cache; PyObject *tp_subclasses; PyObject *tp_weaklist; } PyTypeObject;
详细的解释参阅:http://docs.python.org/c-api/typeobj.html
相关文章推荐
- 正式开始接龙, 迟到了几个月的appeon随想!--起始
- 新账户 博客启用啦 正式开始博客生涯
- 今日正式开始技术博客,O(∩_∩)O
- Windows Phone 7开发技术在线学习系列活动正式开始
- 博客之旅正式开始
- 正式开始编写图形用户界面组件的程序了,下面帖个小图
- 今天开始正式学习AJAX
- DX编程学习正式开始
- 正式开始
- 我的博客时代正式开始了。
- 开始正式学习Unity3d!
- 开始java正式学习第一天
- UBUNTU 6.06 光盘正式开始邮寄了
- 第十四天(正式开始oc学习,持续时间大概两个星期)
- 正式开始使用这个blog了
- 为了希望正式开始开发
- 中国第一家以【黑客】为主题的酒吧正式开始筹备 【除了提供一般的酒水服务,还有0day交易活动】
- ZeroForums论坛正式开始测试运行
- 正式开始使用VIM最为主要的也是唯一的编辑器
- 从今天开始,正式的刷leetcode!