[Python-ideas] Re: Arrow functions polyfill

2021-02-23 Thread Barry
to prefer %. I18n you can translate a f string. Barry > > Note that the existence, and popularity, of tools like flynt and pyupgrade > (that convert % and .format() directives to f-strings automatically) supports > this affirmation. > > I found the 'un-fstring'

[Python-ideas] Re: Arrow functions polyfill

2021-02-23 Thread Barry
> On 23 Feb 2021, at 21:42, Barry wrote: > >  > > >>> On 23 Feb 2021, at 18:08, Stéfane Fermigier wrote: >>> >>  >> Both '%' and .format() support both positional and named arguments. >> >> There are probably a few use

[Python-ideas] Re: multiprocessing: hybrid CPUs

2021-08-18 Thread Barry
t, and certainly Windows doesn't). And next you find out that you have to understand the NUMA details of your system because the memory attached to the CPUs is not the same speed. > > All in all, far easier to just divide the job into far more pieces > than you have proce

[Python-ideas] Re: Should bare logical comparisons raise a warning?

2021-11-25 Thread Barry
> On 25 Nov 2021, at 13:06, ehmatt...@gmail.com wrote: > > Hi everyone, > > I've been really impressed by the recent improvements to error messages in > Python 3.10. The specific suggestions in some error messages are going to > save countless hours of people's time. The benefits for beginner

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

2021-11-25 Thread Barry
: >print('hello', file=[sys.stdout, f]) You can replace sys.stdout with your own object that prints to a list of streams. I have used this in the past. The implementation can be as simple as supplying an object with a write method that writes to each of the steams I turn.

[Python-ideas] Re: Official means to release the GIL in Python

2021-12-03 Thread Barry
as we await the results from Sam Gross's paper. You must hold the GIL to execute python code. Only extensions written in C etc can release the GIL while they do work that does not access any python API. Cython generates C code I believe and can release the GIL because it I’d not py

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread Barry
or user > direcotry. > > > This may also be implemented as an external library, but I am not sure I > would like add add a dependency to my projects "just for this". > > > I can implement this if people are interested with this feature. I wrote this h

[Python-ideas] Re: Adding sortedconatiners to Python or merge the ideas?

2022-02-03 Thread Barry
yPI is the best place for it. I know you read python dev isn’t that what you have sensed as well? Barry ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailma

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

2018-08-09 Thread Barry
> On 8 Aug 2018, at 12:08, Victor Porton wrote: > >> On 08/08/18 12:25, Barry Scott wrote: >>> 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

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

2018-08-20 Thread Barry
> On 20 Aug 2018, at 07:35, Jacco van Dorp wrote: > > I would consider conciseness and accuracy most important. Using jargon but > linking to accurate explanations would, in my not exactly humble opinion, be > the best way to go about it. +1 my thoughts exactly. >

