On 9/21/17, Steve D'Aprano wrote:
> In the iPython interactive interpreter, obj? prints information about the
> given
> object. For example:
>
>
> In [11]: None?
> Type: NoneType
> Base Class:
> String Form:None
> Namespace: Python builtin
> Docstring:
>
>
> Does anyone know that the Namespace field is supposed to show? I can't get
> it to
> display anything except either "Python builtin" or "Interactive".
I discovered that there are 3 default namespaces ->
https://github.com/ipython/ipython/blob/79921f6fe380f57cf353d76615e4fd8472c83118/IPython/core/interactiveshell.py#L1405
But you could somehow change or add other namespaces (maybe ipdb could
add local namespace to evaluate local variables).
You could check thist code:
import IPython
ip = IPython.core.getipython.get_ipython()
print(ip.user_ns) # this is in 'Interactive' namespace
print(ip.user_global_ns)# this is in 'Interactive (global)' namespace
# next line show how somewhat somewhere could change namespace where
object names are searched
ip._inspect("pinfo", "None", [("my namespace", {"None":None})])
--
https://mail.python.org/mailman/listinfo/python-list