Difference between revisions of "Category:Python"

From Noah.org
Jump to: navigation, search
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Engineering]]
 
[[Category:Engineering]]
== [http://pexpect.sourceforge.net Pexpect -- An Expect-like module in pure Python ] ==
+
[[Image:Python.png]]
I loved Expect, but I hated TCL, so I wrote this 100% pure Python module that does the same thing.
+
 
+
== [[Illustrator_COM_Python|Scripting Adobe Illustrator with COM and Python]] ==
+
Python speaks COM. Illustrator speaks COM. Combine the two. Unfortunately, I think Adobe is not going to be pushing the COM interface in the future. I don't know how they plan to support scripting. Last I saw they has some unusable and ugly XML "interface".
+
 
+
== Daemonize ==
+
Here is the essential Python [[DaemonizePython]] script.
+
 
+
== [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.
+
 
+
== [[Self-extracting_Python_Script | Self-extracting Python Script]] ==
+
This shows how to build a compressed self-extracting script. This is a handy way to distributed a script and all of its modules in a single executable file.
+
 
+
== [http://aspn.activestate.com/ASPN/Python/Cookbook Python Cookbook] ==
+
ActiveState's fun and useful Python cookbook.
+
 
+
== WTF? ==
+
Test for primality with a regular expression. No, I'm serious...
+
<pre>
+
    import re
+
    def is_prime (num):
+
        return re.match(r"^1?$|^(11+?)\1+$",'1'*num) is None
+
</pre>
+

Latest revision as of 18:29, 4 October 2008

Python.png