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__
    <class 'int'>
    >>> (5).__class__
    <type 'int'>

----------
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 <rep...@bugs.python.org>
<http://bugs.python.org/issue20692>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to