[Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable

Stephen J. Turnbull stephen at xemacs.org
Tue Apr 22 19:41:17 CEST 2014


Leandro Pereira de Lima e Silva writes:

 >> In teaching Python, I find that analogs to other languages are
 >> helpful in explaining Python even if a person doesn't know the other
 >> language.
 >>     sorted(set(open(somefile)))
 >> is like:
 >>     cat somefile | sort | uniq       # different algorithm, same outcome
 >> or:
 >>     SELECT DISTINCT line FROM somelines ORDER BY line;

 > I think that it helps by making the learning curve less steep,
 > although it also has the potential to produce poor code because
 > different languages may have different idioms to solving different
 > problems.

True, of course.  I think what Raymond is saying is that these
other-language examples can help smooth over those "¿Qué pasa?"
moments, so the teacher can focus on style and idiomatic coding in the
language at hand.  Some teachers will use them more than others do.

On the other hand, there's no need to purge them from the docs and
tutorials.  If someone notices that some example/analogy seems likely
to get in the way of understanding, they can and should write a patch
to improve that example.


More information about the Python-Dev mailing list