3 ms·
it's also non-idomatic in that is uses string-multiplication and ==0 where an "if not" ternary expression would be much cleaner.
by nightpool 12y ago
it's also non-idomatic in that is uses string-multiplication and ==0 where an "if not" ternary expression would be much cleaner.
- SwellJoe 12y agoYes, a ternary would be clearer, to me. I wasn't sure what was happening with the * (and thought maybe it was some use of the "whatever star" in Perl 6, when I was thinking it might be Perl 6, though it doesn't look like any use of the whatever star I've seen), but I just assumed it made sense to someone who knew the language well. It's been a decade since I worked in Python with any regularity.
- nostrademons 12y agoI would probably use a named function call in real code, but the 'text * (expr == 0)' idiom is pretty clear to me as a way to conditionally include text based on whether a condition is true or not.