Re: [Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

2019-01-07 Thread Barry
sed when processing the key, and it could return the default. Most config file APIs I have used have has_section and has_key type functions that remove the need to catch exceptions. What config file API are you using htat is missing this? Barry _

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

2019-01-16 Thread Barry
> On 16 Jan 2019, at 20:32, Christopher Barker wrote: > >> On Wed, Jan 16, 2019 at 2:07 PM Barry Scott wrote: > >> aesthetic level go up a bit more >>> > tkinter is a wrapper around TK -- so it's TK that would need to "modernize" >&g

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

2019-05-29 Thread Barry
ntrol of its file space which I would suggest means you already lost. I think the OP wants a soution to 2, which as I suggest can leverage the design work in the implementation of the GNU ln -sf command in python. Barry > > > -- > Steven > _

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

2019-07-16 Thread Barry
> On 16 Jul 2019, at 04:47, Andrew Barnert via Python-ideas > wrote: > > How often do you need to parse a million URLs in your inner loop? As it happens i work on code that would be impacted by such a slow down. It runs in production 24x7 and parses URLs on its critical

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

2019-07-21 Thread Barry
> On 21 Jul 2019, at 19:03, Steven D'Aprano wrote: > >> On Sun, Jul 21, 2019 at 08:48:49AM +0100, Barry Scott wrote: >> >> I took at very quick look at bpo30500 and was struck by the comment >> that the code was working on a URL that had not been vali

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-18 Thread Barry
rt of a context manager, Esoteric? I work with files that are open beyond the scope of a single block of code all the time. Clearly I need to arrange to close the file eventually. Why would I want the uglyness of __exit__ rather then close()? I use with all the time if the open() is with linear code.

[Python-ideas] Re: frozen dataclasses attribute initialization

2019-12-13 Thread Barry
gt; Anyways in both cases, there is still a problem when the class uses > __slots__as @Eric V. Smith mentioned previously. Hack warning: Put the flag outside of the class? Say by putting the instance id() into a set(). Now it works for slots, just need to think about data races... Barry

[Python-ideas] Re: Enhancing Zipapp

2020-01-07 Thread Barry
s write up about the horror that is zip file name handling. https://marcosc.com/2008/12/zip-files-and-encoding-i-hate-you/ This has been a pain point at work. Barry > > -CHB > > > > > >> On Mon, Jan 6, 2020 at 5:50 PM Abdur-Rahmaan Janhangeer >> wrote: >>

[Python-ideas] Re: Enhancing Zipapp

2020-01-07 Thread Barry
> On 7 Jan 2020, at 01:48, Abdur-Rahmaan Janhangeer > wrote: > >  > > >> On Tue, 7 Jan 2020, 01:57 Barry Scott, wrote: >> >> >> Please cover the pro's and con's of the alernatives that have been raised as >> comments &g

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Barry
>> it would be a bad idea to make that a requirement. > > The only change needed to support O(1) copy is making modified copies > of nodes instead of mutating them in place. The algorithms are > otherwise the same. So when I insert into the copy how do you avoid all the nodes being

[Python-ideas] Re: TLS session resumption

2020-04-18 Thread Barry
sion tickets in TLS 1.2. https://blog.filippo.io/we-need-to-talk-about-session-tickets/ Tl;dr its not considered secure. Barry > > I see a similar issue was being discussed here [0], but cannot tell why it > (apparently) didn't get into. The link to the patch is broken. >

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

2020-04-27 Thread Barry
... def my_unique_function(...): >... do_something_cool() >... >>>> def something_else(): >... pass >... >>>> def my_unique_function(...): >... # uh oh, duplicate! >... >RuntimeError - duplicate

[Python-ideas] Re: isolating user allocations

2020-07-20 Thread Barry
looking for memory leaks I have not cared about that distinction. Should I be caring? Am I missing something? Barry > > If the interpreter doesn't have this functionality already, it would probably > be difficult to add, as the existing allocation API is called throughout the > interprete

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

2020-07-21 Thread Barry
at not what else mean today. Its elif never looped. 2. Because if after for is confusing. I can get behind elif as after for it pull work. Barry > > Best wishes > Rob Cliffe > ___ > Python-ideas mailing list -- python-ideas@python.org &g

[Python-ideas] Re: Tracebacks for C code in Python

2020-08-15 Thread Barry
g, because the exception message isn't that clear, so I > would at least like to know what the code was trying to do when it got the > exception. Maybe this will give me more hints about what's going wrong. > > Would it be possible to have Python tracebacks include code f

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

2020-08-30 Thread Barry
ion so performance sensitive that you need this in C? Have you considered writing this as a C extension for your own use? Barry > > > > On Sun, 30 Aug 2020 at 11:52, Barry Scott wrote: >> >> >>>> On 30 Aug 2020, at 09:03, Jeff Allen wrote: >>

Re: [Python-ideas] Efficient debug logging

2017-02-14 Thread Barry
see what the cost of the lamba version is. It would still be nice to have the code look cleaner without the lambda. Barry > > >> On 2017-02-14 10:51, Barry Scott wrote: >> A common pattern I use is to have logging calls for debug and information >> with my applications. &g

Re: [Python-ideas] Efficient debug logging

2017-02-14 Thread Barry
> On 14 Feb 2017, at 17:03, Cory Benfield wrote: > > >> On 14 Feb 2017, at 15:51, Barry Scott wrote: >> And have the evaluation of the argument skipped unless its dbg_log is >> enabled. >> >> I cannot see how to do this with python as it stands. >

Re: [Python-ideas] Efficient debug logging

2017-02-17 Thread Barry
conditional > execution of an expensive function. Its not lots of levels its lots of categories. I did add one level, INFOHEADER, but not for debug. It you are interested in what I did you could look at this project: https://github.com/barry-scott/scm-workbench Have a look at: https://git

Re: [Python-ideas] get() method for list and tuples

2017-03-01 Thread Barry
th Yes I think this duck cannot swim or quack. Barry ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] get() method for list and tuples

