On Sep 9, 2019, at 17:43, Steven D'Aprano <st...@pearwood.info> wrote: > > But for me, I am not comfortable with this style and > would not use it because I have seen far too many people (including > myself) waste too much time farting about fixing formatting and > alignment issues instead of doing productive work.
To be fair, you can use editor plugins to manage this stuff. For example, I used to have a mess of emacs lisp that I maintained that turned exactly your “oh no I have to reformat all the things” case into “ctrl-c :”. But I no longer use any of that. I’m much happier since I set up the black auto-formatter as a save hook. I can no longer do fancy things like lining up the colons, so I no longer waste time doing fancy things like lining up the colons (or writing lisp code to do it for me). Occasionally, it does turn a complicated expression into an unreadable mess, but then I just break the statement up into two statements that it can handle just fine, and the result is almost always easier to follow anyway. The only problem is that if I’m editing someone else’s code who doesn’t use black, I have to disable my save hook so I don’t accidentally commit a diff that destroys all their fancy lined up colons. Anyway, back on topic: earlier I facetiously suggested that you could simplify this code by replacing the mess of local variables with a simple namespace that holds them all, then dictifying and filtering that… but actually, I’m not sure that’s a joke anymore. Why _should_ all those things be in a whole mess of locals, if the main thing you’re using them for is to create a config dict or JSON response or whatever? They probably are conceptually attributes of some object, and if the object is too dumb to be worth declaring a custom class for it and writing a for_json or as_dict or whatever, you can just use a SimpleNamespace. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/HLWKC5FSNINEFATB4HRCCSQFG34WCPGZ/ Code of Conduct: http://python.org/psf/codeofconduct/