Typed Python?

Peter Hansen peter at engcorp.com
Tue Jul 6 18:38:25 EDT 2004


Michael Sparks wrote:

> And whilst this might seem a trivial point, it's worth remembering that
> new users generally don't interpret things you expect. For example:
> 
> if x is not None:
>    print "hello"
> else:
>    print "Goodbye"
> 
> Looks pretty unamiguous to a programmer's eyes. The most interesting
> description I've heard from a non-programmer looking at that is:
> "If x is something, print 'hello' and if that fails print 'goodbye'"

Was your sample non-programmer a native English speaker?  I don't
know anyone who interprets "if/then/else" as implying some kind
of exception mechanism, programmer or not.

> ie something semantically more like:
> 
> if x is not None:
>    try:
>       print "hello"
>    except:
>       print "Goodbye"

That's ludicrous.  Is it possible _you_ were misinterpreting
what your non-programmer meant by "if that fails"?

-Peter



More information about the Python-list mailing list