Indentation and optional delimiters

castironpi at castironpi at
Thu Feb 28 16:40:35 CET 2008

On Feb 28, 8:40 am, bearophileH... at wrote:
> But the default behavior may become the "true" copy, that seems
> simpler for a newbie to grasp. The language then may give a tool to
> use references too (like passing arrays to functions in Pascal, you
> can use "var" for pass-by-reference reference).

Do you want all the power?  Do you want to take students in a specific
direction?  If you're preparing them for the language of tomorrow, the
ask the people who foresaw C++ from C.  And visionaries are good
resources-- the person who designed it might cut it too.

It sounds like you want to give them control of pretty much every
aspect if they choose, but can wave hands at a very high level too
("But -this- is important"-style).

But that's what Python does!  Write your own structure in C, and the
program in Python.  Perhaps maybe for extra credit, you can have
students tweak a 10% running time by "upgrading" their structure to
a... ahem... lower language.

Last but not least, try lopping off a few parentheses:

if obj exists:
if obj.exists() if hasattr( obj, 'exists' )
if exists( obj ) if os.path.exists is imported, or callable( exists )
in general
RuntimeAmbiguityError if both are true.

What do you think?

More information about the Python-list mailing list