[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-23 Thread Richard Musil
I have originally planned to post the proposal on bpo, but things turned out unexpectedly (for me), so I am returning here. I wrote the patch (for the Python part). If anyone is interested it is here: https://github.com/python/cpython/compare/master...risa2000:json_patch The patch follows the ori

[Python-ideas] Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Michael Hooreman
Hello, I have a proposal to improve support of __main__.py (python -m foobar) invocation to argparse.ArgumentParser You can find attached a PEP draft. Unfortunately, I'm not very confident on how to add that PEP and ... honnestly not very used to github. In short, can you help me and advise on

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-23 Thread Andrew Barnert via Python-ideas
On Aug 23, 2019, at 00:33, Richard Musil wrote: > > Why simplejson remained separated from the main CPython is also a question (I > guess there was/is a reason), because it seems like including the code > completely and maintain it inside CPython could be better use of the > resources. The RE

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Andrew Barnert via Python-ideas
There’s no need for this to be a PEP at this point. You only write those after discussion on -ideas, once you have the ideas nailed down, answers to all of the objections, all of the bikeshedding issues out in the open, and consensus that the idea is ready for a final decision. I’m not even sur

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Andrew Barnert via Python-ideas
One more thing: from reading your proposal, it sounds like your actual issue may be that you’ve got something you want to distribute to end-users who aren’t Python experts to run as `python -m spam`, and the usage messages they get back are confusing them? If so, why not just use a setuptools e

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-23 Thread Christopher Barker
Andrew, thanks for the background. On Fri, Aug 23, 2019 at 8:25 AM Andrew Barnert via Python-ideas < [email protected]> wrote: > Also, IIRC, it doesn’t do any post-check; it assumes calling str on any > Decimal value (after an isfinite check if not allow_nan) produces valid > JSON. I think

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-23 Thread Andrew Barnert via Python-ideas
On Aug 23, 2019, at 09:45, Christopher Barker wrote: > > Andrew, thanks for the background. > >> On Fri, Aug 23, 2019 at 8:25 AM Andrew Barnert via Python-ideas >> wrote: > >> Also, IIRC, it doesn’t do any post-check; it assumes calling str on any >> Decimal value (after an isfinite check if

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Michael Hooreman
Thanks a lot for your comments Andrew, I'm replying to your two emails using this, just to avoid confusions. On the need of a PEP or a bug fix, well, I'm learning ;-) As I'm a good student, I've written a draft PEP... My idea was more a proposal to be discussed because wanting python -m foobar i

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Richard Musil
Hello Michaël, in your PEP your wrote: --- The standard library's ``argparse.ArgumentParser`` uses by default ``sys.argv[0]`` for his ``prog`` property. It means that when using the ``python -m foobar`` invocation, which calls under the hood the ``foobar.__main__`` module, the ``prog`` will be ``

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Richard Musil
On Fri, Aug 23, 2019 at 11:54 PM Michael Hooreman wrote: > The issue is with package foobar containing __main__.py file (not with a > module called as a script, which is your case), and called via python -m > foobar > > See the last paragraph of https://docs.python.org/3/library/__main__.html > :

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Michael Hooreman
Hi Richard, The issue is with package foobar containing __main__.py file (not with a module called as a script, which is your case), and called via python -m foobar See the last paragraph of https://docs.python.org/3/library/__main__.html : « For a package, the same effect can be achieved by inc