[Python-checkins] CVS: python/nondist/peps pep-0211.txt,1.4,1.5
Barry Warsaw
python-dev@python.org
2000年11月26日 21:41:48 -0800
Update of /cvsroot/python/python/nondist/peps
In directory slayer.i.sourceforge.net:/tmp/cvs-serv20595
Modified Files:
pep-0211.txt
Log Message:
Greg Wilson's latest.
Index: pep-0211.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0211.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** pep-0211.txt 2000年11月22日 22:01:47 1.4
--- pep-0211.txt 2000年11月27日 05:41:46 1.5
***************
*** 21,25 ****
! Proposal
Add a single new infix binary operator '@' ("across"), and
--- 21,25 ----
! Summary
Add a single new infix binary operator '@' ("across"), and
***************
*** 142,177 ****
A new operator '@' (pronounced "across") will be added to Python,
along with special methods "__across__()", "__racross__()", and
! "__iacross__()", with the usual semantics.
!
! NumPy will overload "@" to perform mathematical multiplication of
! arrays where shapes permit, and to throw an exception otherwise.
! Its implementation of "@" will treat built-in sequence types as if
! they were column vectors. This takes care of the cases MM and MV.
!
! An attribute "T" will be added to the NumPy array type, such that
! "m.T" is:
!
! (a) the transpose of "m" for a 2-dimensional array
!
! (b) the 1xN matrix transpose of "m" if "m" is a 1-dimensional
! array; or
!
! (c) a runtime error for an array with rank >= 3.
!
! This attribute will alias the memory of the base object. NumPy's
! "transpose()" function will be extended to turn built-in sequence
! types into row vectors. This takes care of the VM, VD, and VO
! cases. We propose an attribute because:
!
! (a) the resulting notation is similar to the 'superscript T' (at
! least, as similar as ASCII allows), and
- (b) it signals that the transposition aliases the original object.
-
No new operators will be defined to mean "solve a set of linear
! equations", or "invert a matrix". Instead, NumPy will define a
! value "inv", which will be recognized by the exponentiation
! operator, such that "A ** inv" is the inverse of "A". This is
! similar in spirit to NumPy's existing "newaxis" value.
(Optional) When applied to sequences, the "@" operator will return
--- 142,151 ----
A new operator '@' (pronounced "across") will be added to Python,
along with special methods "__across__()", "__racross__()", and
! "__iacross__()", with the usual semantics. (We recommend using
! "@", rather than the times-like "><", because of the ease with
! which the latter could be mis-typed as inequality "<>".)
No new operators will be defined to mean "solve a set of linear
! equations", or "invert a matrix".
(Optional) When applied to sequences, the "@" operator will return
***************
*** 294,298 ****
0225 : Elementwise/Objectwise Operators
! A (much) larger proposal that addresses the same subject.
--- 268,273 ----
0225 : Elementwise/Objectwise Operators
! A larger proposal that addresses the same subject, but
! which proposes many more additions to the language.
***************
*** 313,330 ****
[7] http://www.python.org/pipermail/python-list/2000-August/112529.html
! Appendix: Other Operations
! We considered syntactic support for three other operations:
! T
! (a) transposition: A => A[j, i] for A[i, j]
! -1
! (b) inverse: A => A' such that A' * A = I (the identity matrix)
! (c) solution: A/b => x such that A * x = b
! A\b => x such that x * A = b
--- 288,323 ----
[7] http://www.python.org/pipermail/python-list/2000-August/112529.html
+
+ Appendix: NumPy
! NumPy will overload "@" to perform mathematical multiplication of
! arrays where shapes permit, and to throw an exception otherwise.
! Its implementation of "@" will treat built-in sequence types as if
! they were column vectors. This takes care of the cases MM and MV.
+ An attribute "T" will be added to the NumPy array type, such that
+ "m.T" is:
! (a) the transpose of "m" for a 2-dimensional array
! (b) the 1xN matrix transpose of "m" if "m" is a 1-dimensional
! array; or
! (c) a runtime error for an array with rank >= 3.
!
! This attribute will alias the memory of the base object. NumPy's
! "transpose()" function will be extended to turn built-in sequence
! types into row vectors. This takes care of the VM, VD, and VO
! cases. We propose an attribute because:
!
! (a) the resulting notation is similar to the 'superscript T' (at
! least, as similar as ASCII allows), and
!
! (b) it signals that the transposition aliases the original object.
! NumPy will define a value "inv", which will be recognized by the
! exponentiation operator, such that "A ** inv" is the inverse of
! "A". This is similar in spirit to NumPy's existing "newaxis"
! value.