On Thu, Oct 13, 2011 at 2:43 PM, Raymond Hettinger
On Oct 12, 2011, at 5:39 PM, Nick Coghlan wrote:
PEP 355 would allow NumPy to fix that by overriding the logical 'and' operation that is implicit in chained comparisons to force evaluation of the RHS and return the rich result.
Have you considered that what-is-good-for-numpy isn't necessarily good for Python as a whole? Extended slicing and ellipsis tricks weren't so bad because they were easily ignored by general users. In contrast, rich comparisons have burdened everyone (we've paid a price in many ways). The numeric world really needs more operators than Python provides (a matrix multiplication operator for example), but I don't think Python is better-off by letting those needs leak back into the core language one-at-a-time.
Yeah, I'm still almost entirely negative on PEP 355 (the discussion of it only started up again because I asked Guido if we could kill it off officially rather than leaving it lingering in Open status indefinitely). I just thought the chained comparisons case was worth bringing up, since the PEP doesn't currently mention it and it's quite a subtle distinction that you can overload the binary operators to create a rich comparison operation but this overloading isn't effective in the chained comparison case due to the implicit 'and' underlying that syntax. Overall, PEP 355 still seems to be trying to swat a gnat with a sledgehammer, and that's the perspective of someone that has a long history of trying to take out language gnats with sledgehammers of his own ;) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia