There will always be some ambiguities when determining where to insert line breaks in code. Short of inserting a character that instructs the browser to not break the word here, I have no idea how you would programmatically go about this. I have run into this before. It's a little frustrating that a quick line of code
mid-sentence wraps in a strange way, but remember this site is displayed on a number of different form factors. It might look funny on a nice, wide desktop monitor, but look just fine on a tablet or mobile phone. You could even fiddle with the wording of your answer so it shows up fine when composing the answer only to find out it looks funny on a mobile phone.
Instead (and I know this isn't news to you), I just put the code in code fences:
... You could get something equivalent using:
" ".join(map(shlex.quote, sys.argv))
though you shouldn't need to...
It might not be as nice as reading it inline, but at least it isn't wrapped funny.
And just to illustrate this problem a little more, my answer even includes such an awkward break:

<code>" ".join(map(shlex.quote, sys.argv))</code>
would work, at least for now.