Puzzled by list-appending behavior

Chris Angelico rosuav at gmail.com
Fri May 27 00:10:24 EDT 2011


On Fri, May 27, 2011 at 1:52 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Because "lst" is not a real word. To native readers of languages derived
> from Latin or Germany, such as English, it is quite a strange "word"
> because it has no vowel. In addition, it looks like 1st (first).

Contrived examples are always awkward; in real examples, there's often
an alternative based on the list's purpose, which can then be used to
offer a name.

> Sometimes shadowing is harmless, and sometimes it's useful.

Agreed on both those halves; and obviously, the times where it's
useful are very much important. I have to say, I do like Python's lack
of keywords for these things; the ability to shadow is a flexibility
that means that, for the most part, new builtins can be added to the
language without breaking existing code.

ChrisA



More information about the Python-list mailing list