background preloader

Python

Facebook Twitter

Django

Why Python is not my favorite language. 1.In Python, an assignment to the non existing variable raises no alert. You will not be warned during compilation and you will not get any alert on execution. Instead, a new variable with your typo will be created, it will store the assigned value, and the original value that was meant to be changed will stay as it was. It will be no obvious crash anywhere, just a buggy behavior to debug. This problem is caused by absence of declarations in this language - variables (including object fields) are created on demand upon assignment. 2. 3.

I am not sure if these issues could be easily fixed in the Python language ("numberstrings" definitely look more like a bug) but they do make a sentence "switch into Python for more productivity" to sound less convincing. I have previously had a largely neutral opinion about this language. Without fail, one hundred percent, you _will_ have a test suite that is significantly larger (two to five times larger) than the rest of the code put together.

Dive Into Python. Home - filemap - GitHub. Wow, the gzip module kinda sucks. Psyco - Home Page. MySQLdb User's Guide. If you want to write applications which are portable across databases, use MySQLdb, and avoid using this module directly. _mysql provides an interface which mostly implements the MySQL C API. For more information, see the MySQL documentation. The documentation for this module is intentionally weak because you probably should use the higher-level MySQLdb module. If you really need it, use the standard MySQL docs and transliterate as necessary. Okay, so you want to use _mysql anyway. Here are some examples. The simplest possible database connection is: import _mysql db=_mysql.connect() This creates a connection to the MySQL server running on the local machine using the standard UNIX socket (or named pipe on Windows), your login name (from the USER environment variable), no password, and does not USE a database. Db=_mysql.connect("localhost","joebob","moonpie","thangs") We haven't even begun to touch upon all the parameters connect() can take.

Db=_mysql.connect(passwd="moonpie",db="thangs") Writing MySQL Scripts with Python DB-API. Paul DuBoispaul@kitebird.com Document revision: 1.02 Last update: 2006-09-17 Table of Contents Python is one of the more popular Open Source programming languages, owing largely to its own native expressiveness as well as to the variety of support modules that are available to extend its capabilities. One of these modules is DB-API, which, as the name implies, provides a database application programming interface.

DB-API's design is similar to that used by Perl and Ruby DBI modules, the PHP PEAR DB class, and the Java JDBC interface: It uses a two-level architecture in which the top level provides an abstract interface that is similar for all supported database engines, and a lower level consisting of drivers for specific engines that handle engine-dependent details. MySQLdb Installation To write MySQL scripts that use DB-API, Python itself must be installed. Verify that your version of Python is 2.3.4 or later, and that the MySQLdb module is installed. A Short DB-API Script conn.close () #! The Django Book. Python Tutorials, more than 300, updated October 16, 2006, and c.

Clever, witty blog title » Blog Archive » Collaborative filterin. During a lunchtime conversation the other day, a coworker mentioned that he was hacking in his spare time on an entry for the Netflix Prize. This got me to thinking about collaborative filtering: why had I never seen a good description of how to do it? I suspect that people who might ordinarily have a casual interest in the subject hear that there are some statistics involved, whereupon they immediately freeze in the mathematical headlights, and turn the conversation to something else, anything else. In early 2005, a researcher named Daniel Lemire published, with Anna Maclachlan, a paper with the jazzy title of “Slope One Predictors for Online Rating-Based Collaborative Filtering“.

This is an important paper, because it presents a family of really simple collaborative filtering schemes. I mean really simple: there are no statistics involved, just a little bit of linear algebra. The coloured cells above indicate which elements of the matrix contain useful information. Self.diffs = {} Tutorial. Python is an easy to learn, powerful programming language.

It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation. The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C).

This tutorial introduces the reader informally to the basic concepts and features of the Python language and system. Xah: A Perl-Python A Day. This is a tutorial on Perl, Python, and few other dynamic languages. The tutorial is concrete, example based, covering a practical subset of the language, using universal language features. The goal is to get you quickly started. You can start coding toy programs after a few hours. Then, you'll be able to understand & use official language reference for detail & advanced features. New languages and snippets are added continuously.

Buy this tutorial for $15. Language in a Glance Note: for JavaScript and emacs lisp, they have dedicated pages. Language Basics by Topic Common tasks. Python Regex Reference Python Regex Tutorial & Reference Advanced, Specific, Tasks Find/Replace Unicode Internet HTML/Web Unix Sys Admin Functional Programing Exercises Python: Constructing a Tree Given Its Edges Python Documentation Problems Python Documentation Problems Python Criticism misc, unsorted Split File Fullpath into Parts classes & objects About The Author.

Python doc mirror: Dive Into Python.