Interesting diacussion, this comparison of IC engine and electric motor, sorry for a degression from the OPs topic.
There are few more reasons for use of electric motors powered by diesel engine turning the generator in locomotives or even in those big dumper trucks used in mining fields. Even though in mining dumper trucks is probably used diesel engine of around 2000 HP. Those heavy weight vehicles, especially under heavy load, when driven down the slope can lead to the IC engine overrevving leading to premature failures and for such kind of applications that is very costly thing. On the other side, generator is almost perfect load for IC engine to last long (relatively narrow RPM range required and matched with optimum IC engine load/torque/etc. curves). The other reason is that mechanical breaks must be used in case of IC engine. At such loads their design must be very robust/expensive and in case of "extreme driver" they can also prematurely fail, again expensive beside also being dangerous. In case of electric motors, the motors themselves can be used as breaks (they work as generators, no mechanical friction involved) and this is especially easy to do in case of train where the breaking energy translated to electric energy can be returned to the electric power line.
Regarding comparison of torque characteristics between IC engine and electric motor, it is always mentioned that electric motor have almost flat/constant torque characteristic from 0 RPM to max RPM. This is not fully truth or not stated correct (DC motor is exception which really has maximum torque at 0 RPM). Each AC motor, depending on type has different looking characteristic depending on the type of motor, not every type is good for max torque at 0 RPM, or at some different application requirement. Beside that, especially AC motors have so called "natural torque" characteristic which is given at single power source frequency and you could be very supprised how that looks like depending on the type of motor (this comes from history reasons because most AC electric motors were used in industry and mostly not vehicles and were attached directly to 50/60Hz power network without electronic motor controllers which are used today). Due to development of high speed microcontrollers and also power transistors capable of delivering high electric currents at high frequencies (mind this came in ~1990s, even though electric motors in principle are still very similar to those in 1900s), today it is possible to generate/imitate power source at demanded/wished/required frequency and voltage/current by the means of electronic motor controller/driver. What this means is that by the means of electric motor controller/driver we can shift the "natural" torque characteristic of electric motor where we wish it to be, so as a result we achieve constant torque at the whole range of RPMs. Still if you know the limitations of motor type and natural characteristic, only then you know the limitations of that setup and if it is good for specific application. That is the reason why now more types of motors are developed in recent times (e.g. to try to unify different requirements as much as possible) and why e.g. some electric cars have two different electric motors in one vehicle, to achieve different goals. Therefore, it would be correct to say that electric motor with integrated electric controller has almost flat torque characteristic, but not just electric motor. Some motor types by itself have torque ripples due to their design, but can be cheap and use cheap and simple controllers and they are ok in e.g. cloths washing machines or such applications, some types are great at zero torque, some types are great at higher RPMs, but not so good at low RPMs, some characteristics are diminishing with the RPM increasing above some specific value and have to be compensated in electronic controller at the expense of e.g. torque which becomes not constant above that RPM, so you still need good engineers to match the electric motor/controller/application similar to what you had with ICE/gearbox/application, it is just now even broader multi disciplinary topic. From my point of view, electric motor/electronic driver combination excells the IC engine/gearbox in terms of capability/simplicity/efficiency/maintenance, but I am still not delighted with current batery solutions or let's say power source solutions, whataver that will be in future. We still need to work on that. Motor/driver combination already achieves between 90% and 100% efficency, in industry, you can see even ~99% efficency machines.
I would skip ecology and comparison with fuels since it is different topic. I was sticking to what can be compared from purely electro/mechanical point of view. You can consider me as agnostic in case of fuel/battery topic - I would still not give up IC engine and fuel compared to current battery due to simple convenience of usage, but once we have proper solution in place of battery leading to same convenience, I would not think twice of switching to it. Will that be better for ecology, we shall see. Whatever we humans did to make something "better", it costed us later down the road. I mean, I recently saw on this forum so called reaction ferry used to cross the river, no motor/engine required, I really like it, but now instead of walking up/down the river after crossing it, we want to sail, well it seems we as humans are hard to satisfy living beans and that is the key issue

. Therefore, we now suffer to achieve 99% of whatever, even though we could just be raction ferring or walking

. Brain is a strange hungry animal and I think most of people on this forum will agree to this

, no matter if you are fuel or battery lovers