Modify define_function_handling_dict_from_class to inject function to module directly - #4752
Modify define_function_handling_dict_from_class to inject function to module directly#4752alejoe91 wants to merge 1 commit into
define_function_handling_dict_from_class to inject function to module directly#4752Conversation
…ion to module directly
| import zarr | ||
|
|
||
|
|
||
| def define_function_handling_dict_from_class(source_class, name): |
There was a problem hiding this comment.
rename register_* instead
|
Sorry it took me a while to get to this! I was on vacation :) I looked up
It's probably safe to assume that the vast majority of users are running Python, but I don't know that for a fact, and it does make me leery. I do see the rationale behind this trick, though. I think there might be a better solution than |
Having something like:
extends the function to work with individual recordings and dicts of. The function signature and name are set to match the class and provided
name. This could cause mismatches in the naming.This PR uses a trick to add the new wrapped function directly to the caller module.
Related to #4319 : I suggest we do the same for
define_funtction_from_class(already 2 mismatches found!!!) and use thepyiapproach that Graham suggested to make IDEs happy.@chrishalcrow @grahamfindlay thoughts?