Unable to inherit AioProcess
Executing the following code
from aioprocessing import AioProcess
class MyProcessClass(AioProcess):
pass
results in the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: function() argument 1 must be code, not str
I uh... expect to easily be able to override how a class works & his internal functions
Use from aioprocessing.process import AioProcess instead. aioprocessing mirrors the multiprocessing library here - the objects exposed from the top-level module namespace are functions, not classes. The actual class is in a sub-module.
Tue, 07 Sep 2021 10:22:16 -0700 dano @.***>:
Use
from aioprocessing.process import AioProcessinstead.aioprocessingmirrors themultiprocessinglibrary here - the objects exposed from the top-level module namespace are functions, not classes. The actual class is in a sub-module.
I got your intentions, but you see, class inheritance from multiprocessing works in this way too (tested on latest version and even on cpython alpha)
@TanyaEleventhGoddess Ah, looks like the implementation of multiprocessing has changed since I created aioprocessing, and no longer uses functions for the top-level imports. In any case, aioprocessing still does use functions, so just use from aioprocessing.process import AioProcess for now.
I'll leave this open for now, I'm not sure it's worth the effort to refactor the library to match what multiprocessing is doing now, but I should at least document the unusual "function instead of class" behavior.
Wed, 08 Sep 2021 07:43:26 -0700 dano @.***>:
@TanyaEleventhGoddess Ah, looks like the implementation of
multiprocessinghas changed since I createdaioprocessing, and no longer uses functions for the top-level imports. In any case,aioprocessingstill does use functions, so just usefrom aioprocessing.process import AioProcessfor now.I'll leave this open for now, I'm not sure it's worth the effort to refactor the library to match what multiprocessing is doing now, but I should at least document the unusual "function instead of class" behavior.
I may be willing to do that, along with proper inheritance support and ability of overriding internal functions, and async coroutines support in child processes, but I'd prefer some help in doing that. What's your opinion?