Thanks Richard,

You are right.

So, my doubt about the fact that it must be changed or not is meaningful,
and argparse should not be changed.

I'll keep using the « overriding » class,  and plane to make a pip package
for that.

Thanks to everybody for those discussions.

Le sam. 24 août 2019 09:53, Richard Musil <[email protected]> a écrit :

> On Sat, Aug 24, 2019 at 9:25 AM Michael Hooreman <[email protected]>
> wrote:
>
>> Running __main.py__ as a script works *only* if we use absolute imports.
>> And I consider that using absolute imports in a package to itself is a very
>> bad practice. So, __main.py__ is not an executable.
>>
>
> I probably should clarify my original statement. I did not mean that
> `__main__.py` in a package should be directly executable. What I meant was
> that someone can write a standalone script and being completely oblivious
> of its special meaning of the name in the package hierarchy choose to name
> it `__main__.py`. In this particular case it would be correct to expect
> that ArgumentParser shows the name of the scripts as `__main__.py`.
>
> It is not really a use case and I only gave it as an example that from the
> ArgumentParser's perspective no special treatment can be derived based on
> the name alone. Adding more complex logic to ArgumentParser to figure out
> if it runs "inside the package" seems like an overkill, if it could be
> resolved in the client code which already has most of the knowledge (that
> it runs in `__main__.py` and in particular in `__main__.py` which has a
> special role in the package).
>
> Richard
>
>>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/KP5EZYSSNBRHVOMJUIATA2THWV6EFC6J/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to