[docs] [issue20692] Tutorial and FAQ: how to call a method on an int
Terry J. Reedy
report at bugs.python.org
Fri Mar 14 20:08:47 CET 2014
Terry J. Reedy added the comment:
I agree with Antoine about the particular cross-link and would drop that one. Is there somewhere earlier in the tutorial that discusses .attribute access? That would be the place to mention the ints and dotted names. Rather than a link, I would just mention that ints need to be separated from the period.
I also agree with David. Here is a condensed answer that I think says just what is needed.
This is because the Python parser sees an integer literal followed by a period as a float literal and a float literal followed by a name,
``5. __class__``, is a syntax error. To look up an attribute on an integer literal, separate the integer from the period with either a space or parentheses.
>>> 5 .__class__
stage: needs patch -> patch review
title: Tutorial section 9.4 and FAQ: how to call a method on an int -> Tutorial and FAQ: how to call a method on an int
Python tracker <report at bugs.python.org>
More information about the docs