︠49dffcdc-5a50-4749-aaa6-eea73ae6a6e5s︠ show_identifiers() ︡da5699e4-b1bc-4295-bb10-d11b6c029837︡{"stdout":"['dynamic', 'hide', 'julia', 'md', 'smc', 'attach', 'jupyter', 'mediawiki', 'sage_salvus', 'typeset_mode', 'hideall', 'fortran', 'fork', 'reset', 'time', 'perl', 'default_mode', 'search_doc', 'sh', 'sage_server', 'wiki', 'require', 'show', 'checkbox', 'search_src', 'timeit', 'sage_chat', 'prun', 'modes', 'plot3d_using_matplotlib', 'runfile', 'input_box', 'pretty_print_default', 'ruby', 'input_grid', 'range_slider', 'go', 'capture', 'help', 'pandoc', 'script', 'interact', 'selector', 'clear', 'restore', 'color_selector', 'license', 'load', 'coffeescript', 'pylab', 'cython', 'button', 'cell', 'exercise', 'raw_input', 'slider', 'sage_eval', 'view', 'javascript', 'delete_last_output', 'python', 'auto', 'text_control', 'python3', 'var']\n"}︡{"done":true}︡ ︠84b58895-a6d6-4f1b-83a3-c259b70d66aas︠ len(show_identifiers()) ︡25ffd839-c402-487d-a010-da8930594e6d︡{"stdout":"60\n"}︡ ︠1ae27507-b00f-4aff-ba1f-2c2fbab1a9d9s︠ show_identifiers?? ︡d6eb0171-7437-4073-9855-b152afb2a388︡{"code":{"source":" File: /projects/sage/sage-6.7/src/sage/misc/session.pyx\n Source:\n def show_identifiers(hidden=False):\n r\"\"\"\n Returns a list of all variable names that have been defined during\n this session. By default, this returns only those identifiers\n that don't start with an underscore.\n\n INPUT:\n\n - ``hidden`` -- bool (Default: ``False``); If ``True``, also return\n identifiers that start with an underscore.\n\n OUTPUT:\n\n A list of variable names\n\n EXAMPLES:\n\n We reset the state of all variables, and see that none are defined::\n\n sage: reset()\n sage: show_identifiers()\n []\n\n We then define two variables, one which overwrites the default factor\n function; both are shown by :func:`show_identifiers()`::\n\n sage: a = 10\n sage: factor = 20\n sage: show_identifiers()\n ['a', 'factor']\n\n To get the actual value of a variable from the list, use the\n :func:`globals()` function.::\n\n sage: globals()['factor']\n 20\n\n By default :func:`show_identifiers()` only returns variables that\n don't start with an underscore. There is an option hidden that\n allows one to list those as well::\n\n sage: _hello = 10\n sage: show_identifiers()\n ['a', 'factor']\n sage: '_hello' in show_identifiers(hidden=True)\n True\n\n Many of the hidden variables are part of the IPython command history, at\n least in command line mode.::\n\n sage: show_identifiers(hidden=True) # random output\n ['__', '_i', '_6', '_4', '_3', '_1', '_ii', '__doc__', '__builtins__', '___', '_9', '__name__', '_', 'a', '_i12', '_i14', 'factor', '__file__', '_hello', '_i13', '_i11', '_i10', '_i15', '_i5', '_13', '_10', '_iii', '_i9', '_i8', '_i7', '_i6', '_i4', '_i3', '_i2', '_i1', '_init_cmdline', '_14']\n \"\"\"\n state = caller_locals()\n return [x for x, v in state.iteritems() if _is_new_var(x, v, hidden)]\n","mode":"python","lineno":-1,"filename":null}}︡ ︠184649e6-ec05-485b-9f03-435a24199279s︠ sage.misc.session._is_new_var?? ︡2b767af6-3dbb-40da-b4d4-b7a9dc1e8028︡{"code":{"source":" File: /projects/sage/sage-6.7/src/sage/misc/session.pyx\n Source:\n def _is_new_var(x, v, hidden):\n \"\"\"\n Return whether or not the variable named ``x`` with value ``v`` is\n considered newly defined in the current session.\n\n INPUT:\n\n - ``x`` -- string\n\n - ``v`` -- object\n\n - ``hidden`` -- bool; if ``True``, always return ``False`` on variables\n that start with ``_``)\n\n OUTPUT:\n\n A bool\n\n EXAMPLES:\n\n We reset the session, then check whether the builtin factor function\n is newly defined (it isn't)::\n\n sage: reset()\n sage: sage.misc.session._is_new_var('factor', factor, True)\n False\n\n We then redefine factor, and find that it is newly defined::\n\n sage: factor = 10\n sage: sage.misc.session._is_new_var('factor', factor, True)\n True\n\n We define a new variable ``'blue'``, and test::\n\n sage: blue = 10\n sage: sage.misc.session._is_new_var('blue', blue, True)\n True\n sage: sage.misc.session._is_new_var('_blue', blue, True)\n True\n sage: sage.misc.session._is_new_var('_blue', blue, False)\n False\n \"\"\"\n # We ignore all _ variable names unless hidden is True\n if not hidden and x.startswith('_'):\n return False\n # If a variable names was not there at init time then it is\n # definitely new.\n if x not in state_at_init:\n return True\n # A variable could also be new even if it was there at init, say if\n # its value changed.\n return x not in state_at_init or state_at_init[x] is not v\n","mode":"python","lineno":-1,"filename":null}}︡ ︠ff556583-ab3e-4653-bd4c-16a3ed8a3e3bs︠ sage.misc.session.state_at_init = dict(globals()) ︡ec8030a0-c405-4e95-be12-bcd77a12d8ae︡ ︠9af487d4-f65c-4114-a7ef-ea2a87f8ec04s︠ show_identifiers() ︡6e1410cd-2041-4bf7-bcdf-cbef0a256152︡{"stdout":"['smc', 'require', 'salvus']\n"}︡ ︠fc028461-a592-4182-bffc-69c65638d828s︠ x = 10 ︡b369e07d-d3ee-480a-a981-60b4fce2f2bb︡ ︠48427d51-3690-4182-b312-91a9b7f0661es︠ show_identifiers() ︡3fd8f12e-8def-46a6-bbe1-f0691a42adca︡{"stdout":"['smc', 'require', 'x', 'salvus']\n"}︡ ︠dacc1925-feb9-45c1-92aa-47092724d226s︠ abc = 15 ︡7a0c5ff7-2e2f-43e5-b761-c36bb31e518f︡ ︠7c7615fa-8f68-4e85-bc13-1d0cf714f4c7s︠ show_identifiers() ︡83cf5360-537f-485a-b7ae-1b61545804a6︡{"stdout":"['smc', 'require', 'abc', 'x', 'salvus']\n"}︡ ︠1ecf0bb3-35c3-4de6-97f9-07dd35a26569︠