2017-03-01 Thread Barry
> On 1 Mar 2017, at 19:13, Abe Dillon wrote: > > Barry, you're taking the metaphor too far. Duct typing is about presenting a > certain interface. If your function takes an object that has a get(key, > default) method, the rest doesn't matter. That's the only wa

Re: [Python-ideas] Exploiting type-homogeneity in list.sort() (again!)

2017-03-08 Thread Barry
e and the sort is completed with the unoptimised code. Is that sematically clean? Barry > On 8 Mar 2017, at 17:08, Erik wrote: > >> On 08/03/17 11:07, Steven D'Aprano wrote: >> I mentioned earlier that I have code which has to track the type of list >> items, and s

Re: [Python-ideas] Adding an 'errors' argument to print

2017-03-27 Thread Barry
I took to using chcp 65001 This puts cmd.exe into unicode mode. Of course the python 3.6 make this uneccesary i understand. Barry > On 24 Mar 2017, at 15:41, Ryan Gonzalez wrote: > > Recently, I was working on a Windows GUI application that ends up running > ffmpeg, and

Re: [Python-ideas] ImportError raised for a circular import

2017-06-13 Thread Barry
n C++). Really? It has always been a strong sign of a design bug in all the cases I have ever seen. The example you suggest always fails when I accidentally write it. Pylint will certainly shout loud that this case is an error. Barry > > 2017-06-13 20:30 GMT+02:00 Barry Scott : >&g

Re: [Python-ideas] HTTP compression support for http.server

2017-08-05 Thread Barry
Does you code allow suporting more then gzip? For example Brotli compression is becoming inmportant for some web apps. Barry > On 24 Jul 2017, at 17:30, Chris Angelico wrote: > >> On Tue, Jul 25, 2017 at 2:20 AM, Chris Barker wrote: >> On Thu, Jul 20, 2017 at 12:15

Re: [Python-ideas] PEP 550 v2

2017-08-20 Thread Barry
I'm not clear why there is a new_context_key which seems not to be a key. It seems that the object is a container for a single value. Key.set( value ) does not feel right. Container.set( value ) is fine. Barry > On 16 Aug 2017, at 00:55, Yury Selivanov wrote: > > Hi, > >

Re: [Python-ideas] a sorting protocol dunder method?

2017-12-04 Thread Barry
> On 4 Dec 2017, at 20:12, Antoine Pitrou wrote: > > On Mon, 4 Dec 2017 19:37:02 +0000 > Barry Scott wrote: >> I wondered what the performance would be and tested the following code: >> > [...] >> >> it outputs this for my with python 3.6.0 >>

Re: [Python-ideas] Repr of lambda

2017-12-21 Thread Barry
a regression in my eyes. Maybe what you would like to have is an explain function that given any object tells you alll about it. help function does some of this I guess. Barry ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.o

Re: [Python-ideas] Add an UML class diagram to the collections.abc module documentation

2018-01-02 Thread Barry
After reading this thread I went off and read up about plantuml. According to its docs it produces dot files that it reandes with graphviz. So if graphviz will produce svg that part is solved. Can you creat the plantuml file automatically from the python code? Barry On 2 Jan 2018, at 15:26

Re: [Python-ideas] Add an UML class diagram to the collections.abc module documentation

