Odd syntactic NON-error?

Alaric Haag haag at lsu.edu
Fri Jan 30 15:42:28 EST 2009


In article 
<20090130173948.12853.732928641.divmod.quotient.543 at henry.divmod.com>,
 Jean-Paul Calderone <exarkun at divmod.com> wrote:

> On Fri, 30 Jan 2009 11:36:45 -0600, Alaric Haag <haag at lsu.edu> wrote:
> >Hello,
> >
> >I just noticed that I've been successfully importing a module I wrote
> >which contains a class definition that begins with (docstring removed):
> >
> >class TDF():
> >    def __init__(self, name='', mode=tscan. GP_NOCLOBBER):
> >
> >Note the "space" which shouldn't be here---^
> 
> The space is irrelevant.
> 
>   >>> object. __init__
>   <slot wrapper '__init__' of 'object' objects>
>   >>> object.__init__ is object. __init__
>   True
>   >>> 
> 
> Jean-Paul
> --
> http://mail.python.org/mailman/listinfo/python-list

It strikes me as strange that Python (which I love btw) would be so 
loose in its syntax when "spaces matter" at the beginning of a line. 

I now see that a space could precede the period too, as in:

   x = foo . method()

So, is the "secret" that the period is syntactically an "operator" like 
+ or * ?




More information about the Python-list mailing list