How to "wow" someone new to Python

Andrew Berg aberg010 at my.hennepintech.edu
Fri Jan 16 16:24:07 CET 2015


On 2015.01.16 09:03, Chris Angelico wrote:
> Scenario: You're introducing someone to Python for the first time.
> S/he may have some previous programming experience, or may be new to
> the whole idea of giving a computer instructions. You have a couple of
> minutes to show off how awesome Python is. What do you do?
> 
> I was thinking along the lines of a simple demo in the REPL, showing
> off some of Python's coolest features. But then I got stuck on the
> specifics. What are Python's best coolnesses? What makes for a good
> demo?
> 
> Ideally, this should be something that can be demo'd quickly and
> easily, and it should be impressive without going into great details
> of "and see, this is how it works on the inside". So, how would you
> brag about this language?
If the person is already familiar with programming, you could show off how
Python doesn't do a best effort guess at what to do when you make a mistake
(explicit is better than implicit). Many other languages will, for example,
make an undefined variable into a variable defined as an empty string or allow
silly things like 5 + "cheese", whereas Python will let you know that you made
a mistake somewhere instead of letting garbage propagate. This behavior can be
frustrating for newbies to Python, but with someone there to explain why it
works that way, they can learn to appreciate it instead of giving up in anger
after Python keeps throwing exceptions at them.

If the person is not familiar with programming, show them how easy it is to get
something useful written quickly, even with only the stdlib. Low-level details
are handled so that you can focus on what you want the program to do, and there
is a ton of stuff in the stdlib so that it's likely you don't need to go
searching for a bunch of different libraries so that again, you can focus what
you want the program to do. For this, chances are, that person has some things
in mind already that are not difficult to get started with using Python. Also,
using the REPL for this makes it an even better demo. You can probably have the
basic functionality of whatever cool thing they want right there in the REPL.



More information about the Python-list mailing list