[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-09-29 Thread Bar Harel
ule's docs, and is exactly what this idea is all about. My question is why? Was there an objection for implementing such a thing, or was it complex enough to postpone for the time being? On Tue, Sep 29, 2020 at 2:51 PM Bar Harel wrote: > I think it can be easily solved much like a normal bug fix -

[Python-ideas] Re: Trouble with "decorator mixins" and ABCs

2020-09-29 Thread Bar Harel
thods were defined dynamically. Plus it'll support dynamic __getattr__ on a child metaclass as an added bonus. Bar Harel. On Thu, Sep 24, 2020, 7:28 PM Ben Avrahami wrote: > > > On Thu, Sep 24, 2020 at 7:02 PM Eric V. Smith wrote: > >> Does anyone know if attrs handles this? I

[Python-ideas] Re: keyword arguments before positional arguments- syntax inconsistency

2020-08-25 Thread Bar Harel
I've found a note about this from Guido back in 2000: https://mail.python.org/archives/list/python-...@python.org/thread/BIAEXJPSO4ZSUAEKYHGHSOIULSMV3CYK/#HURE3EIQLNHVSMTUSUHGCQF5IGIN7XVE Not sure if it went anywhere back then. On Tue, Aug 25, 2020 at 4:27 PM Ben Avrahami wrote: > consider the

[Python-ideas] Re: giving set.add a return value

2020-06-27 Thread Bar Harel
> > Given dict.setdefault, a parallel method like set.add_unique, which > returns the existing element or None, might be the better approach. > Although it breaks the convention of these methods returning the item, I'm not sure returning the element is a good idea. "set.add_unique(None)" will

[Python-ideas] Re: giving set.add a return value

2020-06-25 Thread Bar Harel
I believe I'm -0 for modifying the existing add() and +0 for a new function. By the way, a good phrasing of the general mutating/non-mutating convention opens the built-in types section of the docs: "Some collection classes are mutable. The methods that add, subtract, or rearrange their members

[Python-ideas] Re: JSON Serializing UUID objects

2020-06-10 Thread Bar Harel
Since there's no standard for this in json, deciding to serialize to str is quite arbitrary. I personally serialize UUIDs to binary data as it takes less space. Some serialize it to hexadecimal. Tbh, it sounds like a good idea but can have it's pitfalls. On Wed, Jun 10, 2020, 4:43 PM J. Pic

[Python-ideas] Re: PYTHONLOGGING env variable

2020-06-10 Thread Bar Harel
> > But if the libraries are already doing logging, can't I already do that? > > And if the libraries aren't doing logging, this won't magically add > logging to them, will it? > As a best practice, libraries log into a NullHandler to avoid setting up the root logger, and to prevent sending

[Python-ideas] Re: PYTHONLOGGING env variable

2020-06-06 Thread Bar Harel
It's one thing to say that the interpreter takes care of importing logging and setting up a basic logger, and that's great, but I still have to import logging and call the `logging.info(...)` functions, so what does this proposal give us, *in detail* please, and how do I use it? You would be

[Python-ideas] Re: PYTHONLOGGING env variable

2020-06-05 Thread Bar Harel
with obscure error messages, you're welcome to give it a go :-) Thank you for being awesome! Bar Harel On Sat, Jun 6, 2020 at 1:40 AM wrote: > Did this idea ever went anywhere? I thought I saw a bpo issue for this but > I can't find it anymore and it's not present in 3.8 or 3.9 NEWS nor in &g

[Python-ideas] Re: Instance method to test equivalence between set and iterable

2020-03-22 Thread Bar Harel
Hey Steve, How about set.symmetric_difference()? Does it not do what you want? Best regards, Bar Harel On Sun, Mar 22, 2020, 10:03 PM Steve Jorgensen wrote: > Currently, the `issubset` and `issuperset` methods of set objects accept > arbitrary iterables as arguments. An iterable that i

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-21 Thread Bar Harel
Last resort logger works only if no handlers are set. NullHandler for example is used on most libraries in order to prevent setting up the logging system, but it can cause errors not to show. Also, LastResort is set for the "Warning" level. -L will give you the flexibility you need in order to

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-21 Thread Bar Harel
-L will act as logging.basicConfig(level=level), but on a temporary basis, much like -W sets warning's filters. If you don't setup logging, or don't want to (cause you're checking some library functions), this will be super handy. If you do setup logging, it has the same caveats as setting the

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-20 Thread Bar Harel
> > > If you want it only temporarily for debugging purposes, or permanently > for all scripts in your system, it's not really feasible. > > Hmm, I'm not sure that I like the idea of overriding the default logging > level being set system-wide, or that there would be an especially strong > use

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-19 Thread Bar Harel
son why the above doesn't work for you? Otherwise, I >> see no reason to add a new environment variable that effectively does the >> same thing. >> >> >> On Wed, Feb 19, 2020 at 8:16 PM Bar Harel wrote: >> >>> Another idea I've had that may be of use: &

[Python-ideas] PYTHONLOGGING env variable

2020-02-19 Thread Bar Harel
. Will be useful mostly for debugging purposes instead of temporarily modifying the code. Kinda surprised it doesn't exist tbh. Bar Harel ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Global thread executor

2020-02-15 Thread Bar Harel
ons are eventually up for discussion. I'm just a single developer with a small perspective, and don't pretend to know the answer :-) Perhaps more devs will weigh in and give their opinion. Always happy to learn, Bar Harel. ___ Python-ideas mai

