Selectorweb.com New York
home > Python & Zope Email

Guido van Rossum - creator of Python (Netherlands, 1990)
Python is an interpreted, interactive, object-oriented programming language (with modules, exceptions, dynamic typing, very high level dynamic data types, and classes). 
  - very clear syntax
  - has interfaces to many system calls and libraries, to various window systems
  - extensible in C or C++
  - portable (Unix, Windows, Mac, OS/2).
  - has a version (jython) written in java - you can import it into your java code!!
  - Open Source

- 2000 - Guido and the Python core development team moved to Zope Corporation (www.zope.com). 
- 2001 - Python Software Foundation (PSF - www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related Intellectual Property. Digital Creations is a sponsoring member of the PSF. 

python_of_the_day - collection of my daily emails about python - good intro tutorial (2011-2012)

- www.python.org - central cite (= www.pythonlabs.com/ )
- www.jython.org - Jython ( Python in Java ) - get it !!
- www.python.org/doc/current/tut/tut.html - main tutorial
- www.python.org/doc/FAQ.html - FAQ
- www.python.org/doc/ - documentation

- www.pythonlabs.com/~guido/ - Guido van Rossum (creator of Python) - Personal Home Page
- http://python.org/doc/essays/comparisons.html - Comparing Python to Other Languages

- www.lowerstandard.com/python/ - Useless Python, mostly programs written on the tutor list. It also has links to other Python pages, tutorials and such things.
- www.vex.net/parnassus/ - The Vaults of Parnassus, has a large amount of programs.
- www.pygame.org/ - games

- www.activestate.com/ - they have mail list archives(searchable), lots of white papers, the windows collection of downloads
- www.onlamp.com/python/ - The O'Reilly Python site, has some good articles and sample book chapters
- www.ddj.com/topics/pythonurl/ - Dr Dobbs Journal
- http://diveintopython.org/ - Dive into Python, has some nice stuff in the form of an online book.
- http://groups.google.com/groups?group=comp.lang.python - Google's newsgroup archives which turn up all sorts of things from comp.lang.python.
- www.cetus-links.org - have a wealth of Python links for all things OO.

- http://www.python.org/doc/current/lib/lib.html -
- http://starship.python.net/ -
- http://www.python.org/doc/FAQ.html - FAQ !!

- http://mail.python.org/pipermail/ - mailing lists archives
- http://www.secretlabs.com/daily/ - The Python page
- http://www.inetarena.com/~pdx4d/ocn/cp4e.html - learn/teach math and programming

CGI scripting:
- http://www.webreview.com/2000/07_07/developers/07_07_00_2.shtml -
- http://www.hotscripts.com/Python/ -
- http://www.python.org/doc/essays/ppt/sd99east/ - Using Python for CGI programming
- http://www.python.org/topics/web/basic-cgi.html - cgi tools for python
- http://www.mannyjuan.com/ -
- http://www.cgi-resources.com/  -
- http://cgi.resourceindex.com/Programs_and_Scripts/ -
- http://cgi.algonet.se/htbin/cgiwrap/ug/show.py?script=test.py -
- http://gnosis.cx/publish/programming/feature_5min_python.html -
#!/usr/bin/python
print "Content-Type: text/html\n\n"
print "<html>Hello\n</html>"
#!/usr/bin/python
import cgi
print "Content-Type: text/plain\n\n"
The_Form = cgi.FieldStorage()
for name in The_Form.keys():
    print "Input: " + name + " value: " + The_Form[name].value + "<BR>"
print "Finished!"

Database:
- http://www.python.org/topics/database/ - database related
- http://www.python.org/topics/database/modules.html - database modules

- http://object-craft.com.au/projects/sybase/ - Sybase
- http://www.stecf.org/~npirzkal/python/sybase/ - Sybase
- http://mail.python.org/pipermail/python-list/2001-December/075782.html - DB2
- http://www.python.org/windows/win32/odbc.html - ODBC
- http://sourceforge.net/projects/mysql-python/ - mysql
- http://www.zope.org/Members/adustman/Products/MySQLdb - mysql

- http://www.freenetpages.co.uk/hp/alan.gauld/ - Learning to program
 

zope

Zope is an Open Source web application server.
 - enables teams to collaborate in the creation and management of dynamic web applications
 - makes it easy to add site search, news, personalization, e-commerce, etc.
 - comes with built-in web server and search engine
 - uses DTML (Document Template Markup Language)

- www.zope.org/ - main site = www.zope.com
- www.zope.org//Members/runyaga/ZopeFAQs/FrontPage - FAQ
- www.zope.org/Members/michel/ZB/ - Zope book
- www.zope.org/Documentation - Documentation
- http://zdp.zope.org/ - Zope Documentation Portal
- http://zdp.zope.org/projects/zqr/ - Quick reference
- www.devshed.com/Server_Side/Zope/Intro/ -
 

python 101 tutorial

Here are several good books you can download or read online:

Python 101 - http://www.rexx.com/~dkuhlman/python_101/python_101.html

List

shoplist = ['apple', 'mango', 'carrot', 'banana']
N = len(shoplist)
for item in shoplist:
    print item,
shoplist.append('rice')
shoplist.sort()
olditem = shoplist[0]

shoplist[0]
shoplist[1:2] # slice
del shoplist[0]
mylist = shoplist; # creating an alias
mylist = shoplist[:] # making a shallow copy

array

xx = array([2,4,-11])
yy = zeros(3,Int)
yy = xx + 0.1 #  [  2.1   4.1  -10.9]
zz = xx + yy # will add like vectors (corresponding elements)

 

 

List Comprehension

mapping / filterring lists
[elem for elem in mylist if len(elem) > 1]

 

Tuple

Tuple is an immutable list - can not be changed once it is created
t = ("a", "b", "mpilgrim", "z", "example")
t[0]

 

 

Sequence

something that can be indexed. For example, lists, tuples, strings.

 

set, frozenset

unordered collection of distinct hashable objects. Common use - membership testing, removing duplicates.  x in set, len(set), for x in set.
s= set(['a',2,3,'b']);
print s
set(['a', 2, 3, 'b'])
s.add('crocodile')
In v.2.7 you can do this: s = {'jack', 'jim'}

 

Dictionary

Dictionary in python is like a hash in perl
d1 = {"kk1":"vv1","kk2":"vv2"}
d1["vv2"]
d1["kk3"] = 567;
d1[42] = "vv4";
d1.keys( )
d1.values( )

 

 

map

map(function, iterable, ...) # Apply function to every item of iterable and return a list of the results. May include additional iterable arguments (...). If one iterable is shorter than another it is assumed to be extended with None items.

 

 

filter

filter(function, iterable) is equivalent to [item for item in iterable if function(item)]

 

lambda

Create function objects at run time
def make_repeater(n):
    return lambda s: s * n
twice = make_repeater(2)
print twice('word')
print twice(5)

> python lambda.py
wordword
10


Populating a hash:
==============================
# populating a hash from array
ar = [4,3,5,2,1]

# for loop
for kk in ar : h1[kk] = 1
for kk, vv in sorted(h1.items()) :  print kk," => ", vv
print

# pass in a list comprehension to generate a list of tuples to the dict() constructor
h2 = dict([(x, 1) for x in ar])
for kk, vv in sorted(h2.items()) :  print kk," => ", vv
print

# map() + lambda
h3 = dict( map( lambda x: (x, 1), ar) )
for kk, vv in sorted(h3.items()) :  print kk," => ", vv
print
==============================
getting a list of hash values
[ hash[k] for k in ar ]  # generates a list of hash values which are keyed by ar
[ map( lambda x: hash[x], ar ) ]
==============================
S = set(["baz"])
R = dict((k,v) for k,v in D.items() if k in S)
ar2 = [2*i for i in ar]

.