My wishlist for Python3K

Andrew Dalke dalke at acm.org
Thu Jun 8 12:19:18 EDT 2000


Thomas Wouters :
>On Thu, Jun 08, 2000 at 01:47:14AM +0000, Huaiyu Zhu wrote:
>> My wishlist for Python3K (This is not to start a flame war):
>
>> 2. Augmentation operators: +=, *=, etc.  Dot operators .*, ./, etc (for
>>    numerical computation to distinguish matrix and elementwise
operations).
>
>This needn't wait for Py3K, and in fact I'm writing code for this right
now,


Would there be a problem with the ambiguity of "3./2" being parsed
as either
  '3.' '/' '2' == 1.5
  '3' './' '2' == whatever ./ does to scalar integers, probably
                  make it be regular division == 1
  ?

The parser is greedy so will make it be the first option, 1.5, which is
the expected behaviour.  But if the '2' is actually the variable 'x'
which is an array, there could be some confusion.   Eg
  x = [1. 2.]
      [3. 4.]
  3./x     ---> should yield [3. 1.5]  or (3.) * (invert_matrix(x)) ?
                             [1. .75]

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list