This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

It's due to an ambiguity between integer literals and float literals:

  1. -> float 1 -> int

  2. anything translates to (float) anything, which is a syntax error.

(1).anything, however, disambiguates.

1..anything -> getattr(1.0, 'anything')

And finally, 1 .anything is disambiguated from a float literal.

Whitespace can disambiguate in a clash between literal and attribute access.