Introducing Python to others

J. Cliff Dyer jcd at sdf.lonestar.org
Thu Mar 26 12:35:34 EDT 2009


On Thu, 2009-03-26 at 09:35 +0000, Paddy O'Loughlin wrote:
> Hi,
> As our resident python advocate, I've been asked by my team leader to
> give a bit of a presentation as an introduction to python to the rest
> of our department.
> It'll be less than an hour, with time for taking questions at the end.
> 
> There's not going to be a whole lot of structure to it. First, I'm
> going to open up a python terminal and show them how the interpreter
> works and a few basic syntax things and then a file .py files (got to
> show them that python's indenting structure is not something to be
> afraid of :P). I think I'll mostly show things in the order that they
> appear in the python tutorial (http://docs.python.org/tutorial/).
> 
> My question to you, dear python-list, is what suggestions do you have
> for aspects of python that I should show them to make them maybe think
> that python is better than what they are using at the moment.
> All of the audience will be experienced (4+ years) programmers, almost
> all of them are PHP developers (2 others, plus myself, work in C, know
> C#, perl, java, etc.).
> Because of this, I was thinking of making sure I included exceptions
> and handling, the richness of the python library and a pointing out
> how many modules there were out there to do almost anything one could
> think of.
> Anything else you think could make PHP developers starting think that
> python is a better choice?
> If I were to do a (very) short demonstration one web framework for the
> PHP devs, what should I use? CherryPy (seems to be the easiest),
> Django (seems to be the "biggest"/most used), or something else?
> 
> Any other suggestions for a possible "wow" reaction from an audience like that?
> 
1) For PHP developers, I'm a big fan of clean namespaces.  Show no code
with `from foo import *`.  Instead show them (using how by using `import
foo` and `from foo import x, y, z`, your namespace only has those things
you explicitly imported, plus the contents of `dir(__builtins__)`.  

2) Aliasing imports is also cool.  Show people how easy it is to switch
from 

>>> import MySQLdb as db
to
>>> import psycopg2 as db

and have all your dbapi2 code still work.  Or from

>>> from StringIO import StringIO
to
>>> from cStringIO import StringIO

3) Functions as first-class variables (which could connect to a
discussion of decorators or of dictionaries as dispatch tables).

4) List comprehensions

5) Generators using yield

6) Also very handy is the interactive interpreter and the ability to
type `dir(foo)` and `help(foo)` to see what facilities are available to
you.


> Thanks,
> Paddy
> 

Cheers,
Cliff




More information about the Python-list mailing list