[Python-ideas] File format for automatic and manual tests

2018-08-07 Thread Victor Porton
This is an idea of a new PEP. I propose to create a portable file format which will list command line options to run Python scripts with dual purpose: 1. for automatic tests executing scripts from this file (and optionally checking their stdout against specified values). 2. for running the

Re: [Python-ideas] File format for automatic and manual tests

2018-08-07 Thread Steven D'Aprano
On Wed, Aug 08, 2018 at 12:57:51AM +0300, Victor Porton wrote: > This is an idea of a new PEP. > > I propose to create a portable file format which will list command line > options to run Python scripts with dual purpose: Feel free to create whatever file format you like. There are tens of thou

Re: [Python-ideas] File format for automatic and manual tests

2018-08-07 Thread Victor Porton
On 08/08/18 02:18, Steven D'Aprano wrote: On Wed, Aug 08, 2018 at 12:57:51AM +0300, Victor Porton wrote: This is an idea of a new PEP. I propose to create a portable file format which will list command line options to run Python scripts with dual purpose: Feel free to create whatever file form

Re: [Python-ideas] File format for automatic and manual tests

2018-08-07 Thread Abdur-Rahmaan Janhangeer
a suggest : don't make it obligatory i think it might come as suggested settings as settings on different environments different. or we can specify only in modules like in setup.py the name of the file, then each user configures it's own (considering pip we can make use it false by default) in t

[Python-ideas] Make "yield" inside a with statement a SyntaxError

2018-08-07 Thread Ken Hilton
This mostly springs off of a comment I saw in some thread. The point of a with statement is that it ensures that some resource will be disposed of, yes? For example, this: with open(filename) as f: contents = f.read() is better than this: contents = open(filename).read() becaus

Re: [Python-ideas] Make "yield" inside a with statement a SyntaxError

2018-08-07 Thread Abdur-Rahmaan Janhangeer
i think a SyntaxError won't be appropriate as it is valid syntax as the lexer finds nothing wrong it falls more i think like out of index errors and the like, a ContextManagerError ? else, a request to add headings like EXAMPLES = in your discussion yours, -- Abdur-Rahmaan Janhangeer

Re: [Python-ideas] Make "yield" inside a with statement a SyntaxError

2018-08-07 Thread Elazar
On Tue, Aug 7, 2018 at 11:16 PM Ken Hilton wrote: > ... > Now, let's take a look at the following scenario: > > def read_multiple(*filenames): > for filename in filenames: > with open(filename) as f: > yield f.read() > > Can you spot the problem? The "with

Re: [Python-ideas] Make "yield" inside a with statement a SyntaxError

2018-08-07 Thread Chris Angelico
On Wed, Aug 8, 2018 at 4:14 PM, Ken Hilton wrote: > This mostly springs off of a comment I saw in some thread. > > The point of a with statement is that it ensures that some resource will be > disposed of, yes? For example, this: > > with open(filename) as f: > contents = f.read() > >

Re: [Python-ideas] Make "yield" inside a with statement a SyntaxError

2018-08-07 Thread Jacco van Dorp
I don't think this is a major problem. In this case, the file will be closed when the generator is garbage collected. So you'd also have to leak the generator to actually get this problem. And if leaking generators won't harm your application, neither will leaking the occasional file handle. Also,