对threading模块源码文件的解读(不全)
# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#对threading模块源码文件的解读(不全) import threading #类
#Thread() #构造方法
#threading.Thread()
#__init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None)
#group:保留为将来扩展时,可以类被实现
#target:要执行的方法,也叫被调用的方法
#name:is the thread name.
#args:tuple参数,默认(),tuple
#kwargs:关键字参数dict,默认dict
'''
| *group* should be None; reserved for future extension when a ThreadGroup
| class is implemented.
|
| *target* is the callable object to be invoked by the run()
| method. Defaults to None, meaning nothing is called.
|
| *name* is the thread name. By default, a unique name is constructed of
| the form "Thread-N" where N is a small decimal number.
|
| *args* is the argument tuple for the target invocation. Defaults to ().
|
| *kwargs* is a dictionary of keyword arguments for the target
| invocation. Defaults to {}.
|
| If a subclass overrides the constructor, it must make sure to invoke
| the base class constructor (Thread.__init__()) before doing anything
| else to the thread.
''' #__repr__
#作用:返回一个可用来表示对象的可打印字符串
#1)尝试生成这样一个字符串,将其传给eval()可重新生成同样的对象
#2)一个类class可以通过__repr__成员来控制repr()函数作用在其实例上时的行为
class D():
def __str__(self):
return 'a.__str_-'
def __repr__(self):
return 'a.__repr__' '''
>>> dr=D()
>>> dr
a.__repr__
>>> print dr
a.__str_-
''' #getName(self):返回线程名 #isAlive(self): 返回线程是否活动的 #isDaemon(self):判断线程是否随主线程一起结束 #join(self, timeout=None):等待线程终止,Wait until the thread terminates. #run(self):表示线程活动的方法。 #setDaemon(self, daemonic)#设置子线程是否随主线程一起结束,必须在start()之前调用。默认为False。 #setName(self, name):设置线程对象名称 #start(self):启动线程
对threading模块源码文件的解读(不全)的更多相关文章
- Erlang千万级用户游戏框架(Openpoker)源码文件分析清单
openpoker源码 erlang写的网游服务器源码,OpenPoker是一个大型多人扑克网游,内建支持了容错能力,负载平衡和无限制的规模大小.本文是openpoker源码文件功能的一个清单式说明: ...
- 《UNIX网络编程(第3版)》unp.h等源码文件的编译安装
操作系统:Mac OS X 10.11.5 1.下载书中的源代码:点击下载 2.切换到解压后的目录 unpv13e,先查看下 README,依次执行: ./configure cd lib make ...
- [C/C++] 各种C/C++编译器对UTF-8源码文件的兼容性测试(VC、GCC、BCB)
在不同平台上开发C/C++程序时,为了避免源码文件乱码,得采用UTF-8编码来存储源码文件.但是很多编译器对UTF-8源码文件兼容性不佳,于是我做了一些测试,分析了最佳保存方案. 一.测试程序 为了测 ...
- C++ 多源码文件简单组织
C++ 多源码文件简单组织 基本上和C的是一样的,只不过C++的方法要在类中声明.看一个简单实例.ainimal.h 类里面对外公开的信息. 点击(此处)折叠或打开 #ifndef _ANIMAL_ ...
- Python源码文件中带有中文时,输出乱码
Python源码文件中带有中文时,文件头应加注释: #!/usr/bin/env python # -*- coding: utf-8 -*- 第一行注释是为了告诉Linux/OS X系统,这是一个P ...
- TFS二次开发-基线文件管理器(5)-源码文件的读取
在上一节中,我们在保存标签之前,已经将勾选的文件路径保存到了Listbox中,这里只需要将保存的数据输出去为txt文档就可以做版本控制了. 版本文件比较复杂的是如何读取,也就是如何通过文件路径 ...
- go语言的源码文件的分类及含义
Go源码文件:名称以.go为后缀,内容以Go语言代码组织的文件 多个Go源码文件是需要用代码包组织起来的 源码文件分为三类:命令源码文件.库源码文件(go语言程序) 测试源码文件(辅助源码文件) 命令 ...
- golang学习笔记---命令源码文件接收参数(flag包)
命令源码文件怎样接收参数 go标准库中有一个代码包专门用于接收和解析命令参数.这个包叫flag 实例1: package main import ( "flag" "fm ...
- golang---命令源码文件与命令行参数
命令源码文件是程序的运行入口,是每个可独立运行的程序必须拥有的. import "flag" flag包实现了命令行参数的解析.每个参数认为一条记录,根据实际进行定义,到一个se ...
随机推荐
- matlab进行地图仪的绘制
% 绘制地球仪,并标出我们的位置 cla reset; load topo; [x,y,z] = sphere();%45是画出来的球面的经纬分面数 s = surface(x,y,z,'FaceCo ...
- 彻底理解jdbc为什么用反射创建驱动程序对象
1.class.forName(mysql),这样更换数据库时,不需要更改程序代码,程序不需要重新编译就能运行. 因为反射是动态编译的,程序运行期间生成指定类的对象, 这样就可以程序运行期间生成不同的 ...
- superobject
GITHUB: https://github.com/hgourvest/superobject # SuperObject ## What is JSON ? - JSON (JavaScript ...
- 四种更新UI的方法
笔记: // 使用handler.post(Runnable)更新UI public void updateUI_Fun1() { new Thread() { public void run() ...
- 使用框架帮助Activity规范化
摘要 本文原创,转载请注明地址:http://kymjs.com/code/2015/05/10/01 写给那些在用.想用.还没有用过KJFrame的朋友. KJFrameForAndroid总共分为 ...
- python接口自动化1-发送get请求
前言 requests模块,也就是老污龟,为啥叫它老污龟呢,因为这个官网上的logo就是这只污龟,接下来就是学习它了. 一.环境安装 1.用pip安装requests模块 >>pip in ...
- pom-4.0.0.xml中心仓库
<!--Licensed to the Apache Software Foundation (ASF) under oneor more contributor license agreeme ...
- 用户组篇endgrent getpw getuid
endgrent(关闭组文件) 相关函数 getgrent,setgrent 表头文件 #include<grp.h> #include<sys/types.h> 定义函数 v ...
- Python垃圾回收机制及gc模块详解:内存泄露的例子
标记清理是用来解决循环引用的.分代回收针对所有的新创建即进入0代的对象和进入1.2代的对象..这样就解释了python“引用计数为主.标记清理+分代回收为辅”的垃圾回收原理,因为循环引用毕竟是少数情况 ...
- RuntimeError: Working outside of application context.
flask执行错误: 问题:RuntimeError: Working outside of application context. 方法: from flask import Flask, cur ...