Properly split and handle arguments in CommandHandler#414
Properly split and handle arguments in CommandHandler#414jh0ker merged 3 commits intopython-telegram-bot:masterfrom eligao:whitespace_args
Conversation
jsmnbom
left a comment
There was a problem hiding this comment.
Seems like the expected behaviour to me.
The only problem I could see with this is that I've seen a lot of people assume that they can get the whole argument using ' '.join(args), which no longer would be true..
jsmnbom
left a comment
There was a problem hiding this comment.
Please change the docstring for the pass_args argument to fit the change. Other than that, it looks good :)
|
But after this commit, one could get a "regularized" version of the original argument. |
|
Yeah that's true. Please address the docstring change I reviewed above and it looks good to go as far as I'm concerned. |
|
Noted :) |
|
I've updated the docstring in CommandHandler. |
Assume we got a command with more than one continuous white-space characters (which does happen) :
after
split(' '), we have['/func', '', 'arg1', 'arg2', '', 'arg3', '', '', 'arg4']which includes many unnecessary empty strings that leads to improper command handling.
This is also different from how the system handles standard
argv[].However with
split(), we have the proper parameters:['/func', 'arg1', 'arg2', 'arg3', 'arg4']Also it eliminates other unnecessary white-spaces like
\r,\n, etc.