On 2020/05/13 9:57, Daniel Shahaf wrote: > Yasuhito FUTATSUKI wrote on Wed, 13 May 2020 07:11 +0900: >> On 2020/05/10 1:24, Daniel Shahaf wrote: >>> 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. >> >> Yes, it's also one of the reasons that it uses lambda function. >> I use it only to reduce the occurence of 'value' in >> >> e.name = value if isinstance(value, str) else value.decode() >> >> without using temporary named object, in the first patch. >> >> Then I updated the patch. Not to use lambda function, I added >> a method to set str attribute from bytes object to "Entry" class, >> and move its definition to the output of entries-dump to show >> what it does. > > Thanks. Feel free to commit whichever variant you prefer. They're all > functionally identical to one another, so whoever writes the code gets > to choose. > > Review:
Thank you for the review. I've commited in 1877712, and I'm waiting for the results of buildbots. Cheers, -- Yasuhito FUTATSUKI <futat...@poem.co.jp>/<futat...@yf.bsdclub.org>