[Python-ideas] Global thread executor

2020-02-15 Thread Bar Harel
it irresponsibly (shame), we still have future.result(timeout) to cover us and issue a warning if we must. Any inputs would be appreciated, Bar Harel. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le

[Python-ideas] Re: New syntax for decorators that are compatible with both normal and async functions

2020-02-10 Thread Bar Harel
and function calls to await. This creates a lot of work, from porting code to maintaining both variants, to just having code duplication all around. Not necessarily using this syntax, a way for making decorators support both normal and async, could be a first step towards shared codebase. -- Bar

[Python-ideas] Re: Copying a multiple values of a dict to another with a lot easier syntax

2019-10-21 Thread Bar Harel
the problem, makes sense, we can even implement an itemsetter much like itemgetter for completeness, as the implementation will probably be easy and well understood. What do you say? -- Bar Harel On Tue, Oct 22, 2019, 3:25 AM Kyle Lahnakoski wrote: > > On 2019-10-21 10:44, gedizgu...@gmail.com

[Python-ideas] Re: Add a "block" option to Executor.submit

2019-09-04 Thread Bar Harel
the signature of the executor creation to have a new 'max_queue' keyword-only argument, or allow you to enter the queue as an input, but I still believe that any attempt to create such an interface will just cause more complications than the simple 3 line solution. -- Bar Harel On Thu, Sep 5

[Python-ideas] Re: Add a "block" option to Executor.submit

2019-09-04 Thread Bar Harel
On Wed, Sep 4, 2019, 10:40 PM Dan Sommers < 2qdxy4rzwzuui...@potatochowder.com> wrote: > I'm sure I'm missing something, but isn't that the point of a > ThreadPoolExecutor? Yes, you can submit more requests than you > have resources to execute concurrently, but the executor itself > limits the

[Python-ideas] Re: Add a "block" option to Executor.submit

2019-09-04 Thread Bar Harel
t kind of asynchronous work you do. Why change it? Sincerely, Bar Harel ___ 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 ar

[Python-ideas] Re: asyncio: futures and tasks with synchronous callbacks

2019-07-31 Thread Bar Harel
Aren't you able to catch the cancellation error and retrieve the data from the inner task's .result()? On Wed, Jul 31, 2019, 8:00 AM Guido van Rossum wrote: > I wonder if Nathaniel has something to add? Trio has a different approayto > cancellation. Of course it is also an entirely new

Re: [Python-ideas] Descouraging the implicit string concatenation

2018-03-14 Thread Bar Harel
I'm with Steven D`Aprano here. Implicit string concat, in my experience, is something clear, concise and convenient. I've had a bug because of it only once or twice during my whole career, and not only that "occasional" bug would have occurred either way because of a missing comma or plus sign,

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-26 Thread Bar Harel
I have a simple way to solve this I believe. Why not just expose "_chain_future()" from asyncio/futures.py to the public, instead of copying and pasting parts of it? It already works, being used everywhere in the stdlib, it supports both asyncio and concurrent.futures, it's an easily testable

Re: [Python-ideas] Adding "View Python 3 Documentation" to all Python 2 documentation URLs

2017-09-06 Thread Bar Harel
A bit radical but do you believe we can contact Google to alter the search results? It's for the benefit of the user after all, and many just switch to python 3 in the version picker anyway. On Thu, Sep 7, 2017, 4:18 AM Guido van Rossum wrote: > That's a good idea. Could you

Re: [Python-ideas] singledispatch for instance methods

2017-05-14 Thread Bar Harel
bout > personally, and some of us sometimes volunteer to mentor users who show an > interest in learning. IMO posting "bump" several times does not exhibit > such interest. > > On Sun, May 14, 2017 at 9:37 AM, Bar Harel <bzvi7...@gmail.com> wrote: > >> I guess so.

Re: [Python-ideas] singledispatch for instance methods

2017-05-14 Thread Bar Harel
nk the process of adopting something into the >> stdlib works? Just posting "bump" messages to the mailing list doesn't >> really help, it just sounds rude.If you need help understanding how to >> add/improve a stdlib module, please ask a specific about that topic. >> >

Re: [Python-ideas] singledispatch for instance methods

2017-05-14 Thread Bar Harel
Bump On Wed, Jan 4, 2017, 8:01 PM Lisa Roach <lisaroac...@gmail.com> wrote: > +1 to this as well, I think this would be really useful in the stdlib. > > On Mon, Dec 26, 2016 at 5:40 AM, Bar Harel <bzvi7...@gmail.com> wrote: > >> Any updates with a singledispatch for

Re: [Python-ideas] singledispatch for instance methods

2016-12-26 Thread Bar Harel
Any updates with a singledispatch for methods? On Tue, Sep 20, 2016, 5:49 PM Bar Harel <bzvi7...@gmail.com> wrote: > At last! Haven't used single dispatch exactly because of that. Thank you > savior! > +1 > > On Tue, Sep 20, 2016, 6:03 AM Tim Mitchell <tim.mitch...

Re: [Python-ideas] singledispatch for instance methods

2016-09-20 Thread Bar Harel
At last! Haven't used single dispatch exactly because of that. Thank you savior! +1 On Tue, Sep 20, 2016, 6:03 AM Tim Mitchell wrote: > Hi All, > > We have a modified version of singledispatch at work which works for > methods as well as functions. We have