<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>azalea says</title>
	<atom:link href="http://i.azpala.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://i.azpala.com</link>
	<description></description>
	<pubDate>Sat, 06 Mar 2010 04:12:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Don&#8217;t do things the hardest way</title>
		<link>http://i.azpala.com/2010/03/06/dont-do-things-the-hardest-way/</link>
		<comments>http://i.azpala.com/2010/03/06/dont-do-things-the-hardest-way/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 04:11:48 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://i.azpala.com/?p=1322</guid>
		<description><![CDATA[Given a DNA sequence, say DNA = &#8216;AATTGGCCA&#8217;, count how many times a given nucleotide (e.g. &#8216;A&#8217;) appears.
I used to do this in Python:

>>>DNA = 'AATTGGCCA'
>>> len(filter(lambda x: x=='A',DNA))
3

Today, I just find out I can simp... ]]></description>
			<content:encoded><![CDATA[<p>Given a DNA sequence, say DNA = &#8216;AATTGGCCA&#8217;, count how many times a given nucleotide (e.g. &#8216;A&#8217;) appears.</p>
<p>I used to do this in Python:</p>
<pre>
>>>DNA = 'AATTGGCCA'
>>> len(filter(lambda x: x=='A',DNA))
3
</pre>
<p>Today, I just find out I can simply do:</p>
<pre>
>>> DNA.count('A')
3
</pre>
<p>Feel silly myself, but begin to love Python even more!<br />
<h3>以下文章也许和本文有点关系：</h3>
<ul class="related_post">
<li>February 19, 2010 &#8212; <a href="http://i.azpala.com/2010/02/19/n-nt-motif-frequency-in-dna-sequences/" title="Python统计DNA序列中长度为n的子序列频率">Python统计DNA序列中长度为n的子序列频率 (3)</a></li>
<li>January 29, 2010 &#8212; <a href="http://i.azpala.com/2010/01/29/weird-python-features/" title="Python语言的诡异特性">Python语言的诡异特性 (4)</a></li>
<li>October 14, 2009 &#8212; <a href="http://i.azpala.com/2009/10/14/idle-auto-complet/" title="开启IDLE的自动补全功能">开启IDLE的自动补全功能 (1)</a></li>
<li>October 13, 2009 &#8212; <a href="http://i.azpala.com/2009/10/13/python-binary-multiplicatio/" title="Python二进制乘法">Python二进制乘法 (2)</a></li>
<li>September 25, 2009 &#8212; <a href="http://i.azpala.com/2009/09/25/%e4%b8%80%e9%81%93%e5%b0%8f%e5%ad%a6%e6%95%b0%e5%ad%a6%e9%a2%98/" title="一道小学数学题">一道小学数学题 (28)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2010/03/06/dont-do-things-the-hardest-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python统计DNA序列中长度为n的子序列频率</title>
		<link>http://i.azpala.com/2010/02/19/n-nt-motif-frequency-in-dna-sequences/</link>
		<comments>http://i.azpala.com/2010/02/19/n-nt-motif-frequency-in-dna-sequences/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 21:07:48 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[fun]]></category>

		<category><![CDATA[gossip]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[zz]]></category>

		<category><![CDATA[bioinformatics]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[seqence]]></category>

		<guid isPermaLink="false">http://i.azpala.com/?p=1313</guid>
		<description><![CDATA[ms是我师弟的rotation project：
给定一堆DNA序列，即由字符A, C, G, T组成的字符串，统计所有长度为n的子序列出现的频率。
比如 ACGTACGT，子序列长度为2，于是 AC=2, CG=2, GT=2, TA=1，其余长度为2的子序... ]]></description>
			<content:encoded><![CDATA[<p>ms是我师弟的rotation project：<br />
给定一堆DNA序列，即由字符A, C, G, T组成的字符串，统计所有长度为n的子序列出现的频率。<br />
比如 ACGTACGT，子序列长度为2，于是 AC=2, CG=2, GT=2, TA=1，其余长度为2的子序列频率为0.</p>
<p>最先想到的就是建一个字典，key是所有可能的子序列，value是这个子序列出现的频率。<br />
但是当子序列比较长的时候，比如 n=8，需要一个有65536 (4的8次方) 个key-value pair的字典，且每个key的长度是8字符。这样ms有点浪费内存。。</p>
<p>于是想到，所有的长度为n的子序列是有序且连续的，所以可以映射到一个长度为4的n次方的的list里。<br />
令 A=0, C=1, G=2, T=3，则把子序列 ACGT 转换成 0*4^3 + 1*4^2 + 2*4 + 3 = 27, 映射到list的第27位。<br />
如此，list的index对应子序列，而list这个index位置则储存这个子序列出现的频率。</p>
<p>于是我们先要建立2个字典，表示ACGT和0123一一对应的关系：</p>
<pre>
i2mD = {0:'A', 1:'C', 2:'G', 3:'T'}
m2iD = dict(A=0,C=1,G=2,T=3)
# This is just another way to initialize a dictionary
</pre>
<p>以及下面的子序列映射成整数函数：</p>
<pre>
def motif2int(motif):
    '''convert a sub-sequence/motif to a non-negative integer'''
    total = 0
    for i, letter in enumerate(motif):
        total += m2iD[letter]*4**(len(motif)-i-1)
    return total
</pre>
<p>Test:</p>
<pre>
>>> motif2int('ACGT')
27
</pre>
<p>虽然我们内部把子序列当成正整数来存储（确切地说，其实这个整数是没有存在内存里的，而是由其在list的index表示的），为了方便生物学家们看，输出时还是转换回子序列比较好。</p>
<p>于是有了下面的整数映射成子序列函数，其中调用了另外一个函数baseN()，<a href="http://code.activestate.com/recipes/65212/">来源在此</a>，感谢作者～</p>
<pre>
def baseN(n,b):
    '''convert non-negative decimal integer n to
    equivalent in another base b (2-36)'''
    return ((n == 0) and  '0' ) or ( baseN(n // b, b).lstrip('0') + \
    "0123456789abcdefghijklmnopqrstuvwxyz"[n % b])

def int2motif(n, motifLen):
    '''convert non-negative integer n to a sub-sequence/motif with length motifLen'''
    intBase4 = baseN(n,4)
    return ''.join(map(lambda x: i2mD[int(x)],'0'*(motifLen-len(intBase4))+intBase4))
</pre>
<p>Test:</p>
<pre>
>>> int2motif(27,4)
'ACGT'
</pre>
<p>以下代码从命令行读入一个存有DNA序列的<a href="http://en.wikipedia.org/wiki/FASTA_format">fasta文件</a>，以及子序列长度，并输出子序列和频率。注意以下代码需要<a href="http://biopython.org/wiki/Main_Page">Biopython</a> module。</p>
<pre>
if __name__ == '__main__':
    import sys
    from Bio import SeqIO

    # read in the fasta file name and motif length
    # from command line parameters
    fastafile = sys.argv[1]
    motifLen = int(sys.argv[2])

    # list to store subsequence frequency
    frequencyL = [0]*4**motifLen

    # go over each DNA sequence in the fasta file
    # and count the frequency of subsequences
    it = SeqIO.parse(open(fastafile),'fasta')
    for rec in it:
        chrom = rec.seq.tostring()
        for i in range(len(chrom)-motifLen+1):
            motif = chrom[i:i+motifLen]
            frequencyL[motif2int(motif)] += 1

    # print frequency result to screen
    for i, frequency in enumerate(frequencyL):
        print int2motif(i, motifLen), frequency
</pre>
<p><a href="http://dl.dropbox.com/u/308058/blog/2010/test.fa">测试文件</a> <a href="http://dl.dropbox.com/u/308058/blog/2010/frequency.py">python源代码</a></p>
<p>可以在终端输入</p>
<p>python frequency.py test.fa 2</p>
<p>则会输出：<br />
AA 0<br />
AC 0<br />
AG 0<br />
AT 4<br />
CA 2<br />
CC 1<br />
CG 0<br />
CT 0<br />
GA 0<br />
GC 4<br />
GG 0<br />
GT 0<br />
TA 0<br />
TC 0<br />
TG 4<br />
TT 0</p>
<h3>以下文章也许和本文有点关系：</h3>
<ul class="related_post">
<li>August 10, 2009 &#8212; <a href="http://i.azpala.com/2009/08/10/python-find-repeat-masked-intervals-in-fasta-files/" title="python: find repeat masked intervals in fasta files">python: find repeat masked intervals in fasta files (5)</a></li>
<li>June 5, 2008 &#8212; <a href="http://i.azpala.com/2008/06/05/clutalw-format-aligned-fasta-format-conversion-using-python/" title="使用python进行ClustalW格式和aligned FASTA格式转换">使用python进行ClustalW格式和aligned FASTA格式转换 (16)</a></li>
<li>January 19, 2008 &#8212; <a href="http://i.azpala.com/2008/01/19/transcribe-dna-sequence-to-rna-sequence-in-python/" title="transcribe DNA sequence to RNA sequence in python">transcribe DNA sequence to RNA sequence in python (1)</a></li>
<li>March 6, 2010 &#8212; <a href="http://i.azpala.com/2010/03/06/dont-do-things-the-hardest-way/" title="Don&#8217;t do things the hardest way">Don&#8217;t do things the hardest way (2)</a></li>
<li>January 29, 2010 &#8212; <a href="http://i.azpala.com/2010/01/29/weird-python-features/" title="Python语言的诡异特性">Python语言的诡异特性 (4)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2010/02/19/n-nt-motif-frequency-in-dna-sequences/feed/</wfw:commentRss>
		</item>
		<item>
		<title>旧旧旧文一篇: 再论独孤九剑</title>
		<link>http://i.azpala.com/2010/02/03/old-article-dugujiujian/</link>
		<comments>http://i.azpala.com/2010/02/03/old-article-dugujiujian/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 22:45:52 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[fun]]></category>

		<category><![CDATA[朝花夕拾]]></category>

		<category><![CDATA[武侠]]></category>

		<guid isPermaLink="false">http://i.azpala.com/?p=1302</guid>
		<description><![CDATA[今日百度出来的。。。
http://club.163.com/viewElite.m?catalogId=135082&#38;eliteId=135082_100d2c9dca90014
此文是高中英语课作业，因为我们英语老师立剑同学对独孤九剑和英语学习的关系有很深的研究，故上课... ]]></description>
			<content:encoded><![CDATA[<p>今日百度出来的。。。<br />
<a href="http://club.163.com/viewElite.m?catalogId=135082&amp;eliteId=135082_100d2c9dca90014" target="_blank">http://club.163.com/viewElite.m?catalogId=135082&amp;eliteId=135082_100d2c9dca90014</a></p>
<p>此文是高中英语课作业，因为我们英语老师立剑同学对独孤九剑和英语学习的关系有很深的研究，故上课发了盗版的《笑傲江湖》片段，让大家写读后感。。<br />
&#8212;&#8212;&#8211;</p>
<p>再论独孤九剑</p>
<p>马昭荣</p>
<p>很早我就拜读过金庸的《笑傲江湖》，深为其中讲述的独孤九剑所折服，一招之间便能刺瞎15人的眼睛，真是出神入化。上学期的一节英语选修课上，我第一次听说独孤九剑居然和学习有关，甚至与只动口不动手的英语学习沾亲带故，令我耳目一新，豁然开朗。之后我写了一点文字，表达我对独孤九剑与英语学习的关系的理解。最近，我第三次读了《笑傲江湖》第十回，偶有所得，欣然忘食，一吐为快。</p>
<p>从风清扬传授令狐冲独孤九剑的话语中，我们可以看出独孤九剑的剑理大致有以下4点：</p>
<p>顺其自然。（“剑术之道，讲究如行云流水，任意所至。”“风清扬道：“一切须当顺其自然。行乎其不得不行，止乎其不得不止，倘若串不成一起，也就罢了，总之并不可有半点勉强。”）</p>
<p>无招胜有招。（风清扬道：“活学活使，只是第一步。要做到出手无招，那才真是踏入了高手的境界。你说‘各招浑成，敌人便无法可破’，这句话还只说对了一小半。不是‘浑成’，而是根本无招。你的剑招使得再浑成，只要有迹可寻，敌人便有隙可乘。但如你根本并无招式，敌人如何来破你的招式？”）</p>
<p>料敌机先。（风清扬拍手赞道：“对，对！孺子可教。‘料敌机先’这四个字，正是这剑法的精要所在，任何人一招之出，必定有若干征兆。……）</p>
<p>不被剑法拘束。（风清扬道：“你倒也不可妄自菲薄，独孤大侠是绝顶聪明之人，学他的剑法，要旨是在一个‘悟’字，决不在死记硬记。等到通晓了这九剑的剑意，则无所施而不可，便是将全部变化尽数忘记，也不相干，临敌之际，更是忘记得越干净彻底，越不受原来剑法的拘束。……”心想：“……他教我剑法之时，总是说‘人使剑法，不是剑法使人’，总说‘人是活的，剑法是死的，活人不可给死剑法所拘’。……”）</p>
<p>由此观之，在英语学习中很多地方都可以用到独孤九剑的剑理。</p>
<p>顺其自然，可以理解为要遵循事物的客观规律，比如背单词，不必每天抱着字典咬文嚼字，痛苦不堪。对于新的词汇，只要多看、多用，自然就会了。又如背课文，也不用机械的记忆，先理清文章的思路，再熟悉一些关键的句子，试着背几遍就水到渠成。推而广之，在其他学科的学习中也是如此。像做物理题，只要掌握了解题规律，看见一道题就能知道它的实质，再按照步骤便很轻易地解决了。</p>
<p>无招胜有招，我觉得这种境界太高了，我还无法完全理解。我认为把它演绎到英语学习中，可能是指知识的网络要全面，细致，以至无隙可乘。这样，无论考试出什么题，都可出奇制胜。我们一旦领会了英语的精髓，自然不必拘泥于其单词、语法了。所以说，有时与其对着一大堆令人眼花缭乱的语法不知所措，不如培养自己的语感，这样即使不知道语法，答题也十拿九稳。</p>
<p>料敌机先说的也许是一种应考策略。即在考试前推测一下重点考察的会是什么内容，然后有针对性的复习。这需要的不仅是学习能力了，还要求有敏锐的洞察力，能够根据满楼的风推断欲来的山雨。对此，我不能借鉴很多，还是脚踏实地的学习为好。这种投机取巧的行为风险太大，好比在武侠小说中，一个人举刀要砍我的脑袋，我却料敌机先以为他要砍我的腿，于是去防守下盘，结果当然是脑袋难保。</p>
<p>不受剑法拘束，用到英语学习上就是不受课本拘束了。尽管我们现在的英语学习和考试是以课本为主，但我们不应教条主义，照本宣科，而要领会课本的精神实质，真正学到自己的东西，达到融会贯通，得心应手的境界。因为课本好比拐杖，当我们学会走路的时候，拐杖自是要扔掉的。我觉得这一点是很重要的人生哲理。社会时刻在变化，所以我们要学会灵活变通。坚持做人的基本原则，具体情况下怎么办那是随便。于是想到笑傲江湖里风清扬与令狐冲的一段对话。现摘录如下：</p>
<p>风清扬微笑道：“你用这法子取得了一日一夜，竟不费半点力气，只不过有点儿卑鄙无耻。”令狐冲笑道：“对付卑鄙无耻之徒，说不得，只好用点卑鄙无耻的手段。”风清扬正色道：“要是对付正人君子呢？”令狐冲一怔，道：“正人君子？”一时答不出话来。风清扬双目炯炯，瞪视着令狐冲，森然问道：“要是对付正人君子，那便怎样？”令狐冲道：“就算他真是正人君子，倘若想要杀我，我也不能甘心就戮，到了不得已的时候，卑鄙无耻的手段，也只好用上这么一点半点了。”风清扬大喜，朗声道：“好，好！你说这话，便不是假冒为善的伪君子。大丈夫行事，爱怎样便怎样，行云流水，任意所至，甚么武林规矩，门派教条，全都是放他妈的狗臭屁！”</p>
<p>我想，规矩是人定的，在极端情况下，违反一些社会上的道德规范也不能算错（当然现在是法制社会，违反法律还是要受到制裁），关键是要问心无愧。</p>
<p>恩，跑题了。最后谈谈我认为的令狐冲学会独孤九剑的原因。我觉得人的要素有三点：明师、贤徒、对手。明师自是指风清扬。要是没有他这样善于启发的老师，令狐冲肯定是学不会独孤九剑的。令狐冲自身的原因也很重要。他记忆力很好，悟性很高，而且性格放荡不羁，这些对他学剑是很有帮助的。另外还得感谢田伯光。他在令狐冲初学时充当了义务陪练，使令狐冲学剑有了明确的目标，在这个目标的激励下，令狐冲自然非常用功，以至进步神速。还有一个非人的因素是理论与实践的紧密结合。君不见，令狐冲学剑时，先聆听风清扬的理论教育，受到理性的冲击。之后便和田伯光实践，巩固理论知识，得到感性的认识。由此可见，理论与实践如同一个人的两只手，是相辅相成的。上述原因我想也可以运用到我们的学习中，但限于篇幅这里不详述了。</p>
<p>金庸的武学博大精深，独孤九剑只算是沧海一粟，我们今后读武侠的时候要善于发现总结，以期能促进我们的英语学习。</p>
<p>谢谢。</p>
<p>作者：incognita【轩辕聿雪】<br />
※ 来源: 网易虚拟社区 北京站．<br />
※ sandralam7888 改变保留标记: 2002.01.21 19:15．<br />
<h3>以下文章也许和本文有点关系：</h3>
<ul class="related_post">
<li>March 28, 2008 &#8212; <a href="http://i.azpala.com/2008/03/28/about-kunlun/" title="《昆仑》读后感">《昆仑》读后感 (2)</a></li>
<li>June 4, 2006 &#8212; <a href="http://i.azpala.com/2006/06/04/devote-1011-to-today/" title="1011献给today">1011献给today (0)</a></li>
<li>September 10, 2005 &#8212; <a href="http://i.azpala.com/2005/09/10/hkust%e8%a7%81%e9%97%bb%e5%bd%95-%e5%85%89%e5%8d%8echess%e7%89%88%e6%97%a7%e6%96%87/" title="HKUST见闻录&#8211;光华Chess版旧文">HKUST见闻录&#8211;光华Chess版旧文 (0)</a></li>
<li>August 26, 2005 &#8212; <a href="http://i.azpala.com/2005/08/26/memory-of-bbs-chess-ids-and-people-behind-them/" title="回忆chess版的人和id们">回忆chess版的人和id们 (0)</a></li>
<li>August 21, 2005 &#8212; <a href="http://i.azpala.com/2005/08/21/memory-of-bbs-chess-board/" title="我与Chess版的回忆">我与Chess版的回忆 (0)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2010/02/03/old-article-dugujiujian/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python语言的诡异特性</title>
		<link>http://i.azpala.com/2010/01/29/weird-python-features/</link>
		<comments>http://i.azpala.com/2010/01/29/weird-python-features/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 06:22:54 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://i.azpala.com/?p=1296</guid>
		<description><![CDATA[在Strangest language feature这篇讨论里看到的，原文让人大开眼界啊!
这里抄几个Python的：
&#62;&#62;&#62; def f():
...     try:
...         return True
...     finally:
...         return False
...
&#62;&#62;&#62; f()
你说结果... ]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://stackoverflow.com/questions/1995113" target="_blank">Strangest language feature</a>这篇讨论里看到的，原文让人大开眼界啊!</p>
<p>这里抄几个Python的：</p>
<pre>&gt;&gt;&gt; def f():
...     try:
...         return True
...     finally:
...         return False
...
&gt;&gt;&gt; f()</pre>
<p>你说结果是啥呢？</p>
<p>答案是False！原文的解释是：finally always wins..</p>
<p>_____________________________</p>
<pre>&gt;&gt;&gt; (10 &gt; 5 &gt; 1)
True
&gt;&gt;&gt; ((10 &gt; 5) &gt; 1)
False</pre>
<p>这个是因为Python允许连续的比较运算，所以 10&gt;5&gt;1 相当于 10&gt;5 and 5&gt;1，于是True。</p>
<p>而 (10&gt;5) &gt; 1 要先运算10&gt;5，结果是True，True被转换成1进行比较，1&gt;1，于是False。</p>
<p>_____________________________</p>
<p>在Python 2.x 里：</p>
<pre>&gt;&gt;&gt; True = False
&gt;&gt;&gt; True
False</pre>
<p>把False赋值给True，True的值就变成了False = =!<br />
在Python 3.x 里就不能这样做了。</p>
<p>_____________________________</p>
<pre>&gt;&gt;&gt; a = "foo" "bar"
&gt;&gt;&gt; a
'foobar'</pre>
<p>在Ruby, C里ms也是这样。虽然我不知道这个特性有啥用处。</p>
<p>_____________________________</p>
<pre>&gt;&gt;&gt; a[0] = "hello"
NameError: name 'a' is not defined
&gt;&gt;&gt; a[0:] = "hello"
NameError: name 'a' is not defined
&gt;&gt;&gt; a = []
&gt;&gt;&gt; a[0] = "hello"
IndexError: list assignment index out of range
&gt;&gt;&gt; a[0:] = "hello"
&gt;&gt;&gt; a
['h', 'e', 'l', 'l', 'o']</pre>
<p>上面把 a[0:] 改成 a[:] 或 a[42:] 或 a[:33] 同样work!</p>
<p>_____________________________</p>
<p>今天自己遇到的：</p>
<pre>
>>> a=[0]*10
>>> a
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
>>> a[3:5] += [2]*2
>>> a
[0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0]
>>> a[3:5] += [3]*2
>>> a
[0, 0, 0, 0, 0, 3, 3, 2, 2, 0, 0, 0, 0, 0]
</pre>
<p>我没想到是这个结果，+= 相当于做了insert的事情，而不是改变list原位置elements的值</p>
<p>一个workarround是用numpy，把a变成array:</p>
<pre>
>>> import numpy
>>> a=numpy.zeros(10)
>>> a
array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])
>>> a[3:5] += [2]*2
>>> a
array([ 0.,  0.,  0.,  2.,  2.,  0.,  0.,  0.,  0.,  0.])
>>> a[3:5] += [3]*2
>>> a
array([ 0.,  0.,  0.,  5.,  5.,  0.,  0.,  0.,  0.,  0.])
</pre>
<p>大家知道有啥更好的方法么？</p>
<p>_____________________________</p>
<p>又遇到一个：</p>
<pre>>>> L = [0]*10
>>> L
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
>>> L[0] += 1
>>> L
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]

>>> L = [[]]*10
>>> L
[[], [], [], [], [], [], [], [], [], []]
>>> L[0].append(1)
>>> L
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]]
</pre>
<p>解决方法：</p>
<pre>>>> L = []
>>> for i in range(10):
...     L.append([])
...
>>> L
[[], [], [], [], [], [], [], [], [], []]
>>> L[0].append(1)
>>> L
[[1], [], [], [], [], [], [], [], [], []]
</pre>
<p><a href="http://www.daniweb.com/forums/thread58916.html">此文</a>对此有详细讨论<br />
<h3>以下文章也许和本文有点关系：</h3>
<ul class="related_post">
<li>March 6, 2010 &#8212; <a href="http://i.azpala.com/2010/03/06/dont-do-things-the-hardest-way/" title="Don&#8217;t do things the hardest way">Don&#8217;t do things the hardest way (2)</a></li>
<li>February 19, 2010 &#8212; <a href="http://i.azpala.com/2010/02/19/n-nt-motif-frequency-in-dna-sequences/" title="Python统计DNA序列中长度为n的子序列频率">Python统计DNA序列中长度为n的子序列频率 (3)</a></li>
<li>October 14, 2009 &#8212; <a href="http://i.azpala.com/2009/10/14/idle-auto-complet/" title="开启IDLE的自动补全功能">开启IDLE的自动补全功能 (1)</a></li>
<li>October 13, 2009 &#8212; <a href="http://i.azpala.com/2009/10/13/python-binary-multiplicatio/" title="Python二进制乘法">Python二进制乘法 (2)</a></li>
<li>September 25, 2009 &#8212; <a href="http://i.azpala.com/2009/09/25/%e4%b8%80%e9%81%93%e5%b0%8f%e5%ad%a6%e6%95%b0%e5%ad%a6%e9%a2%98/" title="一道小学数学题">一道小学数学题 (28)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2010/01/29/weird-python-features/feed/</wfw:commentRss>
		</item>
		<item>
		<title>外婆的笑话</title>
		<link>http://i.azpala.com/2010/01/01/grandma-jokes/</link>
		<comments>http://i.azpala.com/2010/01/01/grandma-jokes/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 09:20:58 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[fun]]></category>

		<category><![CDATA[笑话]]></category>

		<guid isPermaLink="false">http://i.azpala.com/2010/01/01/%e5%a4%96%e5%a9%86%e7%9a%84%e7%ac%91%e8%af%9d/</guid>
		<description><![CDATA[1. 小姨和我小姨夫谈他们上大学的儿子。
小姨对我小姨夫说，儿子都这么大了，你就别管了。
小姨夫说，好吧，你爱当后娘那我也当次后爹。
外婆听到了，对小姨夫怒道：你做梦都想要个后... ]]></description>
			<content:encoded><![CDATA[<p>1. 小姨和我小姨夫谈他们上大学的儿子。<br />
小姨对我小姨夫说，儿子都这么大了，你就别管了。<br />
小姨夫说，好吧，你爱当后娘那我也当次后爹。<br />
外婆听到了，对小姨夫怒道：你做梦都想要个后娘啊!<br />
小姨夫汗道，你不是耳背么？关键时候听得挺清楚啊。。</p>
<p>2. 外婆摔了一跤，摔断了手腕。<br />
小姨让她去医院，外婆说，被跳蚤踢了一下，哪至于住院啊。<br />
小姨夫说，那跳蚤得多大啊。</p>
<p>（未完待续）</p>
<p>外一：<br />
今天我爸开车放在倒档熄火了，再准备打火却拧不动钥匙。<br />
我小姨夫喊：放屁，放屁！不放屁打不着火！<br />
我就纳闷了，难道屁是可燃气体？<br />
半天才反应过来，原来小姨夫的意思是放在P档。<br />
<h3>随便看看吧</h3>
<ul class="related_post">
<li>March 14, 2008 &#8212; <a href="http://i.azpala.com/2008/03/14/spring-break-tour/" title="Spring break之行: Washington DC and Maryland">Spring break之行: Washington DC and Maryland (2)</a></li>
<li>February 5, 2008 &#8212; <a href="http://i.azpala.com/2008/02/05/r-document-students-t-test/" title="R document: Student&#8217;s t-Test">R document: Student&#8217;s t-Test (0)</a></li>
<li>March 27, 2008 &#8212; <a href="http://i.azpala.com/2008/03/27/joke-of-the-day/" title="今日笑话">今日笑话 (1)</a></li>
<li>December 9, 2007 &#8212; <a href="http://i.azpala.com/2007/12/09/suppose/" title="假如">假如 (0)</a></li>
<li>April 30, 2008 &#8212; <a href="http://i.azpala.com/2008/04/30/install-libsbml-on-linux/" title="Linux安装libsbml">Linux安装libsbml (0)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2010/01/01/grandma-jokes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>大家来玩游戏吧</title>
		<link>http://i.azpala.com/2009/11/13/lets-play-game/</link>
		<comments>http://i.azpala.com/2009/11/13/lets-play-game/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 22:57:08 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[fun]]></category>

		<category><![CDATA[leisure time]]></category>

		<category><![CDATA[游戏]]></category>

		<guid isPermaLink="false">http://i.azpala.com/?p=1220</guid>
		<description><![CDATA[在这本书里看到这个游戏：
在party上，每个人秘密写下一个正整数，交给主人，最后选了最小且没有其他人选的数的人为赢家。
如，1，1，2，2，3，3，3，4，5，6，则选择4的人为赢家。
后来想... ]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://www.douban.com/subject/3364420/" target="_blank">这本书</a>里看到这个游戏：</p>
<blockquote><p>在party上，每个人秘密写下一个正整数，交给主人，最后选了最小且没有其他人选的数的人为赢家。</p>
<p>如，1，1，2，2，3，3，3，4，5，6，则选择4的人为赢家。</p></blockquote>
<p>后来想想可以用google docs玩这个游戏，于是pala搞了<a href="http://losefoc.us/2009/11/12/game/" target="_blank">挑数字游戏Web2.0版</a>。</p>
<p><del datetime="2009-11-23T05:58:54+00:00">各位同学，请积极参与，在下面的表格中填个数字吧</del></p>
<p><strong>游戏暂时告一段落啦，等我们想个更有效率的方法再继续。</strong></p>
<p><strong>目前前6轮累积结果：<br />
olivefee 以2次获胜 名列第一！</strong></p>
<p>每10个人算一组，每组里最小且不重复的数字的提交者获胜。如此循环，日积月累，直到大家都玩累了，我会送出个小礼物给累积获胜次数最多的同学。</p>
<p>（注意啦，由于是每10个人一组，大家只要考虑其他9个人的策略，所以，我99%肯定，写100以上的是不会赢的啦。）</p>
<p>以上的表格和<a href="http://losefoc.us/2009/11/12/game/" target="_blank">pala那里的表格</a>是一样的，大家在一处填写就可以啦。</p>
<p>我会在下面更新每轮获胜者。</p>
<blockquote><p>第一轮 结果：<br />
按提交时间顺序：<br />
3，19，7，3，<strong>6</strong>，7，1，1，16，1<br />
恭喜选择 <strong>6</strong> 的Wind同学成为首轮胜者</p></blockquote>
<blockquote><p>第二轮 结果：<br />
3，<strong>2</strong>，5，8，8，9，3，7，1，1<br />
恭喜选择 <strong>2</strong> 的olivefee同学获胜</p></blockquote>
<blockquote><p>第三轮 结果：<br />
6，4，5，2，5，2，4，6，<strong>3</strong>，7<br />
恭喜选择 <strong>3</strong> 的olivefee同学再次获胜！</p></blockquote>
<blockquote><p>第四轮 结果：<br />
5，4，14，4，2，7，3，3，<strong>1</strong>，3<br />
恭喜qq同学成为首个选 <strong>1</strong> 的赢家 </p></blockquote>
<blockquote><p>第五轮 结果：<br />
2，<strong>4</strong>，2，3，1，3，13，3，1，1<br />
恭喜选择 <strong>4</strong> 的Wao同学获胜！</p></blockquote>
<blockquote><p>第六轮 结果：(截止到北京时间11-23 3pm)<br />
5 5 22 11 <strong>2</strong> 1 3 1 6 1123<br />
恭喜选择 <strong>2</strong> 的hellarch同学获胜！
</p></blockquote>
<p>p.s.此游戏精妙之处在于没有必胜策略，可以用反证法，如果有必胜策略，则大家都会采用此策略，则大家选的数字一样，则不能获胜了。</p>
<p>我们觉得，如果这个游戏每次玩都是相互独立的，则获胜的数字应该是完全随机的。但是如果连续玩，大家可以通过前几次的结果猜测其他人当前的策略，于是应该会很有意思。<br />
<h3>以下文章也许和本文有点关系：</h3>
<ul class="related_post">
<li>February 7, 2009 &#8212; <a href="http://i.azpala.com/2009/02/07/room-escape-games/" title="密室逃脱/冒险/解谜类游戏推荐">密室逃脱/冒险/解谜类游戏推荐 (2)</a></li>
<li>June 2, 2008 &#8212; <a href="http://i.azpala.com/2008/06/02/game-magic-pen/" title="打发时间的游戏：笔仙">打发时间的游戏：笔仙 (2)</a></li>
<li>April 23, 2008 &#8212; <a href="http://i.azpala.com/2008/04/23/word-search-game-my-blog-visitors/" title="玩个无聊的游戏吧">玩个无聊的游戏吧 (1)</a></li>
<li>March 15, 2008 &#8212; <a href="http://i.azpala.com/2008/03/15/game-turning-square/" title="推荐一个小游戏: turning square">推荐一个小游戏: turning square (2)</a></li>
<li>September 25, 2009 &#8212; <a href="http://i.azpala.com/2009/09/25/an-interesting-puzzle/" title="An interesting puzzle">An interesting puzzle (12)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2009/11/13/lets-play-game/feed/</wfw:commentRss>
		</item>
		<item>
		<title>一棵树</title>
		<link>http://i.azpala.com/2009/10/20/a-tree/</link>
		<comments>http://i.azpala.com/2009/10/20/a-tree/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 04:01:11 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[everyday]]></category>

		<category><![CDATA[照片]]></category>

		<category><![CDATA[四季]]></category>

		<guid isPermaLink="false">http://i.azpala.com/?p=1208</guid>
		<description><![CDATA[我家门前有一棵树。
春天，她沉睡着不肯醒来，其他的树已经郁郁葱葱，她小芽才露。

夏天，她终于也长满了叶，但是毫不起眼，和其他的树一样，默默地当背景。

秋天，她似乎想表达些什... ]]></description>
			<content:encoded><![CDATA[<p>我家门前有一棵树。</p>
<p>春天，她沉睡着不肯醒来，其他的树已经郁郁葱葱，她小芽才露。</p>
<p><a rel="attachment wp-att-1209" href="http://i.azpala.com/2009/10/20/a-tree/tree1/"><img class="aligncenter size-medium wp-image-1209" title="tree1" src="http://i.azpala.com/wp-content/uploads/2009/10/tree1-500x375.jpg" alt="tree1" width="500" height="375" /></a></p>
<p>夏天，她终于也长满了叶，但是毫不起眼，和其他的树一样，默默地当背景。</p>
<p><a rel="attachment wp-att-1210" href="http://i.azpala.com/2009/10/20/a-tree/tree2/"><img class="aligncenter size-medium wp-image-1210" title="tree2" src="http://i.azpala.com/wp-content/uploads/2009/10/tree2-500x375.jpg" alt="tree2" width="500" height="375" /></a></p>
<p>秋天，她似乎想表达些什么。</p>
<p><a rel="attachment wp-att-1211" href="http://i.azpala.com/2009/10/20/a-tree/tree3/"><img class="aligncenter size-medium wp-image-1211" title="tree3" src="http://i.azpala.com/wp-content/uploads/2009/10/tree3-375x500.jpg" alt="tree3" width="375" height="500" /></a></p>
<p>然而，提早来袭的大雪使她抬不起头。</p>
<p><a rel="attachment wp-att-1212" href="http://i.azpala.com/2009/10/20/a-tree/tree4/"><img class="aligncenter size-medium wp-image-1212" title="tree4" src="http://i.azpala.com/wp-content/uploads/2009/10/tree4-375x500.jpg" alt="tree4" width="375" height="500" /></a></p>
<p>她不能逃避，甚至不能抖落些许身上的重负。然而她没有放弃希望。</p>
<p>风雪过后，她终于在阳光下绽放。</p>
<p><a rel="attachment wp-att-1213" href="http://i.azpala.com/2009/10/20/a-tree/tree5/"><img class="aligncenter size-medium wp-image-1213" title="tree5" src="http://i.azpala.com/wp-content/uploads/2009/10/tree5-375x500.jpg" alt="tree5" width="375" height="500" /></a></p>
<p>众人的目光，也聚焦在她身上。（那天我同学来我家，说你这里好漂亮，跟风景名胜区似的。我说，你只是说那个树漂亮吧。她说，是啊。）</p>
<p><a rel="attachment wp-att-1214" href="http://i.azpala.com/2009/10/20/a-tree/tree6/"><img class="aligncenter size-medium wp-image-1214" title="tree6" src="http://i.azpala.com/wp-content/uploads/2009/10/tree6-500x375.jpg" alt="tree6" width="500" height="375" /></a></p>
<p>虽然，她知道冬天的脚步近了，将带走她夺目的光彩。</p>
<p><a rel="attachment wp-att-1215" href="http://i.azpala.com/2009/10/20/a-tree/tree7/"><img class="aligncenter size-medium wp-image-1215" title="tree7" src="http://i.azpala.com/wp-content/uploads/2009/10/tree7-500x375.jpg" alt="tree7" width="500" height="375" /></a></p>
<p>但是，她无畏寒冷，在沉默中积蓄着力量。因为她知道，来年自己将更加绚烂。</p>
<p><a rel="attachment wp-att-1216" href="http://i.azpala.com/2009/10/20/a-tree/tree8/"><img class="aligncenter size-medium wp-image-1216" title="tree8" src="http://i.azpala.com/wp-content/uploads/2009/10/tree8-500x332.jpg" alt="tree8" width="500" height="332" /></a></p>
<p>（感谢pala和alex同学友情提供照片。这些照片很多都是不经意间拍的，没想到连起来竟然概括了一棵树的四季。虽然只是一棵树，但是她已经是我们生活的一部分。）<br />
<h3>以下文章也许和本文有点关系：</h3>
<ul class="related_post">
<li>December 30, 2008 &#8212; <a href="http://i.azpala.com/2008/12/30/my2008/" title="我的2008">我的2008 (12)</a></li>
<li>October 13, 2008 &#8212; <a href="http://i.azpala.com/2008/10/13/touch-the-fall-biking-canoeing-and-driving/" title="亲历秋天：骑车划船和开车">亲历秋天：骑车划船和开车 (6)</a></li>
<li>February 12, 2008 &#8212; <a href="http://i.azpala.com/2008/02/12/heavy-snow/" title="大雪！">大雪！ (1)</a></li>
<li>October 22, 2007 &#8212; <a href="http://i.azpala.com/2007/10/22/fall-color/" title="秋色">秋色 (0)</a></li>
<li>October 19, 2009 &#8212; <a href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/" title="雪后初晴上路骑行">雪后初晴上路骑行 (14)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2009/10/20/a-tree/feed/</wfw:commentRss>
		</item>
		<item>
		<title>雪后初晴上路骑行</title>
		<link>http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/</link>
		<comments>http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 01:25:45 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[cycling]]></category>

		<category><![CDATA[雪]]></category>

		<category><![CDATA[骑车路线]]></category>

		<category><![CDATA[State College]]></category>

		<category><![CDATA[四季]]></category>

		<guid isPermaLink="false">http://i.azpala.com/?p=1182</guid>
		<description><![CDATA[话说周四和周五下了今年冬天第一场雪，打破了State College有史以来最早下雪的记录（我猜State College有文字记载的历史也就200年）。

（更多照片&#8230;国内被封）
周六又下雨，周日终于看到了... ]]></description>
			<content:encoded><![CDATA[<p>话说周四和周五下了今年冬天第一场雪，打破了State College有史以来最早下雪的记录（我猜State College有文字记载的历史也就200年）。</p>
<p><a rel="attachment wp-att-1183" href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/img_0482/"><img class="aligncenter size-medium wp-image-1183" title="firstSnow" src="http://i.azpala.com/wp-content/uploads/2009/10/img_0482-500x375.jpg" alt="firstSnow" width="500" height="375" /></a></p>
<p>（<a href="http://picasaweb.google.com/MaZhaorong/FirstSnow#" target="_blank">更多照片&#8230;</a>国内被封）</p>
<p>周六又下雨，周日终于看到了阳光，于是我们一行四人准备骑车去看雪后秋景。宾州的秋天本来就色彩缤纷，现在加上雪的白和天的蓝，更是无敌。</p>
<p>我们骑了传说中的<a href="http://www.thealleghenies.com/bike_onroad.aspx?t=46" target="_blank">Circleville loop</a>，话说我和pala<a href="http://i.azpala.com/2007/12/16/cycling-lower-than-ice-point/" target="_blank">两年前的冬天</a>就骑过这里。故地重游，别有一番滋味。</p>
<p><a rel="attachment wp-att-1186" href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/img_0530/"><img class="aligncenter size-medium wp-image-1186" title="biking1" src="http://i.azpala.com/wp-content/uploads/2009/10/img_0530-500x375.jpg" alt="biking1" width="500" height="375" /></a></p>
<p><a rel="attachment wp-att-1187" href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/img_0548/"><img class="aligncenter size-medium wp-image-1187" title="biking2" src="http://i.azpala.com/wp-content/uploads/2009/10/img_0548-500x375.jpg" alt="biking2" width="500" height="375" /></a></p>
<p><a rel="attachment wp-att-1188" href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/img_0577/"><img class="aligncenter size-medium wp-image-1188" title="biking3" src="http://i.azpala.com/wp-content/uploads/2009/10/img_0577-500x375.jpg" alt="biking3" width="500" height="375" /></a></p>
<p><a rel="attachment wp-att-1189" href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/img_0585/"><img class="aligncenter size-medium wp-image-1189" title="biking4" src="http://i.azpala.com/wp-content/uploads/2009/10/img_0585-500x375.jpg" alt="biking4" width="500" height="375" /></a></p>
<p>（<a href="http://picasaweb.google.com/MaZhaorong/BikingCircleville#" target="_blank">更多照片&#8230;</a>国内被封）</p>
<p>同行的Ye, Yongfeng, Wenying同学不时被美景拖住脚步，于是花了3个多小时才骑完全程，32km，均速16km/h =.=</p>
<p>今天晴空万里，天气也十分暖和，于是下午和pala决定再去这里飚车，真是超级爽，2小时搞定，均速20.93km/h（虽然我最后一段努力刷均速，但是由于全是上坡，还是没保住21km/h的均速，哭）。最爽的一段是10km的550，基本都是用3&#215;8骑的，速度从没下过30, 最快瞬时速度51.72km/h。当时只是郁闷骑的不是公路，因为调到最大尺比都会踩空。路好阳光好，只是雪全都消失了，没想到前天像冬天，昨天是秋天，今天仿佛回到夏天。</p>
<p><a rel="attachment wp-att-1194" href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/dscn1065/"><img class="aligncenter size-medium wp-image-1194" title="biking5" src="http://i.azpala.com/wp-content/uploads/2009/10/dscn1065-500x375.jpg" alt="biking5" width="500" height="375" /></a></p>
<p><a rel="attachment wp-att-1195" href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/img_0613-1/"><img class="aligncenter size-medium wp-image-1195" title="azalea" src="http://i.azpala.com/wp-content/uploads/2009/10/img_0613-1-500x375.jpg" alt="azalea" width="500" height="375" /></a></p>
<p><a rel="attachment wp-att-1196" href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/img_0615-1/"><img class="aligncenter size-medium wp-image-1196" title="pala" src="http://i.azpala.com/wp-content/uploads/2009/10/img_0615-1-500x375.jpg" alt="pala" width="500" height="375" /></a></p>
<p><a rel="attachment wp-att-1197" href="http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/img_0616/"><img class="aligncenter size-medium wp-image-1197" title="electricityPost" src="http://i.azpala.com/wp-content/uploads/2009/10/img_0616-500x375.jpg" alt="electricityPost" width="500" height="375" /></a><br />
<h3>以下文章也许和本文有点关系：</h3>
<ul class="related_post">
<li>September 13, 2009 &#8212; <a href="http://i.azpala.com/2009/09/13/biking-route-state-college-south/" title="今日骑车路线">今日骑车路线 (5)</a></li>
<li>June 7, 2009 &#8212; <a href="http://i.azpala.com/2009/06/07/biking-route-pa45/" title="昨天的骑车路线&#8211;PA45">昨天的骑车路线&#8211;PA45 (13)</a></li>
<li>May 8, 2008 &#8212; <a href="http://i.azpala.com/2008/05/08/first-biking-in-2008/" title="08年第一次骑车：流水照片路线及其他">08年第一次骑车：流水照片路线及其他 (9)</a></li>
<li>February 12, 2008 &#8212; <a href="http://i.azpala.com/2008/02/12/heavy-snow/" title="大雪！">大雪！ (1)</a></li>
<li>December 16, 2007 &#8212; <a href="http://i.azpala.com/2007/12/16/cycling-lower-than-ice-point/" title="昨天的骑行,第一次低于冰点">昨天的骑行,第一次低于冰点 (1)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2009/10/19/biking-on-a-sunny-day-after-snow/feed/</wfw:commentRss>
		</item>
		<item>
		<title>你什么动机？(转载)</title>
		<link>http://i.azpala.com/2009/10/17/what-is-your-motive/</link>
		<comments>http://i.azpala.com/2009/10/17/what-is-your-motive/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 22:50:42 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[zz]]></category>

		<category><![CDATA[Add new tag]]></category>

		<category><![CDATA[理想]]></category>

		<guid isPermaLink="false">http://i.azpala.com/?p=1179</guid>
		<description><![CDATA[“生在中国是一种不幸，有太多的事情让人痛苦和难过；生在中国也是一种幸福，每天都可以看到改变，看到新的希望。” 为啥我看到的更多的是前半句，尤其是看过这组照片之后。嗯，我还... ]]></description>
			<content:encoded><![CDATA[<p><em>“生在中国是一种不幸，有太多的事情让人痛苦和难过；生在中国也是一种幸福，每天都可以看到改变，看到新的希望。” 为啥我看到的更多的是前半句，尤其是看过</em><a href="http://www.douban.com/photos/album/19723982/" target="_blank"><em>这组照片</em></a><em>之后。嗯，我还是相信中国是有希望的，尤其是在这样的社会环境下，仍然有许多许志永这样的人，坚持自己的理想</em>。</p>
<p><strong>你什么动机？</strong><br />
许志永   2005年1月</p>
<p>刚回到国内没几天就接到党委书记转告“有关部门”对我的警告，说不准再参加任何社会活动，否则可能会被学校解聘甚至失去人身自由。我问，过去一年多的时间里，我做什么违法的事情了吗？我没有任何激进的想法，从来都是主张渐进地推动社会进步，我所做的一切只是在尽一个公民的责任而已。新的一年我可以更低调，但有的事情，我不能不做。除了学术研究和未结的南方都市报案以外，我目前只打算参与一个案件，就是承德陈国清等人历经十年的冤案。如果没有人帮他们，这四个曾经被判过五次死刑的无辜的年轻人将在监狱里度过冤屈的一生。为什么就不能帮他们？请给个理由！</p>
<p>你帮助他们，图个什么？难道就没有别的动机？书记转述别人的疑问。是啊，你不好好写论文评职称混官职挣大钱，却要经常帮助那些遭受不公正待遇的人，帮别人打官司还不要钱，你什么动机？是啊，你想学雷锋啊，你什么动机？！</p>
<p>你有什么动机？我也经常反问自己。尽管这是一个很可怕的逻辑背后一个很变态的问题，我仍然有必要认真思考认真回答。我能想到的唯一自私的动机是，我是为了自己的幸福和快乐。当收容遣送制度宣布废止的那一刻，我是幸福的；当孙大午走出牢狱我们拥抱的那一刻，我是幸福的；当我和陈国清他们的家人拉扯了很长时间终于拒绝他们硬塞我的钱时，我是幸福的；当这四名沉冤十多年的中国公民最终获得公正走出监狱和家人拥抱的那一刻，我将是幸福的。如果有一天我的祖国像很多很多现代国家一样充满公正和谐，而我曾经在这样的历史进程中曾有过哪怕一点点贡献，我会是幸福的；是的，我在追求着自己的幸福，帮助更多的人能让我感到幸福。</p>
<p>为了自己更大的幸福，我需要在有限的时间内作更多更有意义的事情，因此我的行为必须有所取舍。我总是渴望通过一个个案帮助很多人，所以必须选择具有普遍社会意义的个案，当然，这意味着我很多次很快愧疚地拒绝那些渴望帮助的人。我总是渴望通过一个研究报告能为社会进步做出更大的贡献，所以必须做最前沿的课题研究。我总是渴望通过建立在个案之上的一些现代理念或制度得到推广，所以必须有媒体的帮助。如果为了在有限的生命中做更多的事情必须具备某种影响力的话，我不会拒绝，具备影响力不是目的，而是一种责任，是必须承担的责任。</p>
<p>如果有人非要说这就是政治的话，我不会逃避。你有什么政治目的？这是一种很怪异的猜疑。在中国漫长的历史上，帝王将相们为了个人权力不择手段，他们为了自己的私欲，不会在乎“白骨露于野，千里无鸡鸣”，不会在乎在和平年代里数千万人饿死，政治成了阴谋、邪恶的代名词，这真是中国人的不幸。我梦想的中国是一个自由公正的国家，它应该有一种制度，以保证政治家是一群把为公众谋福利当成自己事业的人，至少，那些为自己私欲不择手段的阴谋家不能在这片土地上以胜利者的姿态趾高气扬。我无意追求权力，我只是不会逃避责任而已。如果有一天，政治这个词不再意味着残暴的权谋，而是意味着为公众谋福利，意味着道德和良知，那我不会拒绝政治。但是今天，如果有人说我的行为是在为政治目的同时又把政治理解为阴谋和权术，那我必须声明我所从事的不是政治。</p>
<p>把自己大量时间用来做社会公益事业，这并不是说我比别人更崇高，这只是一个人的天性而已。每个人都在追求自己的幸福，每个人都在以自己的方式与他人分享自己的幸福。我没有能力成为一个艺术家给社会带来艺术的美，没有能力成为一个企业家挣得巨额物质财富捐献给社会，没有能力成为一个科学家去解决人类面临的科学难题，没有能力成为一个优秀的学者带给社会新的思想，我甚至也没有能力成为一个不闻世事默默无闻只照顾自己家庭幸福的人，因为面对不公正的时候我控制不了自己的愤怒和悲哀。在人生旅途中，我已逐渐放弃了很多很多梦想，但我没有学会沉默。今天，我最大的幸福就在于辛勤工作通过个案或者研究推动社会进步给更多的中国人带来尊严和幸福。或许，应该反过来说，如果我不那样做心里就不快乐，看到那些残酷的不公正我就会感到痛苦。这是我的天命，为了幸福，或者更确切地说，为了避免痛苦，避免自己的痛苦，我必须努力工作，努力帮助那些遭受不幸的同胞。</p>
<p>帮助别人是一种幸福。比尔盖茨每年给非洲的儿童捐助他是幸福的，克林顿退休以后住在美国的黑人区他是幸福的，一个孩子扶一个盲人过马路的时候他们都是幸福的。幸福可以无限分享，其实很多人都有这样的感觉，都有这样的渴望。相反，那些逃避责任的甚至主动给别人制造苦难的人，内心深处一定会受到良心的谴责，他们最终不会得到幸福。我相信这样一个简单的常识，并且愿意和很多很多愿意帮助别人的人一样，成为一个忠实的实践者，成为一个幸福的人。</p>
<p>你什么动机？在一个道德被权力严重败坏的时代，权势者对一个真诚从事公益事业的人提出这样的质疑，并不令人感到吃惊。而一个真诚的理想主义者，面对这无论多么荒诞的问题，都有必要认真回答。生在中国是一种不幸，有太多的事情让人痛苦和难过；生在中国也是一种幸福，每天都可以看到改变，看到新的希望。我渴望一个自由公正的社会并将为此付出一生的努力，我没有在理想主义旗帜的背后埋藏任何阴谋。我顺应天命，忠于良知，追求自己的幸福，如果说，我在追求自己幸福的过程中，给一些素不相识的人带来了幸福，我愿意和他们一起分享这份感动。</p>
<p><strong>因为有你们在，我永不放弃</strong></p>
<p>许志永   2005年10月7日<br />
<h3>以下文章也许和本文有点关系：</h3>
<ul class="related_post">
<li>January 14, 2009 &#8212; <a href="http://i.azpala.com/2009/01/14/reality-and-ideal/" title="现实与理想（中国台湾清华大学教授彭明辉）">现实与理想（中国台湾清华大学教授彭明辉） (3)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2009/10/17/what-is-your-motive/feed/</wfw:commentRss>
		</item>
		<item>
		<title>开启IDLE的自动补全功能</title>
		<link>http://i.azpala.com/2009/10/14/idle-auto-complet/</link>
		<comments>http://i.azpala.com/2009/10/14/idle-auto-complet/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 01:47:05 +0000</pubDate>
		<dc:creator>azalea</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<category><![CDATA[IDLE]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://i.azpala.com/?p=1171</guid>
		<description><![CDATA[在豆瓣Python小组看到的，我以前都不知道IDLE有自动补全功能 =.=
首先，找到idlelib文件夹的路径:
Windows: Python安装目录下的App\Lib\idlelib 目录
Ubuntu: /usr/lib/pythonx.x/idlelib  (比如python2.6)
然后，(以下... ]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://www.douban.com/group/topic/8317063/" target="_blank">豆瓣Python小组</a>看到的，我以前都不知道IDLE有自动补全功能 =.=</p>
<p>首先，<strong>找到idlelib文件夹的路径:</strong></p>
<p>Windows: Python安装目录下的App\Lib\idlelib 目录</p>
<p>Ubuntu: /usr/lib/pythonx.x/idlelib  (比如python2.6)</p>
<p>然后，(以下是复制粘贴，稍有改动)</p>
<p><strong>打开目录下的config-extensions.def文件 </strong></p>
<p>[AutoComplete]<br />
enable=1<br />
popupwait=2000<br />
[AutoComplete_cfgBindings]<br />
force-open-completions=&lt;Control-Key-space&gt;<br />
[AutoComplete_bindings]<br />
autocomplete=&lt;Key-Tab&gt;<br />
try-open-completions=&lt;KeyRelease-period&gt; &lt;KeyRelease-slash&gt; &lt;KeyRelease-backslash&gt;</p>
<p>将 enable 设为1 (好像默认值就是1 &#8212;azalea注)<br />
popupwait=2000 这个是弹出自动完成窗口的响应时间<br />
根据自己的喜好设置</p>
<p>然后的然后，<strong>导入需要响应自动补全的模块</strong></p>
<p>打开目录下的 AutoComplete.py</p>
<p>&#8220;&#8221;"AutoComplete.py - An IDLE extension for automatically completing names.</p>
<p>This extension can complete either attribute names of file names. It can pop<br />
a window with all available names, for the user to select from.<br />
&#8220;&#8221;"</p>
<p>import os<br />
import sys<br />
import string<br />
import wx</p>
<p>在文件的开头导入需要自动完成功能的模块 ，比如我需要使用wx库，所以我在最后一行import wx</p>
<p>其他的库做法类似，保存，重新启动idle就可以了。</p>
<p>最后，如果你想打开自动补全的下拉菜单，要<strong>按 tab 键</strong></p>
<p>比如</p>
<p>import os</p>
<p>os.s (此时按tab)</p>
<p>就会出现</p>
<p><a rel="attachment wp-att-1172" href="http://i.azpala.com/2009/10/14/idle-auto-complet/idle_auto_complete_example/"><img class="aligncenter size-full wp-image-1172" title="idle_auto_complete_example" src="http://i.azpala.com/wp-content/uploads/2009/10/idle_auto_complete_example.png" alt="idle_auto_complete_example" width="354" height="231" /></a><br />
<h3>以下文章也许和本文有点关系：</h3>
<ul class="related_post">
<li>March 11, 2009 &#8212; <a href="http://i.azpala.com/2009/03/11/idle-key-shortcut/" title="查看和设置IDLE快捷键">查看和设置IDLE快捷键 (13)</a></li>
<li>March 6, 2010 &#8212; <a href="http://i.azpala.com/2010/03/06/dont-do-things-the-hardest-way/" title="Don&#8217;t do things the hardest way">Don&#8217;t do things the hardest way (2)</a></li>
<li>February 19, 2010 &#8212; <a href="http://i.azpala.com/2010/02/19/n-nt-motif-frequency-in-dna-sequences/" title="Python统计DNA序列中长度为n的子序列频率">Python统计DNA序列中长度为n的子序列频率 (3)</a></li>
<li>January 29, 2010 &#8212; <a href="http://i.azpala.com/2010/01/29/weird-python-features/" title="Python语言的诡异特性">Python语言的诡异特性 (4)</a></li>
<li>October 13, 2009 &#8212; <a href="http://i.azpala.com/2009/10/13/python-binary-multiplicatio/" title="Python二进制乘法">Python二进制乘法 (2)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i.azpala.com/2009/10/14/idle-auto-complet/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
