Re: [Python-Dev] ',' precedence in documentation

2008-09-29 Thread Michele Simionato
I like Martin's proposals (use a function, remove -O) very much. Actually I wanted to propose the same months ago. Here is my take at the assert function, which I would like to be able to raise even exceptions different from AssertionError: def assert_(cond, exc, *args): Raise an exception if

Re: [Python-Dev] ',' precedence in documentation

2008-09-24 Thread Jason Orendorff
What I really want is for the need to be less common. What if assert recognized certain commonly used expression types and actually generated appropriate error messages? assert foo.answer == 42 AssertionError: expected foo.answer == 42; actual: 'a suffusion of yellow' Maybe that's too

Re: [Python-Dev] ',' precedence in documentation]

2008-09-16 Thread Steven D'Aprano
On Tue, 16 Sep 2008 10:50:45 am Greg Ewing wrote: Steven D'Aprano wrote: I was confused about the role of commas, and totally gobsmacked when I discovered that commas make tuples everywhere except when following an except statement. Um... you've never written a function call with more

Re: [Python-Dev] ',' precedence in documentation

2008-09-14 Thread Fredrik Lundh
C. Titus Brown wrote: over on the pygr list, we were recently discussing a mildly confusing edit I made: assert 'seq1' in self.db, self.db.keys() This was interpreted by someone as being assert 'seq1' in (self.db, self.db.keys()) which is very different from the actual meaning,

Re: [Python-Dev] ',' precedence in documentation

2008-09-14 Thread Guido van Rossum
On Sun, Sep 14, 2008 at 12:47 PM, Fredrik Lundh [EMAIL PROTECTED] wrote: C. Titus Brown wrote: over on the pygr list, we were recently discussing a mildly confusing edit I made: assert 'seq1' in self.db, self.db.keys() This was interpreted by someone as being assert 'seq1' in

Re: [Python-Dev] ',' precedence in documentation

2008-09-14 Thread Benjamin Peterson
On Sun, Sep 14, 2008 at 3:00 PM, Guido van Rossum [EMAIL PROTECTED] wrote: I think in general Python has erred on the side of having too many different syntactical uses for commas. We killed a few in 3.0 with the introduction of except E as v and the demotion of print to a function call.