[Python-ideas] Re: built in to clear terminal

2020-12-22 Thread Barry Scott
The simplest answer is print('`\x1b[2J\x1b[H') Are there any terminals that this does not work on that are in active use? Is using curses that uses termcap needed these days? Of course Windows is the outlier, but the new Windows Terminal supports ANSI escapes sequences and utf-8. I tes

[Python-ideas] Re: built in to clear terminal

2020-12-22 Thread Barry Scott
> On 22 Dec 2020, at 09:49, Barry Scott wrote: > > The simplest answer is > > print('`\x1b[2J\x1b[H') > > Are there any terminals that this does not work on that are in active use? > > Is using curses that uses termcap needed these days? > >

[Python-ideas] Re: built in to clear terminal

2020-12-24 Thread Barry Scott
> On 22 Dec 2020, at 12:39, Eryk Sun wrote: > > On 12/22/20, Barry Scott wrote: >> >> import sys >> >> def clear_terminal(): >>if sys.platform == 'win32': >>import ctypes >>kernel32 = ctypes.windll.

[Python-ideas] Re: fsync-on-close io object

2020-12-26 Thread Barry Scott
> On 24 Dec 2020, at 17:15, Michael A. Smith wrote: > > With all the buffering that modern disks and filesystems do, a > specific question has come up a few times with respect to whether or > not data was actually written after flush. I think it would be pretty > useful for the standard librar

[Python-ideas] Re: Off-topic: What costs NaN pounds for a null amount?

2021-01-14 Thread Barry Scott
> On 14 Jan 2021, at 17:14, Jonathan Fine wrote: > > Hi > > There's interest here in arithmetic operations on NaN . I've just seen a > product listed as costing NaN pounds to buy a null amount. That was written > as £NaN/null. > > The bargain item is Glade Shake & Vacuum Citrus, and you can

[Python-ideas] Re: PEP Draft: Build Dependency Specification for Manylinux Wheels

2021-01-16 Thread Barry Scott
> On 4 Jan 2021, at 14:27, Chris Antonellis > wrote: > > `system_dependencies` > - > System dependencies to install with `yum` prior to building. > Entries are expected to be in `yum` `name-version` format. If dnf is avaiable I think it is better to use dnf over yum. So

[Python-ideas] Re: Adding `open_text()` builtin function. (relating to PEP 597)

2021-01-23 Thread Barry Scott
> On 23 Jan 2021, at 11:00, Steven D'Aprano wrote: > > On Sat, Jan 23, 2021 at 12:40:55AM -0500, Random832 wrote: >> On Fri, Jan 22, 2021, at 20:34, Inada Naoki wrote: >>> * Default encoding is "utf-8". >> >> it might be worthwhile to be a little more sophisticated than this. >> >> Notepad i

[Python-ideas] Re: Make UTF-8 mode more accessible for Windows users.

2021-02-01 Thread Barry Scott
> On 30 Jan 2021, at 12:05, Inada Naoki wrote: > >> Where would Python look for a "configuration file like `pyvenv.cfg`" ? > > I am not a Windows expert so I am not sure. But I think it should be > the same directory where `python.exe` is in. You can put the system default there but each use

[Python-ideas] Re: Make UTF-8 mode more accessible for Windows users.

2021-02-02 Thread Barry Scott
> On 2 Feb 2021, at 00:22, Inada Naoki wrote: > > On Tue, Feb 2, 2021 at 6:31 AM Barry Scott <mailto:[email protected]>> wrote: >> >>> On 30 Jan 2021, at 12:05, Inada Naoki wrote: >>> >>> Where would Python look for a "con

[Python-ideas] Re: Make UTF-8 mode more accessible for Windows users.

2021-02-02 Thread Barry Scott
> On 2 Feb 2021, at 19:45, Christopher Barker wrote: > > On Tue, Feb 2, 2021 at 11:12 AM Barry Scott <mailto:[email protected]>> wrote: >>>> Where would Python look for a "configuration file like `pyvenv.cfg`" ? >>>> >>>> I

[Python-ideas] Re: Make UTF-8 mode more accessible for Windows users.

2021-02-04 Thread Barry Scott
> On 3 Feb 2021, at 02:49, Christopher Barker wrote: > > Aside: HTML 5 even has a encoding rule that acknowledges that web pages marked > utf-8 are really windows USA code page and show how to fall back! > > But that doesn't depend ina. system setting does it? So I don't get your > point: Th

[Python-ideas] Re: Make UTF-8 mode more accessible for Windows users.

2021-02-04 Thread Barry Scott
> On 3 Feb 2021, at 02:49, Christopher Barker wrote: > Rather than reply point by point I will summarise my input. I think that utf-8 mode is a great idea. I think that an .INI file in the style that py.exe uses is better then env var. Env var on WIndows could be used but there can be sur

