ranking Sort Sort   |   date Sort Sort   |   member Sort Sort
Syndication

10
Date Submitted Wed. Oct. 11th, 2006 2:41 PM
Revision 1
Beginner nil_ptr
Tags permutations | permute | python
Comments 1 comments
This is snippet of code solves the interesting (and specialized) problem of generating all permutations of a list. I hope you like recursion. For exmaple:

permute( [0,1,2] )

would return

[[0,1,2],[0,2,1],[1,0,2],[1,2,0],[2,0,1],[2,1,0]]
6
Date Submitted Fri. Aug. 18th, 2006 11:10 AM
Revision 1
Scripter ASmith
Tags python
Comments 4 comments
Builds and prints a list of all links in a specified webpage
9
Date Submitted Fri. Aug. 18th, 2006 11:06 AM
Revision 1
Scripter ASmith
Tags python
Comments 1 comments
Quick way to get the users home directory in Unix/Linux and Windows
6
Date Submitted Fri. Aug. 18th, 2006 11:04 AM
Revision 1
Scripter ASmith
Tags archive | python
Comments 0 comments
Decompress a .tar.bz2 archive in Pytho
6
Date Submitted Fri. Aug. 18th, 2006 11:01 AM
Revision 1
Scripter ASmith
Tags Date | python
Comments 0 comments
Computes the difference between two dates in seconds
9
Date Submitted Fri. Aug. 18th, 2006 10:59 AM
Revision 1
Scripter ASmith
Tags python
Comments 0 comments
Reads well formed RSS entries using standard python libraries
6
Date Submitted Fri. Aug. 18th, 2006 10:56 AM
Revision 1
Scripter ASmith
Tags python
Comments 2 comments
Reads a file line by line using Python in 3 lines
7
Date Submitted Fri. Aug. 18th, 2006 9:40 AM
Revision 1
Scripter ASmith
Tags python
Comments 2 comments
Very fast method for extracting all of the unique items from a list while preserving their original ordering.
7
Date Submitted Tue. Aug. 15th, 2006 3:24 AM
Revision 1
Scripter ASmith
Tags python
Comments 3 comments
Introduction
This function is a function that returns a function. You pass it a function, and it returns a function that takes a collection as a parameter and applies your function to it. The difference between this and map is that this returns a function that you can use again which takes a collection as a parameter.

For Example

If I had a collection c, and a function p that prints its argument, I can create a visitor function using the following:
printVisitor=createVisitor(p)

Then any time I want to print a collection I just type:
printVisitor(c)

A Better Example
If you were writing an IRC server you would probably have many functions that operated on a list of users, such as ban,makeop, etc. You could create those functions in a manor similar to the following:

banUsers=createVisitor(ban)
makeOperators=createVisitor(makeop)

Then in a seperate file you could use these functions as if they were regular functions.

you would type banUsers(users) to ban, or makeOperators(users) to promote those users.
9
Date Submitted Sun. Aug. 13th, 2006 10:50 PM
Revision 1
Scripter ASmith
Tags google | python | Text | translation
Comments 1 comments
Translates text from using translate.google.com