[issue20692] Tutorial section 9.4
R. David Murray
report at bugs.python.org
Thu Feb 20 00:59:47 CET 2014
R. David Murray added the comment:
It's actually almost a FAQ at this point. The answer is that because of the way the parser works (it's a relatively simple parser, and we want to keep it that way), the tokenizer sees the '.' as making the token a float, and '3.__class__' is not a valid float token. So you have to precede the period by something that allows the tokenizer to know it isn't a decimal point. Parens is one way. Believe it or not, a space is another:
>>> 3 .__class__
<class 'int'>
----------
nosy: +r.david.murray
resolution: -> invalid
stage: -> committed/rejected
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20692>
_______________________________________
More information about the Python-bugs-list
mailing list