[Numpy-discussion] what to clean up, what to leave as is

Sebastian Berg sebastian at sipsolutions.net
Fri Jan 24 13:15:03 EST 2020

On Fri, 2020-01-24 at 10:57 -0700, Charles R Harris wrote:
> On Fri, Jan 24, 2020 at 10:42 AM Kevin Sheppard <
> kevin.k.sheppard at gmail.com> wrote:
> > I think some types of clean-ups, for example, imports, are pretty
> > low cost, low risk and don't have much bearing on and it might be
> > best to do them all at once. 
> > 
> > f-strings are also pretty simple but can be abused to the detriment
> > of code around (for example, moving a string defined in a variable
> > outside a function into the function just so it can have an f-
> > string).
> > 
> > I think more general code clean-up, for example, removing list
> > around iterators (e.g., list(map(f, i)) should be mostly avoided
> > unless there is a compelling case to prefer the iterator for
> > performance reasons. 
> > 
> > 
> I tend to see that as a matter of timing. At some point such things
> become archaic and unfamiliar as developers who grew up with modern
> Python become more common. But there is no rush.

Honestly, I am OK with simply not cleaning up some stuff. It was a
quick thought.
But, if we ever get around doing it, it seems like a good time now when
we already have a big code churn do to Py2 removal.

> The problem with  code history is trickier, and almost unavoidable
> over time. The information is still there, but it is harder to dig it
> out. Probably there need to be better tools to deal with that. This
> is especially apparent from the early C code cleanup that I did just
> to get more modern and readable code styling. My name is all over
> code that I didn't write, just formatted. But the cleanup was
> necessary for maintenance if nothing else.

Code history is a problem and it is annoying that code attribution is
obfuscated by it.
The argument for doing style cleanups is that if we do not use modern
patterns in large chunks of the code, the old patterns are likely to
repeated indefinitely. At least within their files [0].

Tools are maybe getting a bit better (e.g. github allows to click on
"view blame before this, although I doubt we ever get somewhere were
they will figure out that something was "just" a style cleanup.

- Sebastian

[0] An example are pytest vs. nose testing styles, where it is unlikely
we ever lose the complexity of keeping random snippets of nose style
around (which definitely will confuse new contributors).

> <snip>
> Chuck
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200124/4556f444/attachment-0001.sig>

More information about the NumPy-Discussion mailing list