Re: [Python-ideas] [Python-Dev] Language proposal: variable assignment in functional context

2017-06-16 Thread Steven D'Aprano
Welcome Robert. My response below. Follow-ups to Python-Ideas, thanks. You'll need to subscribe to see any further discussion. On Fri, Jun 16, 2017 at 11:32:19AM +, Robert Vanden Eynde wrote: > In a nutshell, I would like to be able to write: > y = (b+2 for b = a + 1) I think this is

Re: [Python-ideas] [Python-Dev] Language proposal: variable assignment in functional context

2017-06-16 Thread Erik
[cross-posted to python-ideas] Hi Robert, On 16/06/17 12:32, Robert Vanden Eynde wrote: Hello, I would like to propose an idea for the language but I don't know where I can talk about it. Can you please explain what the problem is that you are trying to solve? In a nutshell, I would like

Re: [Python-ideas] Define __fspath__() for NamedTemporaryFile and TemporaryDirectory

2017-06-16 Thread Ethan Furman
On 06/16/2017 01:37 PM, Alexandre Brault wrote: So a if used directly, and a if used as a context manager. I don't have a copy of 3.6 nor the future 3.7 handy, so maybe it changed there? The code in master has the context manager return `self.name`. This behaviour has (based on looking at

Re: [Python-ideas] Define __fspath__() for NamedTemporaryFile and TemporaryDirectory

2017-06-16 Thread Thomas Jollans
On 08/06/17 15:42, Antoine Pietri wrote: > Hello everyone! > > A very common pattern when dealing with temporary files is code like this: > > with tempfile.TemporaryDirectory() as tmpdir: > tmp_path = tmpdir.name > > os.chmod(tmp_path) > os.foobar(tmp_path) >

Re: [Python-ideas] Restore the __members__ behavior to python3 for C extension writers

2017-06-16 Thread Nick Coghlan
On 16 June 2017 at 07:44, Barry Scott wrote: > But I need the result of __dir__ for my object not its base. Then I need to > add in the list of member attributes that are missing because python > itself has no knowledge of them they are accessed via getattr(). The C code: