class MethodTest():
var1 ="class var"
def__init__(self, var2 = "object var"):
self.var2 = var2
@staticmethod
defstaticFun():
print'static method'
...
分类:
编程语言 时间:
2014-09-26 22:34:39
阅读次数:
249
# 类的定义
格式:
class 类名(父类):
__init(self,参数)
成员方法
成员变量
# 所有类的基础object
# 私有方法和变量使用__开头
例如:定义一个鸟类
class Bird(object):
__have_feather = True # 私有属性:是否有羽毛
way_of_reprod...
分类:
编程语言 时间:
2014-09-26 22:09:28
阅读次数:
220
首先明确的是self只有在类的方法中才会有,独立的函数或方法是不必带有self的。self在定义类的方法时是必须有的,虽然在调用时不必传入相应的参数。self名称不是必须的,在python中self不是关键词,你可以定义成a或b或其它名字都可以,但是约定成俗,不要搞另类,大家会不明白的。下例中将se...
分类:
编程语言 时间:
2014-09-26 21:40:18
阅读次数:
206
可以像筛选法那样标记 但是内存最多只能开1024的int数组 我用了位优化 用一个int 32 位标记32个数字 接下来就离线 排个序 算出第k大的哪个数
#include
#include
#include
using namespace std;
int a[10000000/32];
struct node
{
int x, y, id;
}b[50010];
int get(...
分类:
其他好文 时间:
2014-09-26 20:31:58
阅读次数:
162
具体代码附文末。先演示一下怎么使用。 AlertView的情况 -?(void)creatAlertView
{
????UIAlertView?*alertView?=?[[UIAlertView?alloc]?initWithTitle:@"title"?message:@"message"?delegate:self?...
分类:
移动开发 时间:
2014-09-26 12:09:19
阅读次数:
1001
1 #!/usr/bin/env python 2 # conding=utf8 3 import sys 4 5 class Linelist: 6 7 def __init__(self,length=11): 8 self.list = [] 9 ...
分类:
编程语言 时间:
2014-09-26 01:09:08
阅读次数:
525
NSTimer *myTimer = [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(scrollTimer) userInfo:nil repeats:NO];//关闭定时器[myTimer se...
分类:
移动开发 时间:
2014-09-26 00:20:17
阅读次数:
172
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html
一个简单的tkinter示例
import Tkinter as tk
class Application(tk.Frame): # 必须要从Frame继承,frame是一个安排control布局的容器
def __init__(self, master =...
分类:
编程语言 时间:
2014-09-25 22:40:28
阅读次数:
283
??
1
pthread_create()函数
创建线程
A:依赖的头文件
#include
B:函数声明
int pthread_create(pthread_t *thread, constpthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
pthread_t ...
分类:
编程语言 时间:
2014-09-25 19:01:47
阅读次数:
290