[Tutor] mnemonics to better learn Python

David ldl08 at gmx.net
Thu Jul 23 08:05:36 CEST 2009


Dear List,

in order to memorize which Python sequences are mutable or immutable, I
focused on the SHAPE of the brackets that are associated with each type
of sequence.

For instance, a *list* is characterised by square brackets, [].
My mnemonic device to memorize that lists are mutable is this: "the
brackets have sharp edges, they could be trimmed, taking their edges off".

The same thing happens with *dictionaries* (which, okay, are not
sequences). Anyway, their brackets, {}, have sharp edges, hence they are
mutable.

*Tuples*, in turn, have perfectly 'round' brackets, (), and these
brackets obviously can't be improved upon by taking anything off them.
Hence: tuples are immutable.

That leaves us with *strings*, which are also not mutable. Here we have
no brackets, and this particular mnemonic device breaks down.

What I am interested in is finding out whether you use similar
techniques, and if so, which ones? How, for examples, do you make sense
of all those special characters that make regular expressions powerful?
Do you rely on rote learning, or do you employ some other technique?

I reckon that if we could come up with some tips and techniques as to
how to uncloud the thick information fog that any beginning programmer
has to wade through, the very first steps in learning Python could be
made more easy.

What insights can you share?

Curious,

David


More information about the Tutor mailing list