
On 2021-04-30 at 14:14:50 -0400, David Álvarez Lombardi <alvarezdqal@gmail.com> wrote: [...]
new = c"x.lower() for x in old if x in HARDCODED_LIST" # filter-in chars that appear in earlier-defined HARDCODED_LIST and convert to lower new = c"x for x in old if not x.isprintable()" # filter-in non-printable chars new = c"str(int(x) + 1) for x in old if isinstance(x, int)" # increment all integers by 1
[...]
My goal is to *decrease* complexity, and personal/higher-order/nested procedures do not accomplish this in my eyes.
Embedding a[nother] domain specific language in a string also doesn't decrease complexity; look at all the regular expression builders. Unless you're a core developer (or perhaps not even then), I suspect that most library functions started as "personal" functions. Hey, here's something I need for this project ... hey, I just wrote that for the last project ... how many times will I write this before I stick it in general_utilities ... let's see what python-ideas thinks ... Add the following to your personal library and see how many times you use it in the coming weeks or months: def string_from_iterable_of_characters(iterable): return ''.join(iterable) I haven't tested anything, but string_from_iterable_of_characters should take everything inside your c-strings unchanged.