Spaces in object attribute

Emile van Sebille emile at fenx.com
Thu Jan 10 08:36:49 EST 2002


Shouldn't this cause an SyntaxError?

>>> sys.version
'2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)]'

>>> class Test:pass

>>> obj=Test()
>>> obj. attr = 1 # note the space
>>>

In particular, I ran across this while printing out debugging info when I
typoed in a period for a comma.  I was surprised to get an attribute error
at run time instead of a syntax error at compile time.

Is there a reason to allow spaces like this?

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list