Overall, it looks fine. I probably would've written it a little differently, and I'll explain the differences.
"""A function that returns an array
with all the actual year quarters
current_year = datetime.date.today().year
quarter_values = ["31/03/","30/06/","30/09/","31/12/"]
current_quarter_values = [
for x in quarter_values]
current_quarters = get_current_quarters()
The function name
quarter_values_builder() sounds too complicated to me. Is it really a builder if all it does is take a known list and append the year to it? It's basically a glorified string formatter. A builder reminds me of the Builder pattern, something that doesn't apply here.
Getting the current year can be simplified too. We're not interested in the intermediary variables, so no need to create them. It's still perfectly readable if we do it all in one go.
x+year_str should at least have a little whitespace,
x + year_str, to increase readability. While we're at it, we might as well use proper string formatting. This is how we did save us a
str() cast earlier too. The formatting takes care of this for us. Because the line got a bit long, I cut it up a bit per function. This isn't required under 79 characters, but I think it looks better.
At the end, we don't need to call the storage variable a
string. We don't need to store it at all, the last 2 lines could easily become 1 line. But if we store it, putting the type of the variable in the name is more of a distraction than a help. After all, it's Python. The type might easily change in the next version. If you really want to use type-hints in Python, use actual type hints.
now in a variable while you're actually talking about quarters is somewhat confusing as well, in my opinion. So I've completely eliminated that from the used variables.
We don't need to use
datetime.datetime.now() at all. The
datetime module has a
datetime type. Considering we're only interested in the
year attribute, a
datetime is overkill.
date is enough to extract the