Newbie: White space

pehr anderson pehr at pehr.net
Wed Mar 22 23:53:32 EST 2000


Dear Ryan,

Incorrect indentaion is a syntax error since whitespace is significant
in python.

The following code will print "hello world"

if 1==1:
	print "hello",
print "world"

But the this following code is an error
because indentation level has changed with no coresponding 
conditional execution.

print "hello",
	print "world"


-pehr



Ryan Abrahams wrote:
> 
> I am new to python, I am actualy using it for rendering (via the Lightflow
> Python Module, at www.lightflowtech.com (and no I don't work for them)) and
> what I wanted to know was does Python check white space, because I had some
> code like this:
> 
> s.lightBegin()
>     s.lightOn( Sunlight )
>     Surface2 = s.newMaterial("standard", [ "ka", vector3( 0.5, 0.5, 0.0 ),
> "kc", vector3( 0.4, 0.2, 0.0 ), "kd", 0.5, "km", 0.1 ] )
> s.lightEnd()
> 
> and Python chucks a spit at the s.lightOn( Sunlight ) line. Now I have been
> trying to figure it out, maybe python does not support whitespace, because
> changing the code to
> 
> s.lightBegin()
> s.lightOn( Sunlight )
> Surface2 = s.newMaterial("standard", [ "ka", vector3( 0.5, 0.5, 0.0 ), "kc",
> vector3( 0.4, 0.2, 0.0 ), "kd", 0.5, "km", 0.1 ] )
> s.lightEnd()
> 
> and compiling it works perfectly. So is it Python that does not support hte
> white space, or perhaps the module I am including.
> 
> Thanks
> Ryan



More information about the Python-list mailing list