visual indentation

Dan Bishop danb_83 at yahoo.com
Sat Aug 23 02:40:05 CEST 2003


Hilbert <Hilbert at panka.com> wrote in message news:<slrnbkcja7.s51.Hilbert at server.panka.com>...
> Hello,
> 
> I'm using python to output RIB streams for Renderman.
> The RIB stream is a bunch of statements which describes 
> a 3d image. The Rib standard allows for blocks which we
> usually indent for better visualization for example:
> 
> WorldBegin 
>     Color [1 1 1]
>     Surface "constant"
>     Sphere(1.0, -1.0, 1.0, 360)
> WorldEnd
...
> Is there any way to use such "visual" indentation in python?

If the code consists of nothing but expressions (which yours does), you can write:

(RiWorldBegin())
(   RiColor(1.0,1.0,1.0))
(   RiSurface('constant'))
(   RiSphere(1.0,-1.0,1.0,360))
(RiWorldEnd())

or

(
RiWorldBegin(),
    RiColor(1.0,1.0,1.0),
    RiSurface('constant'),
    RiSphere(1.0,-1.0,1.0,360),
RiWorldEnd()
)




More information about the Python-list mailing list