[Python-ideas] Re: Make UTF-8 mode more accessible for Windows users.

2021-02-05 Thread Barry Scott
> On 5 Feb 2021, at 03:11, Inada Naoki wrote: > > On Fri, Feb 5, 2021 at 6:17 AM Barry Scott wrote: >> >> Rather than reply point by point I will summarise my input. >> >> I think that utf-8 mode is a great idea. >> >> I think that an .INI file

[Python-ideas] Re: Make UTF-8 mode more accessible for Windows users.

2021-02-05 Thread Barry Scott
> On 5 Feb 2021, at 11:06, Inada Naoki wrote: > > On Fri, Feb 5, 2021 at 7:59 PM Barry Scott wrote: >> >> I'm under the impression that new users will not create a venv. >> Indeed I run a lot of python scripts outside of venv world. >> I only use ven

[Python-ideas] Re: Make UTF-8 mode more accessible for Windows users.

2021-02-05 Thread Barry Scott
> On 5 Feb 2021, at 11:49, Inada Naoki wrote: > > On Fri, Feb 5, 2021 at 8:15 PM Barry Scott wrote: >> >>> >>> The main limitation is that users can not write config file in install >>> location when Python is installed for system, not for u

[Python-ideas] Re: Inadequate error reporting during function call setup stage

2021-02-22 Thread Barry Scott
> On 22 Feb 2021, at 10:15, Paul Sokolovsky wrote: > > It looks like: > > Traceback (most recent call last): > File "pseudoc_tool.py", line 91, in > File ".../xforms.py", line 25, in print > TypeError: unexpected keyword argument 'noann' > > - that makes clear that it's "print" function of

[Python-ideas] Re: Deprecate/change the behaviour of ~bool

2021-02-24 Thread Barry Scott
> On 23 Feb 2021, at 22:10, Steven D'Aprano wrote: > > There are exactly 2**4 = 16 boolean operators of two variables. Python > only supports two: `and` and `or`. Plus a single unary operator `not` > (out of four possible unary operators). What makes xnor so special that > you want it to be

[Python-ideas] Re: Barrier Object in asyncio lib

2021-02-25 Thread Barry Scott
> On 25 Feb 2021, at 13:14, Yves Duprat wrote: > > Hi,the list, > > I'm wondering why Barrier object does not exist in the synchronization > primitives of the asyncio lib while it is present in threading and > multiprocessing libs ? > This may not be the right place to ask this question, bu

[Python-ideas] Re: Barrier Object in asyncio lib

