Re: [Python-ideas] cli tool to print value, similar to pydoc

2019-04-07 Thread Steven D'Aprano
On Sun, Apr 07, 2019 at 01:42:46PM +0200, Thomas Gläßle wrote: > It would be nice to just type, e.g. any of: > >     pyval os.pathsep How will it know what object os is, without guessing, if you haven't imported it? > There is already a tool like this on PyPI [1] (sadly py2 only atm), but >

Re: [Python-ideas] Sorted lists

2019-04-07 Thread Terry Reedy
On 4/7/2019 10:32 PM, Steven D'Aprano wrote: There are quite a few important algorithms which require lists to be sorted. For example, the bisect module, and for statistics median and other quantiles. Sorting a list is potentially expensive: while Timsort is very efficient, it is still

Re: [Python-ideas] Sorted lists

2019-04-07 Thread Nathaniel Smith
On Sun, Apr 7, 2019 at 7:37 PM Steven D'Aprano wrote: > There are quite a few important algorithms which require lists to be > sorted. For example, the bisect module, and for statistics median and > other quantiles. But this flag doesn't affect those modules, right? 'bisect' already requires the

Re: [Python-ideas] Sorted lists

2019-04-07 Thread Cameron Simpson
On 08Apr2019 12:32, Steven D'Aprano wrote: There are quite a few important algorithms which require lists to be sorted. For example, the bisect module, and for statistics median and other quantiles. Sorting a list is potentially expensive: while Timsort is very efficient, it is still

Re: [Python-ideas] Built-in parsing library

2019-04-07 Thread Nam Nguyen
On Mon, Apr 1, 2019 at 3:13 PM Terry Reedy wrote: > On 4/1/2019 1:14 AM, Guido van Rossum wrote: > > We do have a parser generator in the standard library: > > https://github.com/python/cpython/tree/master/Lib/lib2to3/pgen2 > > It is effectively undocumented and by inference discouraged from

Re: [Python-ideas] Sorted lists

2019-04-07 Thread Cameron Simpson
On 08Apr2019 00:17, Terry Reedy wrote: On 4/7/2019 10:32 PM, Steven D'Aprano wrote: There are quite a few important algorithms which require lists to be sorted. [...] Proposal: let's give lists a dunder flag, __issorted__, that tracks whether the list is definitely sorted or not: [...]

[Python-ideas] cli tool to print value, similar to pydoc

2019-04-07 Thread Thomas Gläßle
Hi, what do you think about adding a tool to print a specified object, similar to pydoc shows its help? I regularly find myself checking the contents of variables to get a quick grasp on what the value looks like during development, and then type something like this:     python -c 'import os;