I found this problem at The Voidspace Techie Blog:
Here is it:

>>> 3.__str__()
File "", line 1
3.__str__()
^
SyntaxError: invalid syntax

Here, python thinks that the dot is the dot of a float and not a dot for an attribute.
But the following works:


>>> (3).__str__()
'3'
>>> 3 .__str__() # one or many spaces
'3'
>>> 3..__str__() # 2 dots
'3.0'
>>> 3. .__str__() # dot, spaces, dot
'3.0'
>>> 3 . __str__() # spaces, dot, spaces
'3'

the 2 last examples work always:

>>> "abcdef" . find('d')
3
>>> object . __doc__
'The most base type'
>>> __builtins__ . object . __doc__
'The most base type'


For python when there is a space after the 3, there is no ambiguity. But without spaces it gives error even though all spaces are stripped/ignored as you see from the last examples.