摘要: Java:http://docs.oracle.com/javase/http://docs.oracle.com/javase/7/docs/index.htmlhttps://tomcat.apache.org/tomcat-7.0-doc/index.htmlhttp://docs.oracle.com/javaee/http://docs.oracle.com/javaee/6/api/OpenJDK官网:http://openjdk.java.net/代码库:http://hg.openjdk.java.net/JDK7 update的代码仓库森林(repo forest),下面有h 阅读全文
posted @ 2013-04-22 17:25 101010 阅读(278) 评论(0) 推荐(0) 编辑
  2013年5月22日
摘要: 地址:http://www.cnblogs.com/huxi/archive/2011/07/15/2107536.html1. 函数式编程概述1.1. 什么是函数式编程?函数式编程使用一系列的函数解决问题。函数仅接受输入并产生输出,不包含任何能影响产生输出的内部状态。任何情况下,使用相同的参数调用函数始终能产生同样的结果。在一个函数式的程序中,输入的数据“流过”一系列的函数,每一个函数根据它的输入产生输出。函数式风格避免编写有“边界效应”(side effects)的函数:修改内部状态,或者是其他无法反应在输出上的变化。完全没有边界效应的函数被称为“纯函数式的”(purely functio 阅读全文
posted @ 2013-05-22 12:32 101010 阅读(1037) 评论(0) 推荐(0) 编辑
  2013年5月20日
摘要: 地址:http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html1. 正则表达式基础1.1. 简单介绍正则表达式并不是Python的一部分。正则表达式是用于处理字符串的强大工具,拥有自己独特的语法以及一个独立的处理引擎,效率上可能不如str自带的方法,但功能十分强大。得益于这一点,在提供了正则表达式的语言里,正则表达式的语法都是一样的,区别只在于不同的编程语言实现支持的语法数量不同;但不用担心,不被支持的语法通常是不常用的部分。如果已经在其他语言里使用过正则表达式,只需要简单看一看就可以上手了。下图展示了使用正则表达式进行匹配的流程: 阅读全文
posted @ 2013-05-20 00:55 101010 阅读(470) 评论(0) 推荐(0) 编辑
  2013年5月17日
摘要: 一、装饰函数和方法1.对不带参数的函数进行装饰'''对不带参数的函数进行装饰 deco1.py'''def deco(func): def _deco(): print('before %s() called.' % func.__name__) func() print('after %s() called.' % func.__name__) return _deco# myFunc = deco(myFunc)@decodef myFunc(): print('myFunc() called.' 阅读全文
posted @ 2013-05-17 01:11 101010 阅读(400) 评论(0) 推荐(0) 编辑
  2013年5月16日
摘要: 1.最简单的函数'''示例1:最简单的函数,调用两次'''def f(): print('in f()')f()f()运行结果:in f()in f()2.最简单函数,添加额外功能'''示例2:最简单函数,添加功能:查看程序的执行时间'''import timedef f(): start = time.clock() print('in f()') end = time.clock() print('used time:', end - start) 阅读全文
posted @ 2013-05-16 12:44 101010 阅读(460) 评论(0) 推荐(0) 编辑
  2013年5月13日
摘要: 查询字节码指令集: 1 >>> import opcode 2 >>> for op in range(len(opcode.opname)): 3 print('ox%.2X(%.3d): %s' % (op, op, opcode.opname[op])) 4 5 6 ox00(000): <0> 7 ox01(001): POP_TOP 8 ox02(002): ROT_TWO 9 ox03(003): ROT_THREE 10 ox04(004): DUP_TOP 11 ox05(005): DUP_TOP_TWO 12 阅读全文
posted @ 2013-05-13 23:05 101010 阅读(5326) 评论(0) 推荐(0) 编辑
  2013年5月10日
摘要: 1.Python程序的执行过程Python解释器(interpreter)在执行任何一个Python程序文件时,首先进行的动作都是先对文件中的Python源代码进行编译,编译的主要结果是产生的一组Python的字节码(byte code),然后将编译的结果交给Python虚拟机(Virtual Machine),由虚拟机按照顺序一条一条地执行字节码,从而完成对Python程序的执行动作。对比java的执行:java: .java-->(javac)-->.class-->(java)-->结果python: .py -->(编译器)-->.pyc--> 阅读全文
posted @ 2013-05-10 18:59 101010 阅读(6043) 评论(2) 推荐(1) 编辑
  2013年5月9日
摘要: http://www.python.org/dev/peps/pep-3102/Abstract This PEP proposes a change to the way that function arguments are assigned to named parameter slots. In particular, it enables the declaration of "keyword-only" arguments: arguments that can only be supplied by keyword and which will neve... 阅读全文
posted @ 2013-05-09 17:52 101010 阅读(513) 评论(0) 推荐(0) 编辑
  2013年4月28日
摘要: 地址:http://docs.python.org/3/library/copy.htmlAssignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable items, a copy is sometimes needed so one can change one copy without changing the other. This mod 阅读全文
posted @ 2013-04-28 21:34 101010 阅读(324) 评论(0) 推荐(0) 编辑
摘要: # filename: class_static.pyclass Parent: name = "I'm the parent" @staticmethod def print_name_by_static(): print(Parent.name) @classmethod def print_name_by_class(cls): print(cls.name)class Child(Parent): pass #(1) # name = "I'm the child" #(2)if __name__ == "__mai.. 阅读全文
posted @ 2013-04-28 01:21 101010 阅读(229) 评论(0) 推荐(0) 编辑
  2013年4月25日
摘要: python中,想查看某个模块的源码位置:import 模块名help(模块名),在其中有个file项,就是源码或者dll的位置或者:模块名.__file__例如:import sockethelp(socket)或者socket.__file__>>> import socket>>> socket.__file__'D:\\Python32\\lib\\socket.py'可知,其源码在D:\Python32\lib中的socket.py文件中。打开socket.py发现,其中并没有诸如socket(),accept(),listen() 阅读全文
posted @ 2013-04-25 15:41 101010 阅读(2014) 评论(0) 推荐(0) 编辑