MAINT: Move set_module from numpy.core to numpy._utils#22619
MAINT: Move set_module from numpy.core to numpy._utils#22619mattip merged 4 commits intonumpy:mainfrom
Conversation
046ad0b to
aecfc90
Compare
|
Note that I have not changed imports that are using |
aecfc90 to
6527812
Compare
6527812 to
7c36142
Compare
|
Maybe make this |
|
Yeah, I wanted to put it somewhere deeper, and I don't quite love this either (so happy for other ideas even duplicating the helper). |
|
I guess |
|
Ahh, could we have a |
|
Yeah, a submodule/folder make sense, how about being super clear, like
|
I am bad with names. We are looking for a place to put things with no dependencies. Do we want to definitely restrict ourselves to pure-python modules or can we also put some simple no-dependency c-extension module in the future? I think I prefer something in the direction of |
Note that unfortunately, compat does expose _inspect as well, so the import remains (just the definition place moves).
|
Hmmm, yeah, i don't the name Created a module, left |
| """ | ||
| from . import _inspect | ||
|
|
||
| from .._utils import _inspect |
There was a problem hiding this comment.
Is this line required?
Ahh, I see, yes it is.
|
I will put this in soon if there are no further comments |
|
Thanks @seberg |
Note sure if others agree, this creates a
numpy._utilsmodule, becausenumpy.corealready imports the C stuff.The reason was that I wanted to use
set_modulewhen moving exceptions (since they currently have that). Butset_modulebeing defined inoverridesneeds C to be imported.So I thought, maybe we actually need a place to put things that don't need depend on anything else to avoid circular imports...
If nobody else likes the idea, I am happy to close and just use
object.__module__ = "numpy", or put it elsewhere (but I didn't have a good idea for that).