background preloader

Learn Python Through Public Data Hacking

Learn Python Through Public Data Hacking

Twisted Twisted is an event-driven networking engine written in Python and licensed under the open source ​MIT license. Twisted runs on Python 2 and an ever growing subset also works with Python 3. Twisted makes it easy to implement custom network applications. Here's a TCP server that echoes back everything that's written to it: from twisted.internet import protocol, reactor, endpoints class Echo(protocol.Protocol): def dataReceived(self, data): self.transport.write(data) class EchoFactory(protocol.Factory): def buildProtocol(self, addr): return Echo() endpoints.serverFromString(reactor, "tcp:1234").listen(EchoFactory()) Learn more about ​writing servers, ​writing clients and the ​core networking libraries , including support for SSL, UDP, scheduled events, unit testing infrastructure, and much more. Twisted includes an event-driven web server. Learn more about ​web application development, ​templates and Twisted's ​HTTP client. Twisted includes a sophisticated IMAP4 client library.

Welcome to Code for climate website How not to write Python code Lately I’ve been reading some rather unclean Python code. Maybe this is mainly because the author(s) of the code had no in-depth knowledge of the Python language itself, the ‘platform’ delivered with cPython,… Here’s a list of some of the mistakes you should really try to avoid when writing Python code: Some days ago RealNitro pointed me at this list of essential Python readings. “Idiomatic Python” is a must-read, even for experienced Python developers. That’s about it for now, maybe I’ll add some more items to this list later on. Posted in Development, Technology. Tagged with Development, python. By Nicolas – February 8, 2008

Pakete • Deutsche Pakete Aktuelle Version: 3.0.12 Um deutschsprachigen Anwendern die Installation von phpBB zu erleichtern, bieten wir ein fertiges deutsches Paket an. Dieses besteht aus phpBB 3.0.12, den deutschen Sprachdateien (in der Du- und Sie-Version) sowie den deutschen Grafiken für die beiden mitgelieferten Styles (prosilver und subsilver2). Außerdem wird im Ordner phpBB3/docs die deutsche Anleitung „phpBB 3.0“-Schnelleinstieg mitgeliefert. Wenn Sie dieses Paket herunterladen, sind keine zusätzlichen Downloads erforderlich. Komplettpaket Enthält alles was nötig ist, um ein deutsches phpBB zu installieren. Download phpBB Deutsch 3.0.12 [zip] Dateigröße: Keine Informationen verfügbar MD5-Summe: Keine Informationen verfügbar Automatischer Updater Mit Hilfe des automatischen Updater werden phpBB-Installationen auf die aktuelle Version aktualisiert. phpBB Deutsch 3.0.11 » 3.0.12 [zip] Dateigröße: Keine Informationen verfügbar MD5-Summe: Keine Informationen verfügbar Original Pakete Geänderte Dateien

