Re: Friendly-traceback: useful tool for those teaching Python
Andre: I think you mean simply __builtins__, without the dir(). I was puzzled by this remark at first but now I’m seeing why. When I boot into the Python shell directly from bash, and ask for the type of __builtins__ i.e. type(__builtins__), I get back that it’s a module. Then dir(__builtins__) lists the contents, of the module, same as dir(math) would do. However, if I’m in the Spyder IDE and ask for the type of __builtins__, I’m told it’s a dict. If I ask for type(__builtins__) I get a list of all the things dicts can do, not the contents of the module. Ah, but there’s more…in Spyder, I have not only __builtins__ but __builtin__ (singular), and the latter is a module that behaves like __builtins__ (plural) in the primitive shell. At the same time, the primitive shell doesn’t have a __builtin__, only __builtins__. Spyder has added complexity. I’m using the same version of Python (3.9) in both cases. Kirby
participants (1)
-
kirby urner