[Python-ideas] Re: Have del return a value

2023-09-08 Thread Barry Scott
> On 6 Sep 2023, at 03:47, Daniel Walker wrote: > > I use foo to instantiate another object: > > bar = Bar(foo) > > bar is free to manipulate foo however it wants and even del it if necessary. foo is a reference to an object, it is not an object in its own right. You can say that bar is

[Python-ideas] Re: dict method to retrieve a key from a value

2023-06-30 Thread Barry Scott
> On 30 Jun 2023, at 02:50, Andre Delfino wrote: > > A dict method to retrieve the key of a value from a bijective dict would have > come in handy to me in several occasions: > names = {'one': 1} names.inverse()[1] > 'one' names = {'one': 1, 'uno': 1} names.inverse()[1] >

[Python-ideas] Re: Auto dedent -c arguments.

2023-04-09 Thread Barry Scott
On 04/04/2023 15:18, Jonathan Crall wrote: I have what I think is a fairly low impact quality of life improvement to suggest for the python CLI. When I'm not working in Python I tend to be working in bash. But often I want to break out and do something quick in Python. I find the `python -c

[Python-ideas] Re: Multiple arguments to str.partition and bytes.partition

2023-01-08 Thread Barry Scott
On 08/01/2023 17:06, James Addison wrote: On Sun, 8 Jan 2023 at 13:20, Barry Scott wrote: Maybe combine the ideas by allowing a tuple where a string is used. 'a=b;c'.partition('=', (':',';')) => ('a', '=', b, ';

[Python-ideas] Re: Multiple arguments to str.partition and bytes.partition

2023-01-08 Thread Barry Scott
> On 8 Jan 2023, at 10:10, James Addison via Python-ideas > wrote: > > On Sun, 8 Jan 2023 at 03:44, Steven D'Aprano wrote: >> >> Keep it nice and simple: provided with multiple separators, `partition` >> will split the string on the first separator found in the source string. >> >> In othe

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-17 Thread Barry Scott
> On 17 Dec 2022, at 16:07, e...@emilstenstrom.se wrote: > > Hi everyone! > > I'm the maintainer of a small django library called django-components. I've > run into a problem that I have a language-level solution (tagged strings) to, > that I think would benefit the wider python community. >

[Python-ideas] Re: Allow more flexibility for describing bytes objects.

2022-11-23 Thread Barry Scott
> On 23 Nov 2022, at 12:32, Ronald Hoogenboom via Python-ideas > wrote: > > Refer to PEP 3137 and PEP 358. > > Bytes objects are for conveying binary data (or encoded strings). Such binary > data is customary specified in hex-dump or base64 format in source files. > It would be nice to intr

[Python-ideas] Re: Use 'bin' in virtual environments on Windows

2022-07-24 Thread Barry Scott
> On 21 Jul 2022, at 00:46, Svein Seldal wrote: > > > Using py in the three OS-es (unix-like, Mac and Win) has become very similar > in the last years, which is great. Making portable py code has become very > easy. However, there is one peculiarity in Win which I find annoying: virtual >

[Python-ideas] Re: Use 'bin' in virtual environments on Windows

2022-07-24 Thread Barry Scott
> On 21 Jul 2022, at 16:42, Christopher Barker wrote: > > I still am dumbfounded that this wasn’t platform I dependent in the first > place, but you know what essay about hindsight. > > However, I’m no Windows expert, but I *think* the modern Windows file > system(s?) support something like

[Python-ideas] Re: Make dataclass aware that it might be used with Enum

2022-07-10 Thread Barry Scott
> On 9 Jul 2022, at 22:53, Steve Jorgensen wrote: > > I don't think that dataclasses have the limited set of intended uses that you > are interpreting them as having. To me, the fact that they can be frozen > makes them a good fit with Enum. Please quote the email that you are replying to.

[Python-ideas] Re: Make dataclass aware that it might be used with Enum

2022-07-08 Thread Barry Scott
> On 8 Jul 2022, at 02:22, Steve Jorgensen wrote: > > After some playing around, I figured out a pattern that works without any > changes to the implementations of `dataclass` or `Enum`, and I like this > because it keeps the 2 kinds of concern separate. Maybe I'll try submitting > an MR to

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-22 Thread Barry Scott
> On 22 Jun 2022, at 19:09, Paul Moore wrote: > > I suspect that you consider evaluation-on-reference as an important > feature of your proposal, but could you consider explicit evaluation > as an alternative? Or at the very least address in the PEP the fact > that this would close the door on

[Python-ideas] Re: TextIOBase: Make tell() and seek() pythonic

2022-05-25 Thread Barry Scott
> On 25 May 2022, at 10:16, Stephen J. Turnbull > wrote: > > This is much > better than the pre-PEP-393 situation (where the unicode type was > UTF-16, Only on Windows right? mac and Linux did not do this, at least with the bullds I have used for python 2.7. Barry ___

[Python-ideas] Re: Less is more? Smaller code and data to fit more into the CPU cache?

2022-03-27 Thread Barry Scott
> On 27 Mar 2022, at 18:16, Jonathan Fine wrote: > > Hi > > Thank you Inada for your prompt and helpful reply. Here's a link for cached > hash in bytes object: https://bugs.python.org/issue46864 > > > What I have in mind is making selected objects smalle

[Python-ideas] Re: Less is more? Smaller code and data to fit more into the CPU cache?

2022-03-27 Thread Barry Scott
> On 22 Mar 2022, at 15:57, Jonathan Fine wrote: > > Hi > > As you may have seen, AMD has recently announced CPUs that have much larger > L3 caches. Does anyone know of any work that's been done to research or make > critical Python code and data smaller so that more of it fits in the CPU >

[Python-ideas] Re: mro and super don't feel so pythonic

2022-03-27 Thread Barry Scott
> On 26 Mar 2022, at 18:15, malmiteria wrote: > > the alternative to super really is not the important part of my proposal, > it's the alternative to MRO. > > An example of a case where i genuinly believe my solution adds value is this : > > ``` > class A: >def method(self): >pr

[Python-ideas] Re: Proposal to associate thread-local data/context with a faulthandler traceback

2022-03-06 Thread Barry Scott
> On 6 Mar 2022, at 07:19, t...@tomforb.es wrote: > > For reference, this request comes from running Dask[1] jobs. Dask handles > retrying and tracking tasks across machines but if you're dealing with a > batch of inputs that reliably kills a worker it is really hard to debug, > moreso if it

[Python-ideas] Re: Proposal to associate thread-local data/context with a faulthandler traceback

2022-03-05 Thread Barry Scott
> On 2 Mar 2022, at 14:22, t...@tomforb.es wrote: > > The faulthandler module is invaluable for tracking down segfaults in native > code, however it is really lacking the ability to add some kind of useful > breadcumb to aide debugging. Imagine you are running a large-scale > distributed job

[Python-ideas] Re: Str to Byte

2022-02-24 Thread Barry Scott
> On 23 Feb 2022, at 21:05, one last Day wrote: > > bit = "\xd8\xa3\xd9\x88\xd9\x87 \xd8\xa8\xd8\xaf\xd9\x8a\xd9\x84 > \xd9\x85\xd9\x86 \xd9\x82\xd9\x88\xd9\x84\xd8\xaa\xd9\x8a > \xd9\x88\xd8\xa7\xd9\x87\xd8\xa7" Is "bit" bidirectional text? I see what looks like arabic UTF-8 above. Use th

[Python-ideas] Re: CLI convenience?

2022-02-20 Thread Barry Scott
> On 20 Feb 2022, at 08:56, Eliot Lear wrote: > > Hi everyone, > > I'm sure there's a clear answer, probably written some place obvious, but I > wonder if there is a reason why certain functions are not linked to > console_scripts. In particular I would think this would be good for > json

[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

[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:ba...@barrys-emacs.org>> wrote: >> >> >> >>> On 1 Dec 2021, at 06:16, Chris Angelico wrote: >>> >>> I've just upd

[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-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-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-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: easier writing to multiple streams

2021-11-28 Thread Barry Scott
> On 26 Nov 2021, at 16:00, eyalgr...@gmail.com 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: 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: 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: Allow regex group name redefinitions

2021-10-02 Thread Barry Scott
> On 2 Oct 2021, at 10:27, ven...@razdva.cz 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: 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: 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: 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: 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: 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: 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: 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: 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: 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:ba...@barrys-emacs.org>> wrote: > > >

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

2021-03-02 Thread Barry Scott
> On 1 Mar 2021, at 18:01, mmax42...@gmail.com 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: 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: 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-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: 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: 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: 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: 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 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-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-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-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:ba...@barrys-emacs.org>> 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-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:ba...@barrys-emacs.org>> 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-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: 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: 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: 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: 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: 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: 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-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: Dict unpacking assignment

2020-11-01 Thread Barry Scott
> On 31 Oct 2020, at 11:27, Steven D'Aprano wrote: > > On Sat, Oct 31, 2020 at 08:24:04AM +0000, Barry Scott wrote: > >>> On 31 Oct 2020, at 06:35, Steven D'Aprano wrote: >>> >>> I think we can promise that: >>> >>> *

[Python-ideas] Re: Dict unpacking assignment

2020-10-31 Thread Barry Scott
> On 31 Oct 2020, at 06:35, Steven D'Aprano wrote: > > I think we can promise that: > > * if the mapping on the right has missing keys, no assignments occur; > > * if the mapping on the right has extra keys, and there is no double > star target to capture the extras, then no assignments occ

[Python-ideas] Re: New feature

2020-10-16 Thread Barry Scott
> On 16 Oct 2020, at 14:44, Rob Cliffe via Python-ideas > wrote: > > > > On 16/10/2020 13:55, Chris Angelico wrote: >> >>> I do precisely that in many of my programs for e.g. single-line progress >>> displays. >>> But for multi-line output I don't know of any way to move the cursor >>> bac

[Python-ideas] Re: Naming Accepted PEPs as PAPs

2020-09-21 Thread Barry Scott
hmaanJ> > Mauritius > > > On Mon, Sep 21, 2020 at 9:23 PM Barry Scott <mailto:ba...@barrys-emacs.org>> wrote: > > This is like RFC that can be draft, accepted or rejected. > RFC's have not needed to change there names. > I'd rather not have PEP'

[Python-ideas] Re: Naming Accepted PEPs as PAPs

2020-09-21 Thread Barry Scott
> On 21 Sep 2020, at 08:35, Abdur-Rahmaan Janhangeer > wrote: > > Maybe they have not thought of doing it and also, request for comments is > like the first mail on python-ideas You might find this interesting on RFC process: https://en.wikipedia.org/wiki/Request_for_Comments Or maybe they

[Python-ideas] Re: Naming Accepted PEPs as PAPs

2020-09-21 Thread Barry Scott
> On 21 Sep 2020, at 07:26, Abdur-Rahmaan Janhangeer > wrote: > > Greeting lists, > > I am thinking of proposing to name accepted PEPs as PAPs > namely: Python Accepted Proposals. > > Hence if we say PAP8 we know it's an accepted proposal. > > Backstory: > > I quoted V. Stinner in this >

[Python-ideas] Re: Add the brotli & zstandard compression algorithms as modules

2020-09-21 Thread Barry Scott
> On 21 Sep 2020, at 16:14, Antoine Pitrou wrote: > > > Hi, > > On Mon, 21 Sep 2020 09:31:47 - > "Omer Katz" mailto:omer.d...@gmail.com>> wrote: >> Hello everyone, >> >> We have many compression algorithms as standard modules, but we lack two >> important new algorithms: brotli and zsta

[Python-ideas] Re: argmax and argmin to python list

2020-08-30 Thread Barry Scott
> On 30 Aug 2020, at 09:03, Jeff Allen wrote: > > On 29/08/2020 14:17, Barry Scott wrote: >>> On 29 Aug 2020, at 13:42, Filipp Bakanov >> <mailto:fil...@bakanov.su>> wrote: >>> >>> I'd like to propose adding argmax and argmin functions t

[Python-ideas] Re: argmax and argmin to python list

2020-08-29 Thread Barry Scott
> On 29 Aug 2020, at 13:42, Filipp Bakanov wrote: > > I'd like to propose adding argmax and argmin functions to the python list. > These functions return the index of a maximum / minimum element of the list. > Eg: > > a = [1, 4, 2, 3] > print(a.argmax()) # 1 > print(a.argmin()) # 0 > > It

[Python-ideas] Re: How to prevent shared memory from being corrupted ?

2020-07-30 Thread Barry Scott
> On 30 Jul 2020, at 11:55, Vinay Sharma via Python-ideas > wrote: > > > >> On 28-Jul-2020, at 5:19 AM, Robert Collins > > wrote: >> >> On Mon, 27 Jul 2020 at 23:24, Vinay Sharma > > wrote: >>> >>> Hi, Thanks for replying.

[Python-ideas] Re: New clause in FOR and WHILE instead of ELSE

2020-07-24 Thread Barry Scott
> On 23 Jul 2020, at 17:04, Rob Cliffe via Python-ideas > wrote: > > > > On 23/07/2020 16:24, Stephen J. Turnbull wrote: >> Steven D'Aprano writes: >> > On Wed, Jul 22, 2020 at 06:14:39AM +0300, Paul Sokolovsky wrote: >> >> > > But no, loop executes, *or else* the following "else" block >

[Python-ideas] Re: New clause in FOR and WHILE instead of ELSE

2020-07-20 Thread Barry Scott
> On 20 Jul 2020, at 09:56, Alex Hall wrote: > > On Mon, Jul 20, 2020 at 10:36 AM Rob Cliffe via Python-ideas > mailto:python-ideas@python.org>> wrote: > May I repeat: Spelling 'if break:' and 'if not break:' rather than say > 'on_break:' etc. would avoid adding new keywords. > > I don't kn

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-07-14 Thread Barry Scott
> On 13 Jul 2020, at 18:56, Paul Moore wrote: > > On Mon, 13 Jul 2020 at 18:42, Barry Scott wrote: > >> On 13 Jul 2020, at 05:55, Christopher Barker wrote: >> >> well, sure, though I have to say that I think that that's an unfortunate >> confu

[Python-ideas] Re: Access (ordered) dict by index; insert slice

2020-07-13 Thread Barry Scott
> On 13 Jul 2020, at 05:55, Christopher Barker wrote: > > well, sure, though I have to say that I think that that's an unfortunate > confusing thing about python dicts. IN fact, I doubt there are many uses at > all for dict.keys() -- most uses can jsut use the dict. I use key() all the time

[Python-ideas] Re: Python: Different native runtime state tiers.

2020-07-09 Thread Barry Scott
You might fine more interest on the Python C-API mailing list. https://mail.python.org/mailman3/lists/capi-sig.python.org/ Barry > On 8 Jul 2020, at 23:58, William Pickard wrote: > > CPython at the very least has 2 different type

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-22 Thread Barry Scott
Let's try again... > On 22 Jun 2020, at 08:15, Inada Naoki wrote: > > On Mon, Jun 22, 2020 at 12:00 AM Guido van Rossum wrote: >> >> >> I believe this was what Greg Stein's idea here was about. (As well as >> Jonathan Fine's in this thread?) But the current use of code objects makes >> this

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-22 Thread Barry Scott
> On 22 Jun 2020, at 08:15, Inada Naoki wrote: > > On Mon, Jun 22, 2020 at 12:00 AM Guido van Rossum wrote: >> >> >> I believe this was what Greg Stein's idea here was about. (As well as >> Jonathan Fine's in this thread?) But the current use of code objects makes >> this hard. Perhaps th

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-19 Thread Barry Scott
> On 18 Jun 2020, at 22:28, Steven D'Aprano wrote: > > On Thu, Jun 18, 2020 at 06:49:13PM +0100, Barry Scott wrote: > >> The key part of the idea is that the memory holding the ref count is >> not adjacent to the memory holding the objects state. Further t

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-18 Thread Barry Scott
> On 18 Jun 2020, at 19:30, Jonathan Fine wrote: > > Hi Barry > > You wrote: > > We need to define terms here. What do you mean by permanent? > > Good question. I think I answered it in my original post: > > An object is transient if it can be garbage collected. An object is permanent > i

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-18 Thread Barry Scott
> On 18 Jun 2020, at 19:00, Jonathan Fine wrote: > > Hi Barry > > You wrote: > Did my last reply cover a possible implementation of this? > e.g. The code is nowhere near the ref-count that triggers COW. > > Could say, do you think it's possible to extend Python so that it can use > permanent

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-18 Thread Barry Scott
> On 18 Jun 2020, at 18:42, Jonathan Fine wrote: > > Hi Barry > > Thank you for your interest in my proposal. Let me try to answer your > question. You wrote: > > To make the code avoid COW you would need to be able to make sure that all > code memory blocks are not mixed in with PyObject m

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-18 Thread Barry Scott
> On 18 Jun 2020, at 18:37, Christopher Barker wrote: > > On Thu, Jun 18, 2020 at 9:34 AM Barry Scott <mailto:ba...@barrys-emacs.org>> wrote: > To make the code avoid COW you would need to be able to make sure that all > code memory blocks are not mixed in wit

[Python-ideas] Re: "return if "

2020-06-18 Thread Barry Scott
> On 18 Jun 2020, at 13:30, Daniel. wrote: > > I love the do_stuff if cond syntax in Ruby and in perl. It's very natural to > real, much more to follow than if cond: do_stuff I on the other hand hate that syntax and find it harder to read. Why put the code out of sequence? if read_t

[Python-ideas] Re: Permanent code objects (less memory, quicker load, less Unix Copy On Write)

2020-06-18 Thread Barry Scott
> On 18 Jun 2020, at 10:36, Jonathan Fine wrote: > > Hi All > > Summary: Shared objects in Unix are a major influence. This proposal can be > seen as a first step towards packaging pure Python modules as Unix shared > objects. > > First, there's a high level overview. Then some technical st

[Python-ideas] Re: EVENTFD(2) support

2020-06-18 Thread Barry Scott
> On 16 Jun 2020, at 19:57, doods...@gmail.com wrote: > > I've looked over the PyPi version of `eventfd`, and I feel that it is trying > to be more than just a thin wrapper. The attempt to make it cross platform > has given it more fields than it requires, as has the attempt to wrap it as a

[Python-ideas] Re: For quicker execution, don't refcount objects that can't be deleted

2020-06-15 Thread Barry Scott
> On 15 Jun 2020, at 20:48, Christopher Barker wrote: > > On Mon, Jun 15, 2020 at 9:21 AM Barry Scott <mailto:ba...@barrys-emacs.org>> wrote: > The problem is when you fork a python process. > > Each of the child processes you would hope shared the state of the

[Python-ideas] Re: For quicker execution, don't refcount objects that can't be deleted

2020-06-15 Thread Barry Scott
> On 14 Jun 2020, at 22:59, Ben Rudiak-Gould wrote: > > There isn't really any contention for these memory locations in > CPython as it stands because only one interpreter thread can run at a > time. The only time a cache handoff is needed is during a thread > switch when the new thread is sch

[Python-ideas] Re: Add close method to queue

2020-06-09 Thread Barry Scott
> On 9 Jun 2020, at 13:20, Kazantcev Andrey wrote: > > I have a problem with notifying all current subscribers and new subscribers > about the closure of the queue and the reason. For example, I have a producer > that reads messages from websocket or something else and send this to a > queu

[Python-ideas] Re: Shared Semaphores for synchronisation across unrelated processes

2020-06-05 Thread Barry Scott
> On 5 Jun 2020, at 16:18, Vinay Sharma via Python-ideas > wrote: > > Hi, > Python has integrated shared memory into standard library starting from 3.8 > (https://docs.python.org/3/library/multiprocessing.shared_memory.html >

[Python-ideas] Re: Sanitize filename (path part) 2nd try

2020-05-12 Thread Barry Scott
> On 11 May 2020, at 22:38, Andrew Barnert wrote: > > On May 11, 2020, at 12:59, Barry Scott wrote: >> >> >>> On 11 May 2020, at 18:09, Andrew Barnert via Python-ideas >>> mailto:python-ideas@python.org>> wrote: >>> >>> Mo

[Python-ideas] Re: Sanitize filename (path part)

2020-05-12 Thread Barry Scott
> On 11 May 2020, at 23:24, Andrew Barnert wrote: > > On May 11, 2020, at 13:31, Barry Scott wrote: >> >> macOS and Unix version (I only use Unicode input so avoid the random bytes >> problems): > > But that doesn’t avoid the problem. If someone gives you

[Python-ideas] Re: Sanitize filename (path part) 2nd try

2020-05-11 Thread Barry Scott
> On 11 May 2020, at 18:09, Andrew Barnert via Python-ideas > wrote: > > More generally, what’s the use case for %-encoding filenames like this? Are > people expecting it to interact transparently with URLs, so if I save a file > “spam\0eggs” in a Python script and then try to browse to file

[Python-ideas] Re: Sanitize filename (path part)

2020-05-11 Thread Barry Scott
> On 10 May 2020, at 01:34, Steve Jorgensen wrote: > > I believe the Python standard library should include a means of sanitizing a > filesystem entry, and this should not be something requiring a 3rd party > package. snip I found that I needed to have code that could tell me if a filename

[Python-ideas] Re: Passing Arguments Through Thin Wrappers (was : Auto-assign attributes from __init__ arguments)

2020-05-05 Thread Barry Scott
> On 5 May 2020, at 15:38, Steven D'Aprano wrote: > > Here is a quick and dirty proof of concept: > > >from inspect import stack, Signature > >def parameters(): >caller = stack()[2][0].f_globals[stack()[1][3]] >sig = Signature.from_callable(caller) >vars = st

[Python-ideas] Re: deque: Allow efficient operations

2020-04-29 Thread Barry Scott
> On 29 Apr 2020, at 12:36, remi.lape...@henki.fr wrote: > > Also, removing an element from a doubly-linked list is not a O(1) operation, > it's O(n). It's O(1) once you have a pointer to the element but you have to > iterate over the list to get it and that would take O(n) operations, so > m

[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

[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: 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] 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: 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

  1   2   >