Difference between revisions of "Category:Python"
Line 2: | Line 2: | ||
[[Image:Python.png]] | [[Image:Python.png]] | ||
== [http://pexpect.sourceforge.net Pexpect -- An Expect-like module in pure Python ] == | == [http://pexpect.sourceforge.net Pexpect -- An Expect-like module in pure Python ] == | ||
+ | |||
I loved Expect, but I hated TCL, so I wrote this 100% pure Python module that does the same thing. | I loved Expect, but I hated TCL, so I wrote this 100% pure Python module that does the same thing. | ||
+ | |||
+ | == Other Free Python software == | ||
+ | |||
+ | You can find other free software I wrote (mostly in Python) here: [/wiki/index.php/Category:Free_Software Free Software] | ||
== [http://www.noah.org/engineering/dotfiles/.vimrc .vimrc] for Python == | == [http://www.noah.org/engineering/dotfiles/.vimrc .vimrc] for Python == | ||
+ | |||
I like VIM. This is how I set my [http://www.noah.org/engineering/dotfiles/.vimrc .vimrc] file. I never liked the built-in indent folding for Python because it folds EVERYTHING. For code folding I like things to be pretty flat -- I just want to see class names and method names. I don't need every single nested loop folded many levels deep... In this .vimrc see the section on "folding using /search/ pattern". This maps the normal mode key sequence, 'zff' to set the search pattern to find all class and method names. This also maps '\z' to refold every search pattern. The neat thing is that this pattern also works on PHP code! The '\z' mapping is also handy for editing other documents. | I like VIM. This is how I set my [http://www.noah.org/engineering/dotfiles/.vimrc .vimrc] file. I never liked the built-in indent folding for Python because it folds EVERYTHING. For code folding I like things to be pretty flat -- I just want to see class names and method names. I don't need every single nested loop folded many levels deep... In this .vimrc see the section on "folding using /search/ pattern". This maps the normal mode key sequence, 'zff' to set the search pattern to find all class and method names. This also maps '\z' to refold every search pattern. The neat thing is that this pattern also works on PHP code! The '\z' mapping is also handy for editing other documents. | ||
== [http://aspn.activestate.com/ASPN/Python/Cookbook Python Cookbook] == | == [http://aspn.activestate.com/ASPN/Python/Cookbook Python Cookbook] == | ||
+ | |||
ActiveState's fun and useful Python cookbook. | ActiveState's fun and useful Python cookbook. | ||
== WTF? == | == WTF? == | ||
+ | |||
This will test for primality with a regular expression. No, I'm serious... | This will test for primality with a regular expression. No, I'm serious... | ||
<pre class="code"> | <pre class="code"> |
Revision as of 09:08, 7 December 2007
Contents
Pexpect -- An Expect-like module in pure Python
I loved Expect, but I hated TCL, so I wrote this 100% pure Python module that does the same thing.
Other Free Python software
You can find other free software I wrote (mostly in Python) here: [/wiki/index.php/Category:Free_Software Free Software]
.vimrc for Python
I like VIM. This is how I set my .vimrc file. I never liked the built-in indent folding for Python because it folds EVERYTHING. For code folding I like things to be pretty flat -- I just want to see class names and method names. I don't need every single nested loop folded many levels deep... In this .vimrc see the section on "folding using /search/ pattern". This maps the normal mode key sequence, 'zff' to set the search pattern to find all class and method names. This also maps '\z' to refold every search pattern. The neat thing is that this pattern also works on PHP code! The '\z' mapping is also handy for editing other documents.
Python Cookbook
ActiveState's fun and useful Python cookbook.
WTF?
This will test for primality with a regular expression. No, I'm serious...
import re def is_prime (num): return re.match(r"^1?$|^(11+?)\1+$",'1'*num) is None
Pages in category "Python"
The following 44 pages are in this category, out of 44 total.