This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / _globals

module

numpy._globals

source: build-install/usr/lib/python3.14/site-packages/numpy/_globals.py :0

Members

Summary

Module defining global singleton classes.

Extended Summary

This module raises a RuntimeError if an attempt to reload it is made. In that way the identities of the classes defined here are fixed and will remain so even if numpy itself is reloaded. In particular, a function like the following will still work correctly after numpy is reloaded

def foo(arg=np._NoValue):
    if arg is np._NoValue:
        ...

That was not the case when the singleton classes were defined in the numpy __init__.py file. See gh-7844 for a discussion of the reload problem that motivated this module.

Additional content

Module defining global singleton classes.

This module raises a RuntimeError if an attempt to reload it is made. In that way the identities of the classes defined here are fixed and will remain so even if numpy itself is reloaded. In particular, a function like the following will still work correctly after numpy is reloaded

def foo(arg=np._NoValue):
    if arg is np._NoValue:
        ...

That was not the case when the singleton classes were defined in the numpy __init__.py file. See gh-7844 for a discussion of the reload problem that motivated this module.

Aliases

  • numpy._globals