|
 |
On 26.03.2026 14:38, jr wrote:
> well, I don't "speak" Python, so cannot do so either.
Well, initially my pythonic part consisted of three things:
1) One "with open..." for file handling.
2) One "for" loop for dictionary iterating.
3) One file .write with f-string, combining dictionary keys and values
with POV-Ray syntax elements.
All the rest of the file consisted of 147 dictionary entries, whose keys
and values were directly copied from W3C site.
Main reasons for doing all this with Python were:
1) I'm too lazy to think of search and replace sequence for transforming
W3C source into POV-Ray, "let the iron mechanism work";
2) Now it's extremely easy to change things en masse by, say, editing
that single f-string.
But now I tried to address all the issues mentioned in both replies, so
my pythonic code like quadrupled in size ;-)
Here go the updated version (and exported .inc example for those who
loathe to touch Python). Note that file name to be inserted here and
there in all these "include_temp" is defined within program, so it's
easy to edit it with notepad - all the "doing" code goes after
dictionary definition, which, considering code and dictionary relative
sizes, means "at the very end of Python file".
--
Ilyich the Toad
https://dnyarri.github.io/
Post a reply to this message
Attachments:
Download 'svg_recognized_color_keyword_names.py.txt' (7 KB)
Download 'svg_colors.inc.txt' (8 KB)
|
 |