What Python syntax rule allows a space between a period and method call?

Viewed 40

I noticed an error in some python code. I expected it to fail, but it runs just fine. In essence the code is:

class Foo(object):
    def method(self):
        print("in method")

a = Foo()
a.method()
a. method()

The space between a. and method() is what I'm curious about. Both calls work just fine. Why is this? Is the behavior of this syntax undefined, if not, what rule does it follow?

Using Python 3. 5.2

0 Answers
Related