POV-Ray : Newsgroups : povray.pov4.discussion.general : Curly braces replaced by indentations but only as an option ? : Re: Curly braces replaced by indentations but only as an option ? Server Time
30 Mar 2025 23:11:19 EDT (-0400)
  Re: Curly braces replaced by indentations but only as an option ?  
From: Tor Olav Kristensen
Date: 19 Mar 2025 21:50:00
Message: <web.67db734e7e3c5a9943a63f5189db30a9@news.povray.org>
"Mr" <m******r******at_hotmail_dot_fr> wrote:
>...
> In python you can only have tab sized (4 spaces) indents like this, which looks
> more tidy/less error prone (though I understand people would like more
> flexibility and perhaps more compact concision) :
>...
>    object:
>        sphere:
>            center<0, 0, 0>
>            radius<1>
>            material:
>                texture:
>                    color<1, 0, 0>
>                reflectivity<0.2>
>...

Hi Mr

Python allows 1 or more extra leading spaces for each indentation level.
So you can actually write code like this:

for x in range(10):
  for y in range(10):
      for z in range(10):
              print(f'<{x}, {y}, {z}>')
  if (x % 2) == 1:
          print('---------')

what is recommended in pep8 is another matter:


    https://peps.python.org/pep-0008/#indentation

And BTW: Tabs are evil!

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.