3 ms·
Thanks! Coincidentally one of the first articles I wrote for my blog was about compile-time checking of table/column names: https://david.rothlis.net/d/template
by drothlis 4y ago
Thanks! Coincidentally one of the first articles I wrote for my blog was about compile-time checking of table/column names:
https://david.rothlis.net/d/templates/ https://david.rothlis.net/d/templates/
(Just something I was messing around with, not anything I ever used in production.)
- simonw 4y agoSpotted this in the code: def _left_pad(text, indent=" "): """Maybe I can find a package in pypi for this?""" return "\n".join(indent + line for line in text.split('\n')) You can use the textwrap module from the Python standard library for this: textwrap.indent('hello\nthis\n is a demo', ' ') # ' hello\n this\n is a demo'
- drothlis 4y agoHa! I use `textwrap.dedent` all the time but didn't make the leap of logic to check for the existence of `indent`. :-) I suspect this was a leftover from Python 2.7 days.