Yasuhito FUTATSUKI wrote on Fri, 08 May 2020 20:55 +0900: > On 2020/05/08 2:46, Daniel Shahaf wrote: > > Yasuhito FUTATSUKI wrote on Thu, 07 May 2020 20:46 +0900: > >> I think it is need to escape characters in char *value when we print > ^some (not all) > >> them as Python's str value. The patch below may work for this purpose, > >> but I want someone to write more nice code :) > > > > How about simply adding the human-readable value in a comment? — > > It's very nice. One of the reason I don't like my code is just > readability of the value of "value".
Sure, in general it's nice for protocols and serialization formats to be texty, in order for them to be human-readable and -writable. On this instance, however, generating Python string literals that are both correct and human-readable seems to me like it'd be an effort spent for little gain. (I think there's a good chance that no one will _ever_ run entries-dump by hand again once it properly supports Python 3.) One easy way to make the output nicer is to name the lambda function. > (It seems that this patch just presents a concept but isn't a actual > code, though). Precisely. Sorry, I should've made that clear. > I tweaked a condition to distinct py2 and py3, then make a patch. +1 Thanks, Daniel