[issue37318] builtins.True exists but can't be accessed

2019-06-18 Thread Mark Dickinson
Mark Dickinson added the comment: [Raymond] > It is just the way the language works. As far as I can see, the language doesn't need these constants to be in builtins at all - the only reason for keeping them there is backwards compatibility. As an experiment I tried removing `True`,

[issue37318] builtins.True exists but can't be accessed

2019-06-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: Depending on your mental model of the language, this may not seem odd at all. >>> # We can set any key/value pair in any dictionary >>> d = {'x': 10, 'True': 20, 'for': 30} >>> # We can do regular string lookups at any time >>> d['x'] 10 >>> d['True'] 20

[issue37318] builtins.True exists but can't be accessed

2019-06-17 Thread ChrisRands
New submission from ChrisRands : On Python 3: >>> import builtins >>> 'True' in dir(builtins) True >>> builtins.True File "", line 1 builtins.True ^ SyntaxError: invalid syntax >>> So "True" is a keyword, I guess this explains the behaviour, but still seems odd to me?