易截截图软件、单文件、免安装、纯绿色、仅160KB

python decorator

1.常用方法,不带参数
def decator(func):
    def inner_func(*args):
        args = (i * 2 for i in args)
        return func(*args)
    return inner_func
   
@decator
def add(a, b, c):
    return a + b + c
2.带参数:
class Dec(object):
    def __init__(self, i):
        self.i = i
    def __call__(self, func):
        def inner_func(a, b, c):
            return self.i * func(a, b, c)
        return inner_func
   
@Dec(2)
def abc(x, y, z):
    print "function abc"
    print (x, y, z)
    return x + y + z


相关文档:

arcgis python脚本

Script Name: Spider_Create   
#Script Label: Create Spider Diagrams   
#   
#Description:  Custom python script developed to create spider diagrams from points contained   
#in one or two feature classes.  If using two fea ......

python学习笔记

type相关:
所有自定义类A
其实例,如 a = A()
使用type运算符返回的都是<type, 'instance'>
而基本类型
比如 b = 3
type(b),结果是<type, 'int'>
python的type不像C++中的typeid那样,可以显示类名。
(注:对于没有virtual函数的类而言,typeid是编译时期的事情(也就是静态类型);对于有virtual函 ......

[Python module] select

16.1. select — Waiting for I/O completion¶
This module provides access to the select and poll functions available in most operating systems, epoll available on Linux 2.5+ and kqueue available on most BSD. Note that on Windows, it only works for sockets; on other operating systems, it al ......

[Python module] queue

8.8. queue — A synchronized queue class¶
queue -- 一个同步队列类
The queue module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threads. The Queue class in this module implemen ......

[Python module] threading

threading — Higher-level threading interface
This module constructs higher-level threading interfaces on top of the lower level _thread module. See also the queue module.
The dummy_threading module is provided for situations where threading cannot be used because _thread is missing.
  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号