visual indentation
Peter Otten
__peter__ at web.de
Fri Aug 22 18:05:49 EDT 2003
Hilbert wrote:
> Is there any way to use such "visual" indentation in python?
Whitespace *is* significant in Python, and you should not try to circumvent
this using dirty tricks. Why not structuring your world definitions in the
standard way, putting the things that belong together in separate functions
or classes?
#disclaimer: no knowledge of CGKit involved in the following code
WHITE = (1.0,1.0,1.0)
def whitesurface():
RiColor(*WHITE)
RiSurface('constant')
def firstworld():
whitesurface()
RiSphere(1.0,-1.0,1.0,360)
def secondworld():
whitesurface()
RiSphere(1.0,-1.0,1.0,360)
for world in [firstworld, secondworld]:
RiWorldBegin()
world()
RiWorldEnd()
I think the above is pretty readable, and you can always factor out
repeating chunks of code
Peter
More information about the Python-list
mailing list