This commit is contained in:
Kenneth Reitz
2011-10-05 06:43:00 -04:00
parent dbb8ef104c
commit 670bd2a821
4 changed files with 121 additions and 9 deletions
+25 -9
View File
@@ -1,23 +1,39 @@
!SLIDE
# Part I: Philosophy
!SLIDE
# Dark Pasts
- Perl
- Java
- PHP
- ColdFusion
- Classic ASP
!SLIDE code
# The Zen of Python.
>>> import this
!SLIDE
# Beautiful is better than ugly.
> Beautiful is better than ugly.
!SLIDE
# There should be one—and preferably only one—obvious way to do it.
> Explicit is better than implicit.
!SLIDE
# How to install Python?
A show of hands, please.
> Readability counts.
!SLIDE
# Exactly.
> Although practicality beats purity.
!SLIDE
> If the implementation is hard to explain, it's a bad idea.
!SLIDE
# Welcome to paradise.
!SLIDE
> There should be one—and preferably only one—obvious way to do it.
!SLIDE
# LIES!
View File
+96
View File
@@ -0,0 +1,96 @@
!SLIDE
# Part II: Beginnings
So, let's say we're new to Python.
Let's get started!
!SLIDE
# Step 1: Pick a Release.
Pick carefully.
!SLIDE incremental
# Step 2: Install Python.
Decisions, decisions.
* Download installer from python.org?
* 32bit or 64bit?
* Build from source?
* If so, Unix or framework build?
!SLIDE
# Step 3: Profit!
Let's play around. Maybe play with the GitHub API?
!SLIDE small code execute
# Ruby.
@@@ ruby
require 'net/http'
require 'uri'
uri = URI.parse('https://api.github.com/user')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri.request_uri)
req.basic_auth('username', 'password')
r = http.request(req)
puts r
!SLIDE smaller code execute
# Python.
@@@ python
import urllib2
gh_url = 'https://api.github.com/user'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_manager.add_password(None, gh_url, 'user', 'pass')
auth_manager = urllib2.HTTPBasicAuthHandler(password_manager)
opener = urllib2.build_opener(auth_manager)
urllib2.install_opener(opener)
handler = urllib2.urlopen(req)
print handler.read()
!SLIDE
# http/url/lib/2
!SLIDE
# Step 3: Install Packages.
* MySQL-Python
!SLIDE
# Common Pitfalls
* easy_uninstall?
!SLIDE
# Installing Dependencies
* Pip? Virtualenv? Never mentioned in the docs.
* python-mysql
* mod_wsgi
# Integration Time
!SLIDE
# PIL
(On OSX, this is simple)
View File