In 2040, computer programming as we do it today will be completely automated. There will be two main groups of software developers: those who develop machine learning models that generate computer programs, and those who translate business/product requirements into a design specification and then translate the specification into a plain English description, which is fed into a machine learning model. Entering the plain English product/feature description into an ML model will be an interactive process - the model will ask for clarifications whenever something is not clear enough to implement. At that point writing Python code will be just as arcane and tedious as writing assembly code today. ML models will generate better Python (or Rust or whatever) code than most human programmers, just like today a C compiler generates better assembly code than most human programmers. Eventually ML models will be trusted enough to produce machine code directly, making human readable programming languages obsolete.
I predict we will see first systems like this within 5 years, but it will take much longer (up to 20 years) for these systems to become reliable enough to be adopted on a mass scale. This will be similar to the adoption of self-driving cars.
p.s. this view assumes there is no AGI developed by 2040.