[Python-Dev] Wrappers and keywords

Skip Montanaro skip@pobox.com
Thu, 17 Apr 2003 16:43:23 -0500

    David> It also has the disadvantage of adding a new syntactical
    David> construct to the language does it not (which seems like more pain
    David> than a couple of keywords)?  I don't recall any other place in
    David> the language that uses [] as a way to specify a variable (oops,
    David> excepting list comprehensions sort of, and that's not quite the
    David> same thing IMO), especially in that position in a statement? 

Adding new syntactic sugar is less problem than adding keywords for two

    * old code may have used the new keyword as a variable (because it
      wasn't a keyword)

    * old code won't have used the new syntactic sugar (because it wasn't
      proper syntax)

Combined, it means there is a higher probability that old code will continue
to run with a new bit of syntax than with a new keyword.

You can think of [mod1, mod2, ...] as precisely a list of modifiers to
normal functions, so it is very much like existing list construction syntax
in that regard.  Also "[...]" often means "optional" in may grammar
specifications or documentation, so there's an added hint as to the meaning.