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

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,

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

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

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] 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

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

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 <tomuxi...@gmail.com> 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 t

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