Re:Lily: An interpreted language with a focus on expressiven...
by koube on Thursday July 19, 2018 @02:36PM
(#17569140)
True, that's a problem I don't have anymore but it's a quick and understandable example of a mistake that I think lots of people had made before.
Instead of a comma I would actually recommend f-strings, which are python's string interpolation. The only downside is that the code within the f-strings I think have even less prechecking.
https://www.python.org/dev/peps/pep-0498/
Example: print(f"There are {len(lights)} lights!")
Re:Lily: An interpreted language with a focus on expressiven...
by falcor84 on Monday July 23, 2018 @05:19AM
(#17591522)
I absolutely agree that f-strings are excellent for formatting, but I don't quite understand why you would use formatting in a regular print statement, when you could just stick to the commas and let the concatenation happen naturally in the output buffer?
print("There are", len(lights), "lights!")
print(str, int)