2021-02-25 Thread Barry Scott
def add_one(self) -> None: > self._waiting += 1 > if self._waiting == self.parties: > self._event.set() > > async def wait(self, worker: "Worker") -> None: > """ > Wait until all we have at least `parties`

[Python-ideas] Re: Barrier Object in asyncio lib

2021-02-26 Thread Barry Scott
k on there are no locks at all. > (I guess we can probably go to bugs.python.org <http://bugs.python.org/> with > this proposal.) Having shown that a Barrier for async is a missing piece it would be good to get a thumbs up here. Barry > > Jonathan > > > > > >

[Python-ideas] Re: Integer concatenation to byte string

2021-03-02 Thread Barry Scott
> On 1 Mar 2021, at 18:01, [email protected] wrote: > > Currently, the only way to concatenate an integer to a bytes object is by > converting the integer to bytes with a function call before concatenating. > And there is no way to make a mutable bytes object without a function call. > > I

[Python-ideas] Re: Integer concatenation to byte string

2021-03-02 Thread Barry Scott
aster than building it in. This goes > for most languages, including C. All python byte code is interpreted by calling functions. They take time and resources. Barry > > > On Tue, Mar 2, 2021 at 3:29 AM Barry Scott <mailto:[email protected]>> wrote: > > >

[Python-ideas] Re: Integer concatenation to byte string

2021-03-03 Thread Barry Scott
> On 2 Mar 2021, at 23:49, Steven D'Aprano wrote: > > > [Barry] >> All python byte code is interpreted by calling functions. They take >> time and resources. > > That's not entirely correct. Literals such as text strings, ints and > floats get compiled directly into the byte-code. Now of c

[Python-ideas] Re: Improved multi-tasking performance through deterministic GIL hand-off

2021-05-10 Thread Barry Scott
> On 10 May 2021, at 15:30, Sophist wrote: > > I don't know how many people will remember some work that David Beazley did > about a decade ago on how the GIL impacts multithreading performance - > essentially he instrumented the Python interpreter to log how multiple > threads competed for

[Python-ideas] Re: Improved multi-tasking performance through deterministic GIL hand-off

2021-05-10 Thread Barry Scott
> On 10 May 2021, at 20:23, Barry Scott wrote: > > > >> On 10 May 2021, at 15:30, Sophist wrote: >> >> I don't know how many people will remember some work that David Beazley did >> about a decade ago on how the GIL impacts multithreading performa

[Python-ideas] Re: joining paths without worrying about a leading slash

2021-06-27 Thread Barry Scott
> On 27 Jun 2021, at 12:07, Zbigniew Jędrzejewski-Szmek > wrote: > > [this is a continuation of https://bugs.python.org/issue44452] > > pathlib.Path() has a concatenation operator "/" that allows the > right-hand-side argument to be an absolute path, which causes the > left-hand-side argument

[Python-ideas] Re: Pre PEP: Python Literals (was custom strings before)

2021-07-05 Thread Barry Scott
> On 5 Jul 2021, at 08:07, Thomas Güttler wrote: > > This means backticks, but without the dollar sign. In bash the backtick was so often a problem that $(cmd) was added. Having removes the grit-on-Tim's-screen backtick in python 3 I would not like to see it return with its issue of being co

[Python-ideas] Re: C API for converting Python integers to/from bytes sequences

2021-08-08 Thread Barry Scott
> On 7 Aug 2021, at 19:22, Serhiy Storchaka wrote: > > Python integers have arbitrary precision. For serialization and > interpolation with other programs and libraries we need to represent > them as fixed-width integers (little- and big-endian, signed and > unsigned). In Python, we can use st

[Python-ideas] Re: Better exception handling hygiene

2021-09-30 Thread Barry Scott
> On 30 Sep 2021, at 17:25, Soni L. wrote: > > Alright, some ppl asked us to rephrase this, so: > > The plan is to take the function syntax: > > def name(args): > > and add an optional "with" to it: > > def name(args) with exceptions: > > these then get added to the function, simil

[Python-ideas] Re: Syntax Sugar for __name__ == "__main__" boilerplate?

2021-10-02 Thread Barry Scott
> On 2 Oct 2021, at 18:17, Paul Bryan wrote: > > Thanks for finding that. > > While I don't feel strongly one way or the other, I do think the discussion > is worthwhile. > > As I understand, the arguments for: > - let's get rid of boilerplate, that many (esp. beginners) may not understand

[Python-ideas] Re: Allow regex group name redefinitions

2021-10-02 Thread Barry Scott
> On 2 Oct 2021, at 10:27, [email protected] wrote: > > Hello everybody, > > I've got a suggestion for the std. re module developers: to consider allowing > match group name redefinitions, especially in alternatives. > While you may not see the point at first glance, let me try to reason such

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-25 Thread Barry Scott
> On 24 Oct 2021, at 01:13, Chris Angelico wrote: > > Specification > = > > Function default arguments can be defined using the new ``=>`` notation:: > >def bisect_right(a, x, lo=0, hi=>len(a), *, key=None): >def connect(timeout=>default_timeout): >def add_item(item, t

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-25 Thread Barry Scott
> On 25 Oct 2021, at 08:08, Steven D'Aprano wrote: > > I would say that it makes most sense to assign early-bound defaults > first, then late-bound defaults, specifically so that late-bound > defaults can refer to early-bound ones: > >def func(x=0, @y=x+1) > > So step 3 above should bec

[Python-ideas] Re: easier writing to multiple streams

2021-11-28 Thread Barry Scott
> On 26 Nov 2021, at 16:00, [email protected] wrote: > > i wonder whether: > > from myutils import myprint as print > > or > > _print = print > print = myprint > > is really the pythonic way? The problem with this is that there are more ways to output then the print command. Only replac

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-01 Thread Barry Scott
> On 1 Dec 2021, at 06:16, Chris Angelico wrote: > > I've just updated PEP 671 https://www.python.org/dev/peps/pep-0671/ > with some additional information about the reference implementation, > and some clarifications elsewhere. > > *PEP 671: Syntax for late-bound function argument defaults* >

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-01 Thread Barry Scott
> On 1 Dec 2021, at 17:59, Chris Angelico wrote: > > On Thu, Dec 2, 2021 at 4:40 AM Barry Scott wrote: >> >> On 1 Dec 2021, at 06:16, Chris Angelico wrote: >> 3) If "yes" to question 1, would you use it for any/all of (a) mutable >> defaults, (b)

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-04 Thread Barry Scott
> On 4 Dec 2021, at 09:44, Steven D'Aprano wrote: > > On Sat, Dec 04, 2021 at 03:14:46PM +1100, Chris Angelico wrote: > >> Lots and lots and lots of potential problems. Consider: >> >> def f(): >>a = 1 >>def f(b, x=>a+b): >>def g(): return x, a, b >> >> Both a and b are clos

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-04 Thread Barry Scott
> On 1 Dec 2021, at 06:16, Chris Angelico wrote: > > I've just updated PEP 671 https://www.python.org/dev/peps/pep-0671/ > with some additional information about the reference implementation, > and some clarifications elsewhere. (I suspect that there was a reply that I should be replying to b

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Barry Scott
> On 4 Dec 2021, at 21:21, Chris Angelico wrote: > > On Sun, Dec 5, 2021 at 5:29 AM Barry Scott <mailto:[email protected]>> wrote: >> >> >> >>> On 1 Dec 2021, at 06:16, Chris Angelico wrote: >>> >>> I've just upd

[Python-ideas] Re: PEP 671 review of default arguments evaluation in other languages

2021-12-06 Thread Barry Scott
> On 6 Dec 2021, at 00:31, Finn Mason wrote: > > On Sun, Dec 5, 2021, 12:11 PM Brendan Barnwell > wrote: > On 2021-12-04 20:01, David Mertz, Ph.D. wrote: > > > > There are perfectly good ways to "fake" either one if you only have the > > other. Probably more work

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

2018-08-08 Thread Barry Scott
On Wednesday, 8 August 2018 07:14:47 BST 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() In this particular case you can fix t

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

2018-08-08 Thread Barry Scott
On Tuesday, 7 August 2018 22:57:51 BST 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: At the moment I solve this problem with various solutions, depending on requi

Re: [Python-ideas] Off topic: 'strike a balance' - second language English

2018-08-20 Thread Barry Scott
> On 20 Aug 2018, at 17:07, Chris Barker via Python-ideas > wrote: > > > Summary: I look at the phrase 'strike a balance' in different languages, > > It is interesting that you picked up on "strike a balance" which has > been a standard English phrase for a very long time rather than the mu

Re: [Python-ideas] A GUI for beginners and experts alike

2018-08-24 Thread Barry Scott
> On 23 Aug 2018, at 19:49, Mike Barnett wrote: > > Python has dropped the GUI ball, at least for beginners (in my opinion) > > While the Python language is awesomely compact, the GUI code is far from > compact. Tkinter will create a nice looking GUI, but you’ve got to be > skilled to use

Re: [Python-ideas] A GUI for beginners and experts alike (Mike Barnett)

2018-08-24 Thread Barry Scott
> On 23 Aug 2018, at 23:14, Hugh Fisher wrote: > >> Date: Thu, 23 Aug 2018 18:49:48 + >> From: Mike Barnett >> >> Python has dropped the GUI ball, at least for beginners (in my opinion) >> >> While the Python language is awesomely compact, the GUI code is far from >> compact. Tkinter

Re: [Python-ideas] Why is design-by-contracts not widely adopted?

2018-09-24 Thread Barry Scott
> On 23 Sep 2018, at 11:13, Angus Hollands wrote: > > Hi Marko, > > I think there are several ways to approach this problem, though am not > weighing in on whether DbC is a good thing in Python. I wrote a simple > implementation of DbC which is currently a run-time checker. You could, with

Re: [Python-ideas] Why is design-by-contracts not widely adopted?

2018-09-24 Thread Barry Scott
> On 23 Sep 2018, at 11:33, Hugh Fisher wrote: > > Could it be that Python has better libraries, is faster to develop for, > attracts > more programmers? If so, I suggest it's worth considering that this might > be *because* Python doesn't have DbC. I'm not sure how you get from the lack of D

Re: [Python-ideas] Why is design-by-contracts not widely adopted?

2018-09-24 Thread Barry Scott
l try to contact dpcontracts maintainers. Maybe it's possible to at least > merge a couple of libraries into one and make it a de facto standard. @Agnus, > would you also like to join the effort? > > Cheers, > Marko > > > > > > Le lun. 24 sept. 2018

Re: [Python-ideas] Using sha512 instead of md5 on python.org/downloads

2018-12-09 Thread Barry Scott
On Windows 10 this works: c:Downloads> certutil -hashfile python-3.7.1-amd64.exe sha512 SHA512 hash of python-3.7.1-amd64.exe: 7dec6362c402b38a9c29b85b204398d7d3fd19509f05279bf713a92abe5b485d4c0c4b175c4edb47f81fd800a599bc2283642a8f0c666edd9e971b5cedf18041 CertUtil: -hashfile command completed succ

Re: [Python-ideas] Use lazy loading with hashtable in python gettext module

2018-12-18 Thread Barry Scott
> On 18 Dec 2018, at 09:10, Serge Ballesta via Python-ideas > wrote: > > In a project of mine, I have used the gettext module from Python Standard > Library. I have found that several tools could be used to generate the > Machine Object (mo) file from the source Portable Object (one): pybabe

Re: [Python-ideas] Fixed point format for numbers with locale based separators

2019-01-05 Thread Barry Scott
On Friday, 4 January 2019 14:57:53 GMT Łukasz Stelmach wrote: > Hi, > > I would like to present two pull requests[1][2] implementing fixed point > presentation of numbers and ask for comments. The first is mine. I > learnt about the second after publishing mine. > > The only format using decimal

Re: [Python-ideas] tkinter: time for round buttons?

2019-01-16 Thread Barry Scott
> On 16 Jan 2019, at 16:11, Abdur-Rahmaan Janhangeer > wrote: > > without starting a should we ban tkinter discussion, i'd like to propose that > we add rounded corners buttons. that might make the aesthetic level go up a > bit more > > poor me, if only py had some really nice native gui I

Re: [Python-ideas] Backtick expression: similar to a shorter lambda syntax

2019-01-22 Thread Barry Scott
The problem with using the back-tick is that it is far too easy to miss read it for a single-quote. back-tick in bash has the $( xxx ) replacement that avoids the problem. Please find an alternative syntax that avoid the problem. Barry > On 22 Jan 2019, at 13:42, James Lu wrote: > > Later to

Re: [Python-ideas] Potential PEP: with/except

2019-01-22 Thread Barry Scott
> On 22 Jan 2019, at 20:31, Michael Selik wrote: > > On Tue, Jan 22, 2019, 12:11 PM Paul Ferrell wrote: > I see this as the natural evolution of what 'with' is all about - replacing > necessary try-finally blocks with something more elegant. We just didn't > include

Re: [Python-ideas] Potential PEP: with/except

2019-01-22 Thread Barry Scott
> On 22 Jan 2019, at 20:11, Paul Ferrell wrote: > > I've found that almost any time I'm writing a 'with' block, it's doing > something that could throw an exception. As a result, each of those > 'with' blocks needs to be nested within a 'try' block. Due to the > nature of 'with', it is rarely

Re: [Python-ideas] Add list.join() please

2019-01-30 Thread Barry Scott
> On 30 Jan 2019, at 10:07, Jamesie Pic wrote: > > On Wed, Jan 30, 2019 at 7:03 AM Robert Vanden Eynde > wrote: >>> >>> Raises an error. Why should: >>> >>> “”.join([2, “2”]) not raise an error as well? >> >> I agree > > What do you think could be the developer intent when they do > ",".jo

Re: [Python-ideas] New explicit methods to trim strings

2019-04-03 Thread Barry Scott
Use "without" as the action picking up on "with" as in startswith, endswith: new_string = a_string.withoutprefix( prefix ) new_string = a_sring.withoutsuffix( suffix ) And since we have "replace" "remove" would also seem obvious. new_string = a_string.removeprefix( prefix

Re: [Python-ideas] Sorted lists

2019-04-08 Thread Barry Scott
> On 8 Apr 2019, at 19:37, Terry Reedy wrote: > > On 4/8/2019 5:40 AM, Steven D'Aprano wrote: >> On Mon, Apr 08, 2019 at 07:44:41AM +0100, Alex Chamberlain wrote: >>> I think a better abstraction for a sorted list is a new class, which >>> implements the Sequence protocol (and hence can be use

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

2019-04-09 Thread Barry Scott
Nam, I'm not so sure that a "universal parsing library" is possible for the stdlib. I think one way you could find out what the requirements are is to refactor at least 2 of the existing stdlib modules that you have identified as needing a better parser. Did you find that you could use the sam

Re: [Python-ideas] Idea: Allow multiple levels of tracers

2019-04-28 Thread Barry Scott
> On 25 Apr 2019, at 15:51, Ram Rachum wrote: > > Hi, > > Here's something I want in Python: Multiple levels of tracers working on top > of each other, instead of just one. > > I'm talking about the tracer that one can set by calling sys.settrace. > > I've recently released PySnooper: http

Re: [Python-ideas] Idea: Allow multiple levels of tracers

2019-04-28 Thread Barry Scott
> On 28 Apr 2019, at 09:12, Ram Rachum wrote: > > It's possible, but it would be very cumbersome, for a bunch of reasons. One > of them is that the tracing code inspects the frame, the variables referenced > in it, and it even opens the file of the code object of the frame. It will be > dif

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-16 Thread Barry Scott
To replace one symlink with another atomically is possible by using rename() or renameat() something like: os.symlink( src, tmp_symlink ) os.rename( tmp_symlink, dst ) Use dir_fd's to taste. I'm sure there is a lot more to cover all the corner cases and attack vectors. I'm not

Re: [Python-ideas] easier lazy logging in stdlib ?

2019-05-16 Thread Barry Scott
This came up 2 years ago. You might want to read this article on LWN that covered the discussion. https://lwn.net/Articles/716986/ Assuming that the log code you call will spot a callable and call it you can do this: log_function( lambda : expensive_fu

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-16 Thread Barry Scott
> On 16 May 2019, at 11:05, Serhiy Storchaka wrote: > > 16.05.19 11:28, Barry Scott пише: >> To replace one symlink with another atomically is possible by using rename() >> or renameat() >> something like: >> os.symlink( src, tmp_symlink ) &g

Re: [Python-ideas] Operator as first class citizens -- like in scala -- or yet another new operator?

2019-05-26 Thread Barry Scott
> On 26 May 2019, at 08:07, Yanghao Hua wrote: > > On Sun, May 26, 2019 at 12:04 AM David Mertz wrote: >> >> I don't really understand HDL/Verilog, but I've worked with people who do. >> In fact, I even wrote a pre-processor that transformed the same DSL to >> Python, C++, and Verilog. >>

Re: [Python-ideas] Operator as first class citizens -- like in scala -- or yet another new operator?

2019-05-26 Thread Barry Scott
> On 26 May 2019, at 17:04, Yanghao Hua wrote: > > On Sun, May 26, 2019 at 11:27 AM Barry Scott wrote: >> I think you are confusing the number of people that use HDL with the amount >> of product created. > > I don't see how I did that but if you intercepted

Re: [Python-ideas] Implement POSIX ln via shutil.link and shutil.symlink

2019-05-30 Thread Barry Scott
> On 30 May 2019, at 01:49, Steven D'Aprano wrote: > > On Wed, May 29, 2019 at 10:22:31PM +0100, Barry wrote: > >> Serhiy, I think, is conflating two things. >> 1. How to write software robust aginst attack. >> 2. How to replace a symlink atomically. > > I don't have an opinion on whether Se

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-11 Thread Barry Scott
> On 11 Jun 2019, at 09:50, Yanghao Hua wrote: > > On Mon, Jun 10, 2019 at 8:57 PM Caleb Donovick > wrote: >> >> First off, I have admittedly not read all of this thread. However, as >> designer of DSL's in python, I wanted to jump in on a couple of things I

[Python-ideas] Re: Add «iterate non-blocking» wrapper to prevent blocking loop too long

2019-06-15 Thread Barry Scott
> On 15 Jun 2019, at 10:55, Gustavo Carneiro wrote: > > > Perhaps. But using threads is more complicated. You have to worry about the > integrity of your data in the face of concurrent threads. And if inside your > task you sometimes need to call async coroutine code, again you need to b

[Python-ideas] Re: Implement POSIX ln via shutil.link and shutil.symlink

2019-06-30 Thread Barry Scott
> On 29 Jun 2019, at 15:08, Tom Hale wrote: > > Based on the below positive feedback, I've created a PR here: > > https://github.com/python/cpython/pull/14464 > > Only shutil.symlink is currently implemented. Feedback (and possibly fixes) > requested from Windows users. > > Thanks to all fo

[Python-ideas] Re: Python including packages

2019-07-08 Thread Barry Scott
> On 8 Jul 2019, at 12:19, Xavier Combelle wrote: > > Fifth, as far as I understand the core reason of the initial talk is that > twisted will support forever python 2, and as such demand that the whole > python ecosystem find workaround to allow this attitude. As I understand it Twisted ha

[Python-ideas] Re: Suggestion: Windows launcher default to not using pre-releases by default

2019-07-10 Thread Barry Scott
> On 10 Jul 2019, at 21:13, Steve Barnes wrote: > > Brett, > > Can I suggest that it might be an idea to add the honouring of PY_PYTHON and > PY_PYTHON2 environmental variables to the help text. This is the missing > piece as far as I am concerned. I knew about the py.ini but not the env v

[Python-ideas] Re: Universal parsing library in the stdlib to alleviate security issues

2019-07-17 Thread Barry Scott
> On 17 Jul 2019, at 05:17, Nam Nguyen wrote: > > On Tue, Jul 16, 2019 at 1:18 PM Barry > wrote: > > > > On 16 Jul 2019, at 04:47, Andrew Barnert via Python-ideas > > mailto:[email protected]>> wrote: > > > > How often do you need to parse a million URL

[Python-ideas] Re: Universal parsing library in the stdlib to alleviate security issues

2019-07-18 Thread Barry Scott
> On 18 Jul 2019, at 05:23, Nam Nguyen wrote: > > On Wed, Jul 17, 2019 at 12:38 AM Barry Scott <mailto:[email protected]>> wrote: >> But if your use cases call for performance, it is perfectly fine to >> understand the tradeoffs, and opt in to the more appr

[Python-ideas] Re: Universal parsing library in the stdlib to alleviate security issues

2019-07-21 Thread Barry Scott
> On 19 Jul 2019, at 02:12, Nam Nguyen wrote: > > > I'm working on the impact of CVE-2019-9636 as part of my day-job. > > I'd be interesting in your analysis of how you parsing proposal would have > avoided this problem before it was described. > I add the "before it was described" because I

[Python-ideas] Re: PEP: add a `no` keyword as an alias for `not`

2019-08-02 Thread Barry Scott
I did a quick scan of the source code I have checkout. I see "no" as a variable in Python, PyPy, GitPython and setuptools. Adding "no" as a keyword will break at least those projects. Barry Here are the details: Python3/Lib/distutils/tests/test_util.py 249 no = ('n', 'no', 'f', 'fa

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-02 Thread Barry Scott
> On 1 Aug 2019, at 19:11, Guido van Rossum > wrote: > > This is an interesting phenomenon. I'm not saying it's good or bad, I'm just > observing it (because it surprised me). Here is someone declaring that the > docs are less accessible than the code. I personally am

[Python-ideas] Re: [OT] Designing for Concurrency (was: Add a "block" option to Executor.submit)

2019-09-05 Thread Barry Scott
> On 5 Sep 2019, at 12:06, Dan Sommers <[email protected]> > wrote: > > Yes, you need some way to produce "back pressure" from downstream to > upstream, and to stop making new work (with new memory consumption) > until there's a place to put it. It seems that this is the impor

[Python-ideas] Re: [OT] Designing for Concurrency (was: Add a "block" option to Executor.submit)

2019-09-07 Thread Barry Scott
> On 5 Sep 2019, at 20:43, Andrew Barnert wrote: > > Have you actually needed case 3 with Executor, or only with other kinds of > async models? With other kinds of async. I mention it as this looks like a design pattern for this problem space. Barry

[Python-ideas] Re: Where should we put the python-ideas HOWTO?

2019-12-02 Thread Barry Scott
Add a link to the HOWTO into the mailman footer? Barry > On 1 Dec 2019, at 15:45, C. Titus Brown wrote: > > Hi folks, > > sorry, took me more than a few months, but I wrote a draft of a python-ideas > HOWTO here, > > https://hackmd.io/@-6xkuCDkTrSFptQEimAdcg/B1noEGh2H > > Thanks to Eric S

[Python-ideas] Re: Argumenting in favor of first()

2019-12-09 Thread Barry Scott
> On 9 Dec 2019, at 20:07, Wes Turner wrote: > > class TooShortValueError(ValueError): > class TooLongValueError(ValueError): > I had to think about the short and long for a moment. I'd suggest: class TooManyItems(ValueError): class TooFewItems(ValueError): Barry __

[Python-ideas] Re: Add a PyObject_VaCallFunction to C API??

2020-01-06 Thread Barry Scott
> On 5 Jan 2020, at 22:20, [email protected] wrote: > > The C API has a function PyObject_CallFunction( PyObject*, const char* fmt, > ... ). It is a variadic function hence I couldn't pass a va_list to it to > invoke the call. My question is, is it technically possible to provide a > companio

[Python-ideas] Re: Enhancing Zipapp

2020-01-06 Thread Barry Scott
> On 6 Jan 2020, at 19:34, Abdur-Rahmaan Janhangeer > wrote: > > Note: draft simplified Please cover the pro's and con's of the alernatives that have been raised as comments on this idea, as is usually done for a PEP style document. Also beware that zip file format does not include the enc

[Python-ideas] Re: Enhancing Zipapp

2020-01-08 Thread Barry Scott
> On 8 Jan 2020, at 16:02, Christopher Barker wrote: > > On Wed, Jan 8, 2020 at 1:49 AM Abdur-Rahmaan Janhangeer > wrote: > Have a look at this write up about the horror that is zip file name handling. > > https://marcosc.com/2008/12/zip-files-and-encoding-i-hate-

[Python-ideas] Re: Improve SyntaxError for obvious issue:

2020-01-15 Thread Barry Scott
> On 14 Jan 2020, at 18:42, Guido van Rossum wrote: > > On the subject of replacing the current parser, I am actively working on > that. See GitHub.com/gvanrossum/pegen. Will that allow me to write this? if a > 3 and x < 6: doit() Barry > > On Tue, Jan 14, 2020 at 10:32 Andrew Ba

[Python-ideas] Re: Annotated string literals

2020-02-04 Thread Barry Scott
> On 3 Feb 2020, at 01:28, Soni L. wrote: > > It'd be cool to attach metadata to string literals that doesn't end up in the > resulting string object. This metadata could be used by all sorts of tools, > everything from localization to refactoring. > > In C, some localization libraries use m

[Python-ideas] Re: Add Binary module.

2020-02-16 Thread Barry Scott
> On 16 Feb 2020, at 09:38, [email protected] wrote: > > This module should contain operations that can be performed on binary numbers. > In the below examples a and b are binary numbers. Assuming you mean that a "binary number" is int then python can do what you want I think.

[Python-ideas] Re: Add Binary module.

2020-02-16 Thread Barry Scott
> On 16 Feb 2020, at 17:49, ananthan ananthan > wrote: > > But there is a problem with (0b1101). > > 5==0b101 > -5==-0b101 > > but we want output -5==1011. > so this is not possible by using integers with base designator "0b". There is no such thing as an 'integers with base designator "

[Python-ideas] Re: prefix/suffix for bytes

2020-03-11 Thread Barry Scott
> On 11 Mar 2020, at 19:03, Rhodri James wrote: > > On 11/03/2020 18:45, Stephen J. Turnbull wrote: >> Rhodri James writes: >> > We've headed off down the rabbit-hole of filenames for >> > justification here, but surely pathlib is the correct tool if you >> > are going to be chopping up fil

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Barry Scott
> On 16 Mar 2020, at 20:59, James Edwards wrote: > > I would love a formalized, for example, __pretty__ hook. Many of our classes > have __pretty__ and __json__ "custom" dunders defined and our PrettyPrinters > / JSONEncoders have checks for them (though the __pretty__ API has proven > diff

[Python-ideas] Re: New explicit methods to trim strings

2020-03-18 Thread Barry Scott
> On 18 Mar 2020, at 18:03, Rob Cliffe via Python-ideas > wrote: > > Consider that the start or end of a string may contain repetitions of an > affix. > > Should `-+-+-+Spam'.stripprefix('-+') remove just the first occurence? All > of them? Does it need a 'count' parameter? The only wa

[Python-ideas] Re: New explicit methods to trim strings

2020-03-22 Thread Barry Scott
> On 19 Mar 2020, at 22:12, Rob Cliffe wrote: > > > On 18/03/2020 20:16, Barry Scott wrote: >> >>> On 18 Mar 2020, at 18:03, Rob Cliffe via Python-ideas >>> wrote: >>> >>> Consider that the start or end of a string may contain rep

[Python-ideas] Re: About python3 on windows

2020-03-24 Thread Barry Scott
> On 23 Mar 2020, at 17:59, Frédéric De Jaeger wrote: > > Hi all, > > There is a recurring problem in my company where we use python in various > places (python3). > We do cross platform development windows/linux and our python scripts need to > run everywhere. > Some scripts are launched m

[Python-ideas] Re: About python3 on windows

2020-03-25 Thread Barry Scott
> On 25 Mar 2020, at 09:15, Eryk Sun wrote: > > On 3/25/20, Steve Barnes wrote: >>> Except it's not necessarily what the original post wants. The OP wants the >>> shebang "#!/usr/bin/env python3" to "work everywhere by >>> default", for which I assume it's implied that it should work consiste

[Python-ideas] Re: About python3 on windows

2020-03-26 Thread Barry Scott
> On 25 Mar 2020, at 16:53, Paul Moore wrote: > > On Wed, 25 Mar 2020 at 16:10, Eryk Sun wrote: > >> The py launcher's "env" command searches PATH for anything from >> "python" to "notepad" -- but not for a versioned Python command such >> as "python3" or "python2". It always uses a registe

[Python-ideas] Re: About python3 on windows

2020-03-26 Thread Barry Scott
> On 25 Mar 2020, at 17:02, Andrew Barnert wrote: > > On Mar 25, 2020, at 05:02, Paul Moore wrote: >> >> The only reason anyone has ever suggested versioned executables on >> Windows is for Unix compatibility - the reasons they are needed on >> Unix simply don't apply on Windows (at least not

[Python-ideas] Improve the Windows python installer to reduce new user confusion

2020-04-10 Thread Barry Scott
The Python Users list most often asked question seems to be from Windows users who run the installed multiple times because they assume that the install is the python program. Followed by I installed Python, where is it? My suggestion is that the installer wizard "Setup was successful" panel has

[Python-ideas] Re: Improve the Windows python installer to reduce new user confusion

2020-04-11 Thread Barry Scott
> On 10 Apr 2020, at 20:14, Christopher Barker wrote: > > I rarely use Windows, but do support them, so this sounds good to me. > > But one confusion: > > With py.exe no need to mess with the PATH. > > How does py.exe get on the PATH? > > Now that the need for python 2 and 3 on the same mac

[Python-ideas] Re: Adding a "once" function to functools

2020-04-28 Thread Barry Scott
> On 28 Apr 2020, at 02:04, Steven D'Aprano wrote: > > Yes, it's annoying when English words can have two or more meanings. The > first time I can across math.sin, I was very excited, until I realised > it was just the trigonometric function :-( @once def my_func(): ... I read that

[Python-ideas] Re: zip(x, y, z, strict=True)

2020-04-29 Thread Barry Scott
> On 28 Apr 2020, at 16:12, Rhodri James wrote: > > On 28/04/2020 15:46, Brandt Bucher wrote: >> Thanks for weighing in, everybody. >> Over the course of the last week, it has become surprisingly clear that this >> change is controversial enough to require a PEP. >> With that in mind, I've st

  1   2   >