Re: [Python-ideas] (no subject)

2017-12-04 Thread Antoine Pitrou
On Tue, 5 Dec 2017 02:52:44 +1100 Steven D'Aprano wrote: > On Mon, Dec 04, 2017 at 01:52:19PM +0100, Antoine Pitrou wrote: > > On Mon, 4 Dec 2017 23:16:11 +1100 > > Steven D'Aprano wrote: > > > On Mon, Dec 04, 2017 at 12:06:38PM +0100, Antoine Pitrou

[Python-ideas] (no subject)

2017-03-26 Thread Gerald Britton
>* On 25 Mar 2017, at 15:51, Gerald Britton > wrote: > *> >* On 25 March 2017 at 11:24, Pavel Velikhov >> wrote: > *>* > No, the current solution is temporary because we just don’t have

Re: [Python-ideas] (no subject)

2016-12-25 Thread Chris Angelico
On Mon, Dec 26, 2016 at 8:51 AM, Victor Stinner wrote: > Le 24 déc. 2016 8:42 PM, "Neil Girdhar" a écrit : >> Usually, when an exception is hit that will (probably) crash the program, >> no one cares about less than a microsecond of performance. >

Re: [Python-ideas] (no subject)

2016-12-25 Thread Victor Stinner
Le 24 déc. 2016 8:42 PM, "Neil Girdhar" a écrit : > Usually, when an exception is hit that will (probably) crash the program, no one cares about less than a microsecond of performance. Just one example. By design, hasattr(obj, name) raises an exception to return False. So

Re: [Python-ideas] (no subject)

2016-12-24 Thread Thomas Nyberg
On 12/24/2016 11:42 AM, Neil Girdhar wrote: Usually, when an exception is hit that will (probably) crash the program, no one cares about less than a microsecond of performance. I would probably agree with you in the SyntaxError example, but not for the others. Programming with exceptions is

Re: [Python-ideas] (no subject)

2016-12-24 Thread Neil Girdhar
On Tuesday, November 29, 2016 at 4:08:19 AM UTC-5, Victor Stinner wrote: > > Hi, > > Python is optimized for performance. Formatting an error message has a > cost on performances. > > Usually, when an exception is hit that will (probably) crash the program, no one cares about less than a

Re: [Python-ideas] (no subject)

2016-11-30 Thread Rob Cliffe
On 29/11/2016 20:09, Terry Reedy wrote: On 11/29/2016 11:32 AM, Rob Cliffe wrote: On 29/11/2016 04:58, victor rajewski wrote: Traceback (most recent call last): File "foo.py", line 2, in l[10]=14 IndexError: list assignment index out of range A better message might be: You

Re: [Python-ideas] (no subject)

2016-11-29 Thread Stephen J. Turnbull
Victor Stinner writes: > Using a custom exception handler, you can run expensive functions, > like the feature: "suggest len when length is used". LGTM. > The problem is then when students have to use a Python without the > custom exception handler. Put the exception handler in an

Re: [Python-ideas] (no subject)

2016-11-29 Thread MRAB
On 2016-11-29 19:45, Brendan Barnwell wrote: On 2016-11-29 09:43, Brett Cannon wrote: One way to make this cheap is to have a reasonable default message and use attributes on the exceptions trigger the use of the default message. Nearly a year ago I filed a bunch of issues for ideas on

Re: [Python-ideas] (no subject)

2016-11-29 Thread Nathaniel Smith
On Nov 29, 2016 9:43 AM, "Brett Cannon" wrote: > > > > On Tue, 29 Nov 2016 at 02:39 Nathaniel Smith wrote: >> >> On Tue, Nov 29, 2016 at 1:05 AM, Victor Stinner >> wrote: >> > Hi, >> > >> > Python is optimized for performance.

Re: [Python-ideas] (no subject)

2016-11-29 Thread Terry Reedy
On 11/29/2016 11:32 AM, Rob Cliffe wrote: On 29/11/2016 04:58, victor rajewski wrote: Traceback (most recent call last): File "foo.py", line 2, in l[10]=14 IndexError: list assignment index out of range A better message might be: You tried to use l[10] when l is only 4 elements

Re: [Python-ideas] (no subject)

2016-11-29 Thread Brendan Barnwell
On 2016-11-29 09:43, Brett Cannon wrote: One way to make this cheap is to have a reasonable default message and use attributes on the exceptions trigger the use of the default message. Nearly a year ago I filed a bunch of issues for ideas on providing attributes on exceptions where it made

Re: [Python-ideas] (no subject)

