Pythonification of the asterisk-based collection packing/unpacking syntax

Chris Angelico rosuav at gmail.com
Thu Dec 22 08:30:56 EST 2011


On Fri, Dec 23, 2011 at 12:12 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> class MyClass superclasslist A, B C:
>    def method argumentlist self, x, y:
>        t = tuple 1, 2 tuple 3, 4 endtuple endtuple
>        return group x + y endgroup * group x - y endgroup
>
>
> Much less confusing!

A definite improvement. However, I fear that the numerals "1", "2",
etc are far too vague. In some contexts, the abuttal of two such
numerals results in a larger number by a factor of 10, while in
others, the factor is 8, or 16, or 2. This must not be. We need an
unambiguous representation of integers.

Also, I think we should adopt an existing standard [1]. This is
generally a good idea.

class MyClass superclasslist A, B C:
   def method argumentlist self, x, y:
       t = tuple summer's day, proud pony tuple
          sum of honest purse and fellow, large proud town
       endtuple endtuple
       return product of group sum of x and y endgroup and group
difference between x and y endgroup

You will find this a vast improvement.

ChrisA

[1] http://shakespearelang.sourceforge.net/report/shakespeare/shakespeare.html#SECTION00045000000000000000
or http://tinyurl.com/6sycv



More information about the Python-list mailing list