tags:

views:

75

answers:

4

For example I want to know how to use Python pickle serialization & deserialization. Since I've never use it, reading Python official doc would be a great reference, but I prefer some snippets/example codes either has description or not. Like sites for python beginners, someone's blog, or from google codes.

How would you search? Like go to specific sites, or use what keyword. Actually this is a general question not only for Python, but for learning all languages. Thanks.

+5  A: 

Google Code Search.

From the FAQ:

We're crawling as much publicly accessible source code as we can find, including archives (.tar.gz, .tar.bz2, .tar, and .zip), CVS repositories and Subversion repositories.

Sample search: http://www.google.com/codesearch?q=lang%3Apython+%22cpickle%22

The operators are handy:

  • The lang: operator, which restricts by programming language (e.g., lang:"c++", -lang:java, or lang:^(c|c#|c++)$)
  • The license: operator, which restricts by software license (e.g., license:apache, -license:gpl, or license:bsd|mit)
  • The package: operator, which restricts by package URL (e.g., package:"www.kernel.org" or package:.tgz$)
  • The file: operator, which restricts by filename (e.g., file:include/linux/$ or -file:.cc$)
Adam Bernier
I've personally found google code search to be completely worthless. Sure, it finds your keywords in some source code...but the code that it digs up, is rarely ever "here's a chunk of sample code showing how to use it".
Mark
A: 

In general, Google Code Search is a pretty good place to look for code snippets. To look for Python pickle examples, I'd do a search like

lang:python pickle examples
rettops
+1  A: 

You can also look at Activestate Python Recipe's: http://code.activestate.com/recipes/langs/python/

Here's their recipes for Python Pickling: http://code.activestate.com/search/#q=pickle python

O'Reilly's Python Cookbook is also good. You can read it online with a Safari membership.

Anton I. Sipos
+1  A: 

There is also Nullege. A search engine especially for Python code.

Paidhi