Re: [Python-ideas] With expressions

2018-08-02 Thread Thomas Nyberg via Python-ideas
On 08/02/2018 12:43 PM, Paul Moore wrote: But if someone wanted to raise a doc bug suggesting that we mention this, I'm not going to bother objecting... Paul I opened a bug here: https://bugs.python.org/issue34319 We can see what others think. Cheers, Thomas

Re: [Python-ideas] With expressions

2018-08-02 Thread Thomas Nyberg via Python-ideas
On 08/02/2018 12:43 PM, Paul Moore wrote: I'm not sure I see why you think it wouldn't - opening and closing the file is a purely internal detail of the function. In any case, you don't get given a file object, so how could anything *other* than the read_text() close the file? So you're basically

Re: [Python-ideas] With expressions

2018-08-02 Thread Thomas Nyberg via Python-ideas
Is it true that Path('file').read_text() closes the file after the read? I think that is the sort of functionality that Ken is asking for. It's not clear to me by your linked documentation that it does. If it does, maybe that should be made more clear in that linked documentation? (Of course, ma

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

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] Allow function to return multiple values

2017-06-01 Thread Thomas Nyberg
On 06/01/2017 07:17 AM, joannah nanjekye wrote: > a function that returns two values something like this: > > def return_multiplevalues(num1, num2): > return num1, num2 > > I noticed that this actually returns a tuple of the values which I did > not want in the first place.I wanted python t

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

2017-06-01 Thread Thomas Nyberg
On 05/31/2017 11:47 PM, Serhiy Storchaka wrote: > What you are think about adding Unicode aliases for some mathematic > names in the math module? ;-) I personally don't like there being multiple symbols with the same meaning and I never find myself confused by the longer names versus the sorter sy

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 to

Re: [Python-ideas] Reverse assignment operators (=+, =-, =*, =/, =//, =**, =%)

2016-11-14 Thread Thomas Nyberg
On 11/14/2016 03:42 PM, Mikhail V wrote: On 14 November 2016 at 19:57, Nick Timkovich wrote: I can understand you good. But imagine, if Numpy would allow you to simply write: A = A + 1 Which would bring you directly to same internal procedure as A += 1. So it does not currently, why? I've teste

Re: [Python-ideas] Py_SIZE of PyLongs

2016-10-19 Thread Thomas Nyberg
On 10/19/2016 09:04 PM, Elliot Gorokhovsky wrote: A quick note: I'm working on a special-case compare function for bounded integers for the sort stuff. By looking at the implementation, I figured out that Py_SIZE of a long is the sign times the number of digits (...right?). Before looking at the

Re: [Python-ideas] Python multi-dimensional array constructor

2016-10-19 Thread Thomas Nyberg
Personally I like the way that numpy does it now better (even for multidimensional arrays). Being able to index into the different sub dimension using just [] iteratively matches naturally with the data structure itself in my mind. This may also just be my fear of change though... Here is an

Re: [Python-ideas] Proposal for default character representation

2016-10-13 Thread Thomas Nyberg
On 10/12/2016 07:13 PM, Mikhail V wrote: On 12 October 2016 at 23:50, Thomas Nyberg wrote: Since when was decimal notation "standard"? Depends on what planet do you live. I live on planet Earth. And you? If you mean that decimal notation is the standard used for _counting_ by pe

Re: [Python-ideas] Proposal for default character representation

2016-10-12 Thread Thomas Nyberg
On 10/12/2016 05:33 PM, Mikhail V wrote: Hello all, Hello! New to this list so not sure if I can reply here... :) Now printing it we get: u'\u0430\u0431\u0432.txt' By "printing it", do you mean "this is the string representation"? I would presume printing it would show characters nicel