Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate from numpy import * #13525

Closed
eric-wieser opened this issue May 11, 2019 · 5 comments
Closed

Deprecate from numpy import * #13525

eric-wieser opened this issue May 11, 2019 · 5 comments

Comments

@eric-wieser
Copy link
Member

eric-wieser commented May 11, 2019

An idea for numpy/__init__.py:

if sys.version_info[:2] >= (3, 7):
    __all__ += ['__don_t_do_this']

    def __getattr__(attr):
        if attr == '__don_t_do_this':
            warning.warn("Don't do this')
            return None
        raise AttributeError
@chhanganivarun
Copy link

But why?

@mhvk
Copy link
Contributor

mhvk commented May 16, 2019

Until python itself starts to do this, I don't think we should enforce this.

@rgommers
Copy link
Member

Agreed. This will breaks a huge amount of code, just to teach better habits. That's what docs are for. I suggest to close this.

Nice trick by the way:)

@seberg
Copy link
Member

seberg commented May 16, 2019

It was not the most serious suggestion to be begin with. But the trick may be useful if we deprecate other attributes. Since we can modify the deprecation warning in the case of * imports to not be a difficult to understand spam (especially difficult to understand when it comes to avoiding the warning).

@seberg
Copy link
Member

seberg commented Nov 19, 2022

Closing this, it wasn't very serious about actually deprecating from numpy import *, and I think we are now comfortable enough with __getattr__ to not have an issue as a hint.

If we deprecate a name, it is also removed from __all__.

@seberg seberg closed this as completed Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants