[Python-ideas] Improved exception messages

2017-06-06 Thread Chris Angelico
A question came up on python-list regarding the message given when you call float(""). It's somewhat unclear due to the way humans tend to ignore a lack of content: >>> float("spam") Traceback (most recent call last): File "", line 1, in ValueError: could not convert string to float: 'spam' >>>

Re: [Python-ideas] Improved exception messages

2017-06-06 Thread Thomas Nyberg
On 06/06/2017 12:51 PM, Chris Angelico wrote: > Firstly, is there a reason for the empty string to not be surrounded > with quotes? The source code, AIUI, is this: > > x = PyOS_string_to_double(s, (char **)&end, NULL); > if (end != last) { > PyErr_Format(PyExc_ValueError, >

Re: [Python-ideas] Improved exception messages

2017-06-06 Thread Thomas Nyberg
I think this diff is probably the correct solution. Basically it just checks if there's anything left after spaces are stripped and then throws an error if not: (By the way sorry for not being clearer in my other message. This diff is against the current 3.7 master branch. I didn't look at the ori

[Python-ideas] π = math.pi

2017-06-06 Thread Mikhail V
Greg Ewing wrote: >Steven D'Aprano wrote: >> There's not much, if any, benefit to writing: >> >> ∫(expression, lower_limit, upper_limit, name) >More generally, there's a kind of culture clash between mathematical >notation and programming notation. Mathematical notation tends to >almost exclu

Re: [Python-ideas] π = math.pi

2017-06-06 Thread Greg Ewing
Mikhail V wrote: I find actually symbols ≤ ≥ (inclusive comparison) nice. Yes, there are a few symbols it would be nice to have. A proper ≠ symbol would have avoided the wars between <> and !=. :-) -- Greg ___ Python-ideas mailing list Python-ideas@p

Re: [Python-ideas] π = math.pi

2017-06-06 Thread Serhiy Storchaka
07.06.17 08:34, Greg Ewing пише: Mikhail V wrote: I find actually symbols ≤ ≥ (inclusive comparison) nice. Yes, there are a few symbols it would be nice to have. A proper ≠ symbol would have avoided the wars between <> and !=. :-) But this would start the war between ≤ and ⩽ (symbols used by

Re: [Python-ideas] π = math.pi

2017-06-06 Thread Brice PARENT
Le 07/06/17 à 07:34, Greg Ewing a écrit : Yes, there are a few symbols it would be nice to have. A proper ≠ symbol would have avoided the wars between <> and !=. :-) I'm not sure it's worth any change in the language, it's already really easy to read and write as is. But I agree this can b