2016-11-29 Thread Brett Cannon
On Tue, 29 Nov 2016 at 10:28 Nick Timkovich wrote: > I would consider the speed of the "ultimate error handler" (i.e. whatever > prints the traceback and kills the program) in the interpreter to be moot, > so long as it takes a small fraction of a second. Optimizing

Re: [Python-ideas] (no subject)

2016-11-29 Thread Nick Timkovich
I would consider the speed of the "ultimate error handler" (i.e. whatever prints the traceback and kills the program) in the interpreter to be moot, so long as it takes a small fraction of a second. Optimizing Python's speed it crashes super-fast due to an *unhandled* NameError in your program

Re: [Python-ideas] (no subject)

2016-11-29 Thread Chris Barker
On Tue, Nov 29, 2016 at 5:48 AM, Nick Coghlan wrote: > > SyntaxErrors in an inner loop? That seems unlikely to me. > Syntax Errors are a special case, as by definition the code isn't being run yet (yes, there could be an eval in there...) So we could at least make those

Re: [Python-ideas] (no subject)

2016-11-29 Thread Brett Cannon
On Tue, 29 Nov 2016 at 02:39 Nathaniel Smith wrote: > On Tue, Nov 29, 2016 at 1:05 AM, Victor Stinner > wrote: > > Hi, > > > > Python is optimized for performance. Formatting an error message has a > > cost on performances. > > Sure, but we have to look

Re: [Python-ideas] (no subject)

2016-11-29 Thread Rob Cliffe
On 29/11/2016 04:58, victor rajewski wrote: Traceback (most recent call last): File "foo.py", line 2, in l[10]=14 IndexError: list assignment index out of range A better message might be: You tried to use l[10] when l is only 4 elements long. You can add items to l using

Re: [Python-ideas] (no subject)

2016-11-29 Thread Nick Coghlan
On 29 November 2016 at 20:38, Nathaniel Smith wrote: > On Tue, Nov 29, 2016 at 1:05 AM, Victor Stinner > wrote: >> Hi, >> >> Python is optimized for performance. Formatting an error message has a >> cost on performances. > > Sure, but we have to look at

Re: [Python-ideas] (no subject)

2016-11-29 Thread Wes Turner
On Tuesday, November 29, 2016, Wes Turner wrote: > The existing docs for errors and exceptions: > > - https://docs.python.org/2/library/exceptions.html > - https://docs.python.org/3/library/exceptions.html > -

Re: [Python-ideas] (no subject)

2016-11-29 Thread Wes Turner
On Tuesday, November 29, 2016, Nathaniel Smith wrote: > On Tue, Nov 29, 2016 at 1:05 AM, Victor Stinner > > wrote: > > Hi, > > > > Python is optimized for performance. Formatting an error message has a > > cost on performances. > > Sure,

Re: [Python-ideas] (no subject)

2016-11-29 Thread Wes Turner
The existing docs for errors and exceptions: - https://docs.python.org/2/library/exceptions.html - https://docs.python.org/3/library/exceptions.html - https://hg.python.org/cpython/file/tip/Doc/library/exceptions.rst - https://github.com/python/cpython/blob/master/Doc/library/exceptions.rst -

Re: [Python-ideas] (no subject)

2016-11-29 Thread Victor Stinner
Hi, Python is optimized for performance. Formatting an error message has a cost on performances. I suggest you to teach your student to use the REPL and use a custom exception handler: sys.excepthook: https://docs.python.org/2/library/sys.html#sys.excepthook Using a custom exception handler,

Re: [Python-ideas] (no subject)

2016-11-28 Thread Mariatta Wijaya
I'm +1 to the idea of improving error messages :) (but maybe not to the exact new error messages proposed) Raymond Hettinger touched on this topic during his Pycon Canada keynote, as one of the positive contributions that you can do to cpython. > > Traceback (most recent call last): > > File

Re: [Python-ideas] (no subject)

2016-11-28 Thread victor rajewski
Sorry, I forgot the subject line! On Tue., 29 Nov. 2016, 3:58 pm victor rajewski, wrote: > I teach a computing subject to high school students using Python as our > primary language. One thing that often causes confusion at the start is > error messages/exceptions. I think

Re: [Python-ideas] (no subject)

2016-11-28 Thread Bernardo Sulzbach
On 2016-11-29 02:58, victor rajewski wrote: NameError: name 'reponse' is not defined A better message might be: You're trying to use the value of 'reponse', but that variable hasn't got a value yet. You can give it a value earlier in the code, or it could be a typo. You have a variable called

[Python-ideas] (no subject)

2016-11-28 Thread victor rajewski
I teach a computing subject to high school students using Python as our primary language. One thing that often causes confusion at the start is error messages/exceptions. I think it would lower entry point quite a bit by making error messages more readable to novices. Recent research found reduced