background preloader

Python

Facebook Twitter

Python Extension Packages for Windows - Christoph Gohlke. By Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine.

Python Extension Packages for Windows - Christoph Gohlke

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. Please only download files manually as needed. 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. Build Environment. Making Python's __init__ method magical. In some programming languages, the idea of “reflection” is somewhat exotic, and takes a while to learn.

Making Python's __init__ method magical

In Python (and Ruby, for that matter), the language is both dynamic and open, allowing you to poke around in the internals of just about any object you might like. Reflection is a natural part of working with these languages, which lends itself to numerous things that you might want to do. Rants of a platform-agnostic python developer. I don’t like virtualenv and I don’t like pip.

Rants of a platform-agnostic python developer

I think they are not only unnecessary, but that they are misleading and harmful. Python programmers are generally not going to agree with me. Virtualenv and pip are almost defacto standards among much of the python community. This is why I am taking the time to write this, because I know how I sound when voice this opinion. Sure, I frequently go ahead and voice it anyway because I like to wind people up, but I’m conscious that I don’t fully justify myself verbally. Virtualenv and the illusion of isolation Isolation and repeatable clean room development without hidden dependencies on the base system is a good thing. Full methods of isolation make virtualenv redundant There are isolation methods that isolate the entire root filesystem.

Virtualenv for deployment is an antipattern I can sense some readers bristle at the mention of tech such as LXC. Virtualenv is full of messy hacks When you install a virtualenv, it’s not empty. –no-site-packages.

Best Practice

Idioms. Machine Learning. DCI. Libs. Encryption. Functional Python. Drastically Improve Your Python: Understanding Python's Execution Model. Those new to Python are often surprised by the behavior of their own code.

Drastically Improve Your Python: Understanding Python's Execution Model

They expect A but, seemingly for no reason, B happens instead. The root cause of many of these "surprises" is confusion about the Python execution model. It's the sort of thing that, if it's explained to you once, a number of Python concepts that seemed hazy before become crystal clear. It's also really difficult to just "figure out" on your own, as it requires a fundamental shift in thinking about core language concepts like variables, objects, and functions. In this post, I'll help you understand what's happening behind the scenes when you do common things like creating a variable or calling a function. "Everything is an object?

" When most people first hear that in Python, "everything is an object", it triggers flashbacks to languages like Java where everything the user writes is encapsulated in an object. What does it mean for everything to be an object? Essential Python Cheat Sheet by sschaub.

Lettuce

Python Shortcuts for the Python Beginner - Max Burstein's Blog. Python Shortcuts for the Python Beginner (Posted on January 26th, 2013) The following are just a collection of some useful shortcuts and tools I've found in Python over the years.

Python Shortcuts for the Python Beginner - Max Burstein's Blog

Hopefully you find them helpful. Swapping Variables x = 6y = 5x, y = y, xprint x>>> 5print y>>> 6 Inline if Statement print "Hello" if True else "World">>> Hello Concatenations The last one is a pretty cool way to combine objects of two different types. nfc = ["Packers", "49ers"]afc = ["Ravens", "Patriots"]print nfc + afc>>> ['Packers', '49ers', 'Ravens', 'Patriots']print str(1) + " world">>> 1 worldprint `1` + " world">>> 1 worldprint 1, "world">>> 1 worldprint nfc, 1>>> ['Packers', '49ers'] 1 Number Tricks #Floor Division (rounds down)print 5.0//2>>> 2#2 raised to the 5th powerprint 2**5>> 32 Be careful with division and floating point numbers. print .3/.1>>> 2.9999999999999996print .3//.1>>> 2.0.