Python Programming Language – Official Website How to Think Like a Computer Scientist — How to Think like a Computer Scientist: Interactive Edition This interactive book is a product of the Runestone Interactive Project at Luther College, led by Brad Miller and David Ranum. There have been many contributors to the project. Our thanks especially to the following: This book is based on the Original work by: Jeffrey Elkner, Allen B. The Runestone Interactive tools are open source and we encourage you to contact us, or grab a copy from GitHub if you would like to use them to write your own resources. Stanford Portable Library for C++ This package contains the code for the Stanford Portable C++ library, as described in the paper by Eric Roberts and Keith Schwarz included in the doc directory. You can download the source code for the library by clicking on the following link: The Makefile in the root directory should make a complete version of the library on Unix-based systems or Mac OS X. Building the .lib file for Windows-based systems depends on what version of the operating system and what programming environment you are using. This package is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (see This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The Python “with” Statement by Example Python’s with statement was first introduced five years ago, in Python 2.5. It’s handy when you have two related operations which you’d like to execute as a pair, with a block of code in between. The classic example is opening a file, manipulating the file, then closing it: with open('output.txt', 'w') as f: f.write('Hi there!') The above with statement will automatically close the file after the nested block of code. (Continue reading to see exactly how the close occurs.) Here’s another example. This code sample uses a Context object (“cairo context”) to draw six rectangles, each with a different rotation. cr.translate(68, 68) for i in xrange(6): cr.rotate(2 * math.pi * i / 6) cr.rectangle(-25, -60, 50, 40) cr.stroke() cr.restore() That’s a fairly simple example, but for larger scripts, it can become cumbersome to keep track of which save goes with which restore, and to keep them correctly matched. Implementing the Context Manager as a Class Here’s the first approach. Uh oh!

Hands-On Python A Tutorial Introduction for Beginners Hands-On Python A Tutorial Introduction for Beginners Contents Chapter 1Beginning With Python 1.1. You have probably used computers to do all sorts of useful and interesting things. 1.1.1. First let us place Python programming in the context of the computer hardware. z = x+y is an instruction in many high-level languages that means something like: Access the value stored at a location labeled x Calculate the sum of this value and the value stored at a location labeled y Store the result in a location labeled z. No computer understands the high-level instruction directly; it is not in machine language. Obviously high-level languages were a great advance in clarity! If you follow a broad introduction to computing, you will learn more about the layers that connect low-level digital computer circuits to high-level languages. 1.1.2. There are many high-level languages. 1.1.3. If you are not sure whether your computer already has Python, continue to Section 1.2.2, and give it a try. Windows Linux

Installation and quick start — nose 1.3.0 documentation nose extends unittest to make testing easier. On most UNIX-like systems, you’ll probably need to run these commands as root or using sudo. Install nose using setuptools/distribute: Or pip: Or, if you don’t have setuptools/distribute installed, use the download link at right to download the source package, and install it in the normal fashion: Ungzip and untar the source package, cd to the new directory, and: However, please note that without setuptools/distribute installed, you will not be able to use third-party nose plugins. This will install the nose libraries, as well as the nosetests script, which you can use to automatically discover and run tests. Now you can run tests for your project: cd path/to/project nosetests You should see output something like this: .................................. ---------------------------------------------------------------------- Ran 34 tests in 1.440s OK Indicating that nose found and ran your tests. For help with nosetests’ many command-line options, try:

Trie A trie for keys "A","to", "tea", "ted", "ten", "i", "in", and "inn". Note that this example does not have all the children alphabetically sorted from left to right as it should be (the root and node 't'). In the example shown, keys are listed in the nodes and values below them. Each complete English word has an arbitrary integer value associated with it. A trie can be seen as a tree-shaped deterministic finite automaton. Though tries are usually keyed by character strings,[not verified in body] they need not be. History and etymology[edit] Tries were first described by René de la Briandais in 1959.[1][2]:336 The term trie was coined two years later by Edward Fredkin, who pronounces it /ˈtriː/ (as "tree"), after the middle syllable of retrieval.[3][4] However, other authors pronounce it /ˈtraɪ/ (as "try"), in an attempt to distinguish it verbally from "tree".[3][4][5] Applications[edit] As a replacement for other data structures[edit] Tries do have some drawbacks as well: Term indexing[edit]

Understanding Python's "with" statement Fredrik Lundh | October 2006 | Originally posted to Judging from comp.lang.python and other forums, Python 2.5’s new with statement (dead link) seems to be a bit confusing even for experienced Python programmers. As most other things in Python, the with statement is actually very simple, once you understand the problem it’s trying to solve. set things up try: do something finally: tear things down Here, “set things up” could be opening a file, or acquiring some sort of external resource, and “tear things down” would then be closing the file, or releasing or removing the resource. If you do this a lot, it would be quite convenient if you could put the “set things up” and “tear things down” code in a library function, to make it easy to reuse. def controlled_execution(callback): set things up try: callback(thing) finally: tear things down def my_function(thing): do something controlled_execution(my_function) with open("x.txt") as f: data = do something with data

Python Extension Packages for Windows - Christoph Gohlke by Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine. This page provides 32- and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython distribution of the Python programming language. The files are unofficial (meaning: informal, unrecognized, personal, unsupported, no warranty, no liability, provided "as is") and made available for testing and evaluation purposes. If downloads fail reload this page, enable JavaScript, disable download managers, disable proxies, clear cache, and use Firefox. Most binaries are built from source code found on PyPI or in the projects public revision control systems. Refer to the documentation of the individual packages for license restrictions and dependencies. Use pip version 8 or newer to install the downloaded .whl files. Install numpy+mkl before other packages that depend on it. The files are provided "as is" without warranty or support of any kind. Build Environment

:: M O R E W A R E . O R G :: CS50 I completed the CS50 - Introduction to Computer Sciences certification course at HarvardX offered by edX online teaching system. I found it really interesting, and decided to put some effort into it, trying to help the project leader, prof. David Malan, and the project Team in their wonderful work. While still working on creating a common platform for free and on-demand online tutoring, I decided to offer, for a limited time, free electronic access to the books used throughout the course, as well as other electroinc sources I gathered during my studies, divided into arguments towards those students "less comfortable" and "more comfortfable" on Computer Sciences, with the hidden scope to lead all of them into the second section.