2018-01-02 Thread Barry
uml.com/ I don't see any open source > code to guarantee > it will be available in e.g. 5 years. (I really just see a lot of ads around > a free Java app). I see fedora packages plantuml and says is lgpl3 licensed. Barry > >> Graphviz dot is interesting, but it doesn&#

Re: [Python-ideas] Why CPython is still behind in performance for some widely used patterns ?

2018-02-20 Thread Barry
bind11, which I've never played with). Perhaps you can >> open an issue about that? > > We mention them in the Extending & Embedding guide, and link out to > the page on packaging.python.org that describes them in more detail: > https://docs.python.org/3/extending/ind

Re: [Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations

2018-03-14 Thread Barry
ause of __fspath__ conversions pathlib can be use with any function that needs a path. So long as shutil is Pathlib friendly isn’t this asolv d problem? No need to extend pathlib for every file op, just pass the existed file ops a Path. Wasn’t this discussed at the time fspath was added?

Re: [Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations -- version 2

2018-03-17 Thread Barry
ess it does not belong here. > > * shutil.copyfile > > * shutil.copymode > > * shutil.copystat > > * shutil.copy > > * shutil.copy2 > > * shutil.copytree with shutil.ignore_patterns > > * shutil.move > > * sh

Re: [Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations -- version 2

2018-03-18 Thread Barry
> On 17 Mar 2018, at 22:49, George Fischhof wrote: > > > > 2018. márc. 17. 21:34 ezt írta ("Barry" ): > > >> On 17 Mar 2018, at 10:42, George Fischhof wrote: >> >> Hi folks, >> >> I added the list of func

Re: [Python-ideas] Add shutil.chown(..., recursive=False)

2018-05-28 Thread Barry
s? I wonder if it is very common. Don’t you have to be root or use sudo chown? In which case it is only python code running as root that could use this. Barry > > -- > Giampaolo - http://grodola.blogspot.com > > ___ > Python-ideas

Re: [Python-ideas] Calling python from C completely statically

2018-07-10 Thread Barry
rom C. > Am I missing something? You need to grab the sources with an svn checkout. I guess you grabbed the binary kit. https://sourceforge.net/p/meinc-installer/code/HEAD/tree/trunk/MEINC_Installer/ Docs are in here. https://sourceforge.net/p/meinc-installer/code/HEAD/tree/trunk/MEINC_Install

Re: [Python-ideas] Calling python from C completely statically

2018-07-10 Thread Barry
> On 10 Jul 2018, at 19:12, Alberto Garcia wrote: > > Thank you Barry, > > but I see that the the way yo do it is dropping files to disk. I want to > prevent any file to touch the disk except for the actual binary that has > everything embedded in it. What file are you

Re: [Python-ideas] The future of Python parallelism. The GIL. Subinterpreters. Actors.

2018-07-17 Thread Barry
I are pursuing an approach that extends the > existing ceval "pending call" machinery currently used for handling > signals (see Py_AddPendingCall). The new [*private*] API would work > the same way but on a per-interpreter basis rather than just the main > interpreter. This w

Re: [Python-ideas] The future of Python parallelism. The GIL. Subinterpreters. Actors.

2018-07-18 Thread Barry
>> On 17 Jul 2018, at 21:00, Eric Snow wrote: >> >> On Tue, Jul 17, 2018 at 1:44 PM Barry wrote: >> The decrement itself is not the problem, that can be made thread safe. > > Yeah, by using the GIL. Otherwise, please elaborate. My > understanding is that

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Barry
; at the top of a module At worst, replace > instances of "re" with "regex". Stay away from the new features, and > it's highly compatible with Python;s re. I suspect that like me what was meant is that checkout means read the docs to understand regex features. The ins

[Python-ideas] Re: shutil.copyfileobj to return number of bytes copied

2022-03-02 Thread Barry
use, some don’t, > and .tell() is not guaranteed to measure the number of bytes, it could > measure with other units. Can you use os.fstat() on one of the file objects? Can you write a helper that gets the size from the object that do not have tell()? Barry > > I don’t think chang

[Python-ideas] Re: suprocess.check_call and friends include STDERR in error message

2022-03-09 Thread Barry
; ``` > ping: github.com2: Temporary failure in name resolution > ``` I think you are saying you can do what you want with subprocess.run(). What did you need a change to support? I often wrap code around subprocess.run() to get the exact behaviour that I need. Seems to work well. Bar

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

2022-03-27 Thread Barry
lass by using the mro to find the one class. Barry ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message a

[Python-ideas] Re: default as a keyword argument for dict.get and dict.pop

2022-06-08 Thread Barry
ay also be a performance issue with keyword arguments vs. positional. >> People are touchy when it comes to dicts! >> >> Eric > True (and rightly so). But all that is required is that there is no > significant slow-down when the positional argument is used. > Does th

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

2022-06-23 Thread Barry
> On 23 Jun 2022, at 08:27, Stephen J. Turnbull > wrote: > > Barry Scott writes: > >> I can think of ways to implement evaluation-on-reference, but they >> all have the effect of making python slower. > > Probably. > >> The simple >> >&

[Python-ideas] Re: Add copy to pathlib

2022-10-18 Thread Barry
if move is in pathlib then copy makes sense. As with all things pathlib it is a reasonable question to ask where should additions stop. Barry > > ChrisA > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe

[Python-ideas] Re: Add mechanism to check if a path is a junction (for Windows)

2022-11-08 Thread Barry
On 8 Nov 2022, at 17:56, Charles Machalow wrote:I would argue that just because it was easy for one to implement doesn't mean it's easy for others. That is true of so many things in life!I would have had no idea how to implement this without extra Googling and confusion.Having the abstraction mak

[Python-ideas] Re: Better (?) PRNG

2022-11-14 Thread Barry
hat results did you get? How does your PRNG compare to what python already has? Without that this analysis this will be unlikely to be considered as a candidate for python stdlib. Barry > > I remain a fan, > > James Johnson > > __

[Python-ideas] Re: Enhancing variable scope control

2022-11-30 Thread Barry
# <== or whatever syntax makes sense > global TheirCount > for MyCount in range(0,TheirCount): > local: > for YourCount in range(0,TheirCount) > pass > > This would also be useful wit

[Python-ideas] Re: Nonuniform PRNG?

2022-12-07 Thread Barry
On 7 Dec 2022, at 19:45, James Johnson wrote:How do I join the “regular” Python list? I’m not academically qualified for python ideasTry out https://discuss.python.org that has lots going on.BarryOn Wed, Dec 7, 2022 at 10:05 AM David Lowry-Duda wrote:I'm very sorry, I didn't

[Python-ideas] Re: Proposal: -X importcache to supplement -X importtime for loaded modules

2023-02-14 Thread Barry
Try raising on https://discuss.python.org/ where you are more likely to have a python core dev comment on this idea. Barry > On 14 Feb 2023, at 15:12, anthony.flury via Python-ideas > wrote: > >  > Personally, > I am -1 on the name - I think '-X importtrace'

[Python-ideas] Re: Deprecate misleading escapes in strings

2023-02-16 Thread Barry
t; and "\4" though, just to make my opinion clear). > If going the whole hog, the 2015 'Make non-meaningful backslashes > illegal in string literals' thread[3] could be revived as well, maybe > even with "\f\v" deprecated, "\e" = "\33&

[Python-ideas] Re: Deprecate misleading escapes in strings

2023-02-17 Thread Barry
On 16 Feb 2023, at 19:45, Ben Rudiak-Gould wrote:On Thu, Feb 16, 2023 at 8:09 AM Barry <ba...@barrys-emacs.org> wrote:This is valid and does not match your rules. ‘\x9b’ that is the ANSI CSI in 8-bit. In 7-bit it is ‘\x1b[‘.Shouldn't that be b‘\x9b’? No. I can work in unicode internal

[Python-ideas] Re: join() could add separators at start or end

2023-03-10 Thread Barry
> On 9 Mar 2023, at 00:37, Rob Cliffe via Python-ideas > wrote: > > Having had my last proposal shot down in flames, up I bob with another. 😁 See this discussion that has a nice solution proposed with the concat function. Barry > It seems to me that it would be useful to

[Python-ideas] Re: Make decorator-based context managers reentrant

2023-03-30 Thread Barry
> On 30 Mar 2023, at 08:10, Tobias Bengfort wrote: > > Hi, > > I was wondering why decorator-based context managers are not reentrant or > even reusable. Do you mean this use of reentrant? https://en.wikipedia.org/wiki/Reentrancy_(computing) > > They could be made reusable by initializi

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

2023-04-10 Thread Barry
stion is: would enough people benefit from this to add the feature to CPython?A PR that has an implementation might push this forward.I wonder if in the C code of -c treating a string that starts with \n could trigger the dedent?BarryOn Sun, Apr 9, 2023 at 4:09 PM Barry Scott <ba...@barry

[Python-ideas] Re: XDG Directory Support for PDB

2023-04-18 Thread Barry
rcPath = > os.path.expanduser(os.path.expandvars(rcFileName)) >+try: >+with open(rcPath, encoding='utf-8') as rcFile: >+self.rcLines.extend(rcFile) >+ except OSError: &g

[Python-ideas] Re: XDG Directory Support for PDB

2023-04-20 Thread Barry
DLE.Probably, but lets start the discussion somewhere!Best regards,GustafDen ons 19 apr. 2023 kl 17:11 skrev turnbull <turnb...@sk.tsukuba.ac.jp>:I apologize for the top-post and awkward trimming, my employer just switched to o365 and won't accomodate my existing mail client so I'm s

[Python-ideas] Re: XDG Directory Support for PDB

2023-04-20 Thread Barry
itThen ./.gdbinit is loaded if . Is not ~/And you need different logic for macOS.Anyways, I'll prep a pull-request for the cpython repo, should be interestingto see what comes up.Best regards,GustafDen tors 20 apr. 2023 kl 17:05 skrev Barry <ba...@barrys-emacs.org>:On 20 Apr 2023,

[Python-ideas] Re: XDG Directory Support for PDB

2023-04-20 Thread Barry
, I'll prep a pull-request for the cpython repo, should be interestingto see what comes up.Best regards,GustafDen tors 20 apr. 2023 kl 17:05 skrev Barry <ba...@barrys-emacs.org>:On 20 Apr 2023, at 14:24, Gustaf Waldemarson <gustaf.waldemar...@gmail.com> wrote:Interesting, are you both

[Python-ideas] Re: Thoughts on allowing Path objects in shlex.join

2023-05-13 Thread Barry
> > I'm curious to hear more opinions on this though, since I'm guessing there > may be very valid reasons that others have for not wanting to move in this > direction that I'm totally oblivious to. > > Thanks all! > > > Issue 89283: https://gi

[Python-ideas] Re: Mark a set of keys of a TypedDict as incompatible

2023-05-17 Thread Barry
On 17 May 2023, at 14:16, Sync In wrote:I have a couple of {{{TypedDict}}}s for use in type hinting that are supposed to have some sets of incompatible keys.For example, if I need to specify that a particular {{{dict}}} can have {{{bar}}} or {{{baz}}} but not both of them, I can write two {{{Type

[Python-ideas] Re: Add a .whitespace property to module unicodedata

2023-06-02 Thread Barry
> On 1 Jun 2023, at 19:10, David Mertz, Ph.D. wrote: > > %time unicode_whitespace = [chr(c) for c in range(0x) if > unicodedata.category(chr(c)) == "Zs"] Try 0x10 to get all of unicode. Barry ___ Python-ideas mailin

[Python-ideas] Re: Warn when iterating over an already exhausted generator

2023-06-12 Thread Barry
ug that an iterator is empty. For example this pattern: args = iter(sys.argv) progname = next(args) mandatory_arg = next(args) for arg in args: print(‘optional arg’, next(arg)) Your proposal will traceback for the for loop if there are no optional args. Barry __

[Python-ideas] Re: Proposal for get_or function in Python dictionaries

2023-07-16 Thread Barry
On 15 Jul 2023, at 23:14, Dom Grigonis wrote:I am well aware of that.I just argue that it is not very pleasant to read.Personally, I am not a big user of it.C’s although maybe doesn’t have words to read, but is much more pleasant in both conciseness and logical sequence.Maybe it is not a big issu

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

2020-12-22 Thread Barry Scott
utf-8. I tested the above with Windows Terminal 1.4 on Windows 10 and it just works. Otherwise os.system('cls') works for windows terminal and the old windows console stuff. Barry ___ Python-ideas mailing list -- python-ideas@python.org To unsub

[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
standard library, isn't it? I have used rename to make a new file appear atomically after it is closed and I have used fsync to ensure records are on disk before a file is closed. I've not needed fsync on close yet. What is the use case that needs this? Without

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

2021-01-14 Thread Barry Scott
wiki/Naan <https://en.wikipedia.org/wiki/Naan> bread. Nice to know that there are well tested web sites out there. Do you recall seeing sites in 2000 that showed the year date as: 06-01- 19100 Barry > > with best regards > > Jonathan > __

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

2021-01-16 Thread Barry Scott
stall with `pip` prior to building. > Will be installed for each version of python available in > `/opt/python/`. At least with Centos 8 and fedora its /usr that python and its libs are installed into not /opt. Are you thinking of SCL here? Barry ___ P

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

2021-01-23 Thread Barry Scott
the functions purpose is to open unicode text use a name that reflects that it is the encoding that is set not the mode (binary vs. text). open_unicode maybe? If you are teaching open_text then do you also need to have open_binary? Barry > > > -- > Steve >

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

2021-02-01 Thread Barry Scott
e system default there but each user needs to have a file that they can control to set the per user config. py.exe uses %LOCALAPPDATA%\py.ini I'd suggest that you could have a %LOCALAPPDATA%\python.ini. Barry ___ Python-ideas mailing list -- python-

[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-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-04 Thread Barry Scott
of working on web page content that did not decode not because I'm a .NET developer. I raise this as this seems to be the same problem that python faces with system locale conflicting with the wider world using utf-8. Barry ___ Python-ideas mai

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

2021-02-04 Thread Barry Scott
s that I edit to configure python then registry keys. I can put files into git, not exmple. I have to work hard to manage registry keys via git. Barry ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-

[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
ception? I'm -1 on that as its confusing. Having checked that its python code and not a C extension function you could use the info in fn.__code__ to get the filename and line of where the function is defined and put that info into the exception. Example of the info: |

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

2021-02-24 Thread Barry Scott
> you want it to be an operator? Python implements more then 2 of them: True False not and or https://en.wikipedia.org/wiki/Boolean_algebras_canonically_defined#Truth_tables Barry ___ Python-ideas mailing list -- python-ideas@python.org To unsub

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

2021-02-25 Thread Barry Scott
issue. Each function runs to completion uninterrupted. There are no data races. Each time a async function runs it can know that the state of the objects it uses will not be changed while it is running. Barry > > Yves > ___ > Pytho

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

2021-02-25 Thread Barry Scott
completes and its callback is run. Barry > > Recently, I had to implement a barier myself for our use case. See code below: > > It is simple to implement, but I too would like to have one for asyncio, in > order to be consistent with the concurrency primitives we have for threa

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

2021-02-26 Thread Barry Scott
> On 26 Feb 2021, at 08:31, Jonathan Slenders wrote: > > Barry, > > What you describe sounds like `asyncio.gather(...)` if I understand correctly. > > The thing with a Barier is that it's usable in situations where we don't know > the other tasks. Maybe

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

2021-03-02 Thread Barry Scott
same as, or would be the bytearray, >>>> type(a"\x00\x01\x02abcÿ") > When I needed to do the creation of bytes objects from a mix of types the struct.pack() method has been the obvious way to go. What is the use case that leads to needing the above? Barry > _

[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-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 c

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

2021-05-10 Thread Barry Scott
w.youtube.com/watch?v=5jbG7UKT1l4 Given this is very old information I think the first thing needed is to reproduce David's experiments and see if the 3.10 implementation has the same issues. Have you done this already? If you turn these slides into benchmark code that wo

[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

  1   2   3   4   >