08 2013 档案

摘要:基本不太好搞。可以参考如下讨论:http://stackoverflow.com/questions/728164/securely-erasing-password-in-memory-pythonhttp://stackoverflow.com/questions/982682/mark-data-as-sensitive-in-python/983525#983525http://www.ibm.com/developerworks/library/s-data.html 阅读全文
posted @ 2013-08-07 15:55 鸪斑兔 阅读(412) 评论(0) 推荐(0) 编辑
摘要:网上找到如下几个思路:1、用inspect模块2、用sys._getframe模块3、用sys.exc_traceback,先抛一个异常,然后抓出traceback#!/usr/bin/env python# -*- coding: utf-8 -*-import sysdef test(depth = 0): frame = sys._getframe(depth) code = frame.f_code print "frame depth = ", depth print "func name = ", code.co_name print &qu 阅读全文
posted @ 2013-08-07 14:55 鸪斑兔 阅读(16160) 评论(1) 推荐(0) 编辑
摘要:inspect — Inspect live objectsNew in version 2.1.The inspect module provides several useful functions to help get information about live objects such as modules, classes, methods, functions, tracebacks, frame objects, and code objects. For example, it can help you examine the contents of a class, re 阅读全文
posted @ 2013-08-07 12:18 鸪斑兔 阅读(408) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/env python#coding=utf-8def generate_counter(): CNT = [0] def add_one(): CNT[0] = CNT[0] + 1 return CNT[0] return add_onecounter = generate_counter()print counter() # 1print counter() # 2print counter() # 3 阅读全文
posted @ 2013-08-01 09:54 鸪斑兔 阅读(890) 评论(2) 推荐(1) 编辑