New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too clever? #133
Comments
Personally, I like the approach on the first one since it looks clean and compact. I tested the performance and there wasn't much difference perhaps get a test with huge amounts of data and see if there are any performance hits but I doubt it. I think it's readable and neat so it gets a positive vote on my end. Also, I checked the file and neither shapes nor shapes2 is used after the example, not sure if that's a w.i.p or non-intended but thought id mention it! |
disagree with codefactor here, and i'd disagree that this is obscure; list comprehensions are the "pythonic way". i prefer to use list comprehensions like this when it is small enough to remain on one line. iirc in some contexts list comprehensions are much faster than for loops-- i don't think that is going to be the bottleneck here, though. all that being said, no real objections to changing it |
I don't have very strong feelings about it either, but the most common view within the Python community seems to be that it's unpythonic, e.g. see this discussion. |
Okay, fair-- my model is typically "making a list? use a list comprehension". the point in the link is that you shouldn't apply functions with side effects inside of a list comprehension, and this is just calling fair enough, i'm good with changing it |
I overlooked this until now. It appears that the entire section of code Lines 70 to 75 in ddeee4e
has no effect on the function output. Perhaps it's some vestige of a previous implementation of the same function that was overlooked for removal? Is there any reason to keep this block of code? |
@Michael-T-McCann iirc this was your chunk of code |
It looks vestigial to me as well, let's remove it. |
This is a clever little construction
scico/scico/linop/_stack.py
Line 72 in ddeee4e
but is the compactness worth the potential confusion (codefactor does not like it)? The non-obscure way of doing this only requires one extra line, i.e.
The text was updated successfully, but these errors were encountered: