[Python-Dev] Add mimetypes.mimesniff

2020-07-22 Thread Dong-hee Na
Hi, A few weeks ago, I suggested adding mimetypes.mimesniff on stdlib. (https://bugs.python.org/issue40841, https://github.com/python/cpython/pull/20720) Detecting MIME types well is an important feature and we already have mimetypes detection library but AFAIK it is not good enough. Note that s

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Guido van Rossum
But on which line is the RETURN opcode if there is more than a docstring? Doesn’t it make sense to have it attached to the last line of the body? (Too bad about pytype, that kind of change happens — we had this kind of thing for mypy too, when line numbers in the AST were fixed.) On Wed, Jul 22, 2

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Gregory P. Smith
On Wed, Jul 22, 2020 at 5:19 AM Mark Shannon wrote: > > > On 21/07/2020 9:46 pm, Gregory P. Smith wrote: > > > > > > On Fri, Jul 17, 2020 at 8:41 AM Ned Batchelder > > wrote: > > > > https://www.python.org/dev/peps/pep-0626/ :) > > > > --Ned. > > > > On

[Python-Dev] Re: How to customize CPython to a minimal set

2020-07-22 Thread Simon Cross
I don't know if they suit your purposes, but both sqlite3 and a small array implementation are already available: https://github.com/micropython/micropython-lib/tree/master/sqlite3 https://github.com/v923z/micropython-ulab ___ Python-Dev mailing list --

[Python-Dev] Re: How to customize CPython to a minimal set

2020-07-22 Thread Steve Holden
Sadly micropython is not intended to support numerical libraries and other such complex modules: the support for the Python standard library is pretty much non-existent. Kind regards, Steve On Wed, Jul 22, 2020 at 3:10 PM Huang, Yang wrote: > Thank you for all your comments. > > I cannot agree

[Python-Dev] Re: How to customize CPython to a minimal set

2020-07-22 Thread Huang, Yang
Thank you for all your comments. I cannot agree any more. I did try but there were so many dependencies. One change all change. Micropython is a choice. But not sure if numpy and sqlite3 can be supported well. And what’s the compatibility of the libs in Pypi. From: Guido van Rossum Sent: Tues

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Inada Naoki
On Wed, Jul 22, 2020 at 10:53 PM Antoine Pitrou wrote: > > > Le 22/07/2020 à 15:48, Inada Naoki a écrit : > > On Wed, Jul 22, 2020 at 8:51 PM Antoine Pitrou wrote: > >> > >>> > >>> I don't think all attempts are failed. Note that current CPython includes > >>> some optimization already. > >> > >

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Antoine Pitrou
Le 22/07/2020 à 15:48, Inada Naoki a écrit : > On Wed, Jul 22, 2020 at 8:51 PM Antoine Pitrou wrote: >> >>> >>> I don't think all attempts are failed. Note that current CPython includes >>> some optimization already. >> >> The set of compile-time optimizations has almost not changed since at >>

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Inada Naoki
On Wed, Jul 22, 2020 at 8:51 PM Antoine Pitrou wrote: > > > > > I don't think all attempts are failed. Note that current CPython includes > > some optimization already. > > The set of compile-time optimizations has almost not changed since at > least 15 years ago. > Constant folding is rewritten

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Mark Shannon
On 22/07/2020 12:23 pm, Ned Batchelder wrote: On 7/17/20 10:48 AM, Mark Shannon wrote: Hi all, I'd like to announce a new PEP. It is mainly codifying that Python should do what you probably already thought it did :) Should be uncontroversial, but all comments are welcome. Thanks for thi

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Mark Shannon
On 21/07/2020 9:46 pm, Gregory P. Smith wrote: On Fri, Jul 17, 2020 at 8:41 AM Ned Batchelder > wrote: https://www.python.org/dev/peps/pep-0626/ :) --Ned. On 7/17/20 10:48 AM, Mark Shannon wrote: > Hi all, > > I'd like to announce

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Antoine Pitrou
On Wed, 22 Jul 2020 19:42:30 +0900 Inada Naoki wrote: > On Wed, Jul 22, 2020 at 6:12 PM Antoine Pitrou wrote: > > > > > > > > But if we merge two equal code blocks, we can not produce precise line > > > numbers, can we? > > > Is this inconsistent microoptimization that real optimization harder?

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Mark Shannon
On 22/07/2020 11:42 am, Inada Naoki wrote: On Wed, Jul 22, 2020 at 6:12 PM Antoine Pitrou > wrote: > > > > > But if we merge two equal code blocks, we can not produce precise line > > numbers, can we? > > Is this inconsistent microoptimization that real optimiza

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Ned Batchelder
On 7/17/20 10:48 AM, Mark Shannon wrote: Hi all, I'd like to announce a new PEP. It is mainly codifying that Python should do what you probably already thought it did :) Should be uncontroversial, but all comments are welcome. Thanks for thinking about these aspects of the interpreter, and

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Mark Shannon
On 22/07/2020 10:07 am, Antoine Pitrou wrote: On Wed, 22 Jul 2020 12:46:40 +0900 Inada Naoki wrote: On Wed, Jul 22, 2020 at 3:43 AM Mark Shannon wrote: On 18/07/2020 9:20 am, Inada Naoki wrote: It seems great improvement, but I am worrying about performance. Adding more attributes to th

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Ned Batchelder
On 7/22/20 6:42 AM, Inada Naoki wrote: On Wed, Jul 22, 2020 at 6:12 PM Antoine Pitrou > wrote: > > > > > But if we merge two equal code blocks, we can not produce precise line > > numbers, can we? > > Is this inconsistent microoptimization that real optimization harder

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Ned Batchelder
On 7/21/20 5:04 PM, Gregory P. Smith wrote: Given it is impossible for tools doing passive inspection of Python VM instances to execute code, co_linetable's exact format will be depended on just as co_lnotab was.  co_lnotab was only quasi-"officially" documented in the Python docs, it's spec li

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Inada Naoki
On Wed, Jul 22, 2020 at 6:12 PM Antoine Pitrou wrote: > > > > > But if we merge two equal code blocks, we can not produce precise line > > numbers, can we? > > Is this inconsistent microoptimization that real optimization harder? > > This optimization must be prohibited in future Python? > > All a

[Python-Dev] Re: PEP 626: Precise line numbers for debugging and other tools.

2020-07-22 Thread Antoine Pitrou
On Wed, 22 Jul 2020 12:46:40 +0900 Inada Naoki wrote: > On Wed, Jul 22, 2020 at 3:43 AM Mark Shannon wrote: > > > > On 18/07/2020 9:20 am, Inada Naoki wrote: > > > It seems great improvement, but I am worrying about performance. > > > > > > Adding more attributes to the code object will increas