Closed maxschmitt closed 4 months ago
Looks like this should be easy to implement. Basically, interface.process_index(..., process_func_args={...})
could temporarily overwrite the arguments provided when initializing the interface.
Sounds good and would help to reduce code lines or global
variables in some scripts.
Would you expect that interface.process_index(..., process_func_args={...})
overwrites interafce.process_func_args
and in following calls to the method it will use the new args, or should it only temporarily change them, and when calling the method again with process_func_args=None
it uses the ones set when instantiating the interface
object?
BTW, as a workaround you can already overwrite interface.process_func_args
before calling interface.process_*()
.
But this is not completely error free as under the hood we need to handle the special arguments idx
, root
, file
if those are part of process_func()
. So it seems we indeed should add a process_func_args
argument to all the process_*()
methods.
Would you expect that
interface.process_index(..., process_func_args={...})
overwritesinterafce.process_func_args
and in following calls to the method it will use the new args, or should it only temporarily change them, and when calling the method again withprocess_func_args=None
it uses the ones set when instantiating theinterface
object?
The latter, this should be only a temporary overwrite.
BTW, as a workaround you can already overwrite
interface.process_func_args
before callinginterface.process_*()
. But this is not completely error free as under the hood we need to handle the special argumentsidx
,root
,file
if those are part ofprocess_func()
. So it seems we indeed should add aprocess_func_args
argument to all theprocess_*()
methods.
Yes, from my layman's perspective, this is the better solution, I think.
Changing temporarily in process_()
might become an issue when calling it in parallel on different indexes, but this might be prevented by, e.g., blocking so that no other process_()
can be run.
If the behavior of the processing function can be controlled by arguments, it would be favorable to have an argument
process_func_args
also in.process_index()
,.process_folder()
etc.The advantage might not become clear with this simple example, but consider a case where different processing functions are defined and corresponding
audinterface
objects are passed to other functions, where different indexes are processed with differentprocess_func_args
.@hagenw