Re: [Python-ideas] Preemptive multitasking and asyncio

2018-01-24 Thread Thomas Güttler
Am 24.01.2018 um 17:59 schrieb Steven D'Aprano: On Wed, Jan 24, 2018 at 05:46:29PM +0100, Thomas Güttler wrote: I found a question and answer at Stackoverflow[1] which says that asyncio/await is like cooperative multitasking. My whish is to have preemptive multitasking: The interpreter does

Re: [Python-ideas] Dataclasses, keyword args, and inheritance

2018-01-24 Thread George Leslie-Waksman
It may be possible but it makes for pretty leaky abstractions and it's unclear what that custom __init__ should look like. How am I supposed to know what the replacement for default_factory is? Moreover, suppose I want one base class with an optional argument and a half dozen subclasses each with

Re: [Python-ideas] Non-intrusive debug logging

2018-01-24 Thread Steve Barnes
On 24/01/2018 23:25, Larry Yaeger wrote: > Everyone uses logging during code development to help in debugging. Whether > using a logging module or plain old print statements, this usually requires > introducing one or (many) more lines of code into the model being worked on, > making the

[Python-ideas] Non-intrusive debug logging

2018-01-24 Thread Larry Yaeger
Everyone uses logging during code development to help in debugging. Whether using a logging module or plain old print statements, this usually requires introducing one or (many) more lines of code into the model being worked on, making the existing, functional code more difficult to read. It

Re: [Python-ideas] Dataclasses, keyword args, and inheritance

2018-01-24 Thread Ivan Levkivskyi
It is possible to pass init=False to the decorator on the subclass (and supply your own custom __init__, if necessary): @dataclass class Foo: some_default: dict = field(default_factory=dict) @dataclass(init=False) # This works class Bar(Foo): other_field: int -- Ivan On 23 January

Re: [Python-ideas] Preemptive multitasking and asyncio

2018-01-24 Thread Nick Timkovich
If I'm understanding correctly, the interpreter already does this with threads. About every 15 milliseconds the interpreter will stop a thread and see if there are any others to work on, see "Grok the GIL," blog: https://emptysqua.re/blog/grok-the-gil-fast-thread-safe-python/ or the PyCon talk:

Re: [Python-ideas] Preemptive multitasking and asyncio

2018-01-24 Thread Steven D'Aprano
On Wed, Jan 24, 2018 at 05:46:29PM +0100, Thomas Güttler wrote: > I found a question and answer at Stackoverflow[1] which says > that asyncio/await is like cooperative multitasking. > > My whish is to have preemptive multitasking: The interpreter > does the yielding. Isn't that what threading

Re: [Python-ideas] Preemptive multitasking and asyncio

2018-01-24 Thread Chris Angelico
On Thu, Jan 25, 2018 at 3:46 AM, Thomas Güttler wrote: > I found a question and answer at Stackoverflow[1] which says > that asyncio/await is like cooperative multitasking. "Like"? It *is* a form of co-operative multitasking. > My whish is to have preemptive

[Python-ideas] Preemptive multitasking and asyncio

2018-01-24 Thread Thomas Güttler
I found a question and answer at Stackoverflow[1] which says that asyncio/await is like cooperative multitasking. My whish is to have preemptive multitasking: The interpreter does the yielding. The software developer does not need to insert async/await keywords into its source code any more.