[issue37466] Move casting prompt after its validation in _raw_input()

2019-07-02 Thread myungsekyo
myungsekyo added the comment: Thanks to your reviews! I understood what you mean. This patch is unnecessary. I will close this issue. -- resolution: -> not a bug stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue37466] Move casting prompt after its validation in _raw_input()

2019-07-01 Thread Tal Einat
Tal Einat added the comment: >> one would expect passing prompt=None to result in no prompt displayed > I wouldn't. That's not how getpass works now, or input. Ah, thanks for the input, Steve. In that case, this should likely not be changed. -- _

[issue37466] Move casting prompt after its validation in _raw_input()

2019-07-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't think that will work. If the user passes a non-string which is falsey, your patch will attempt to write it directly to the stream without converting it to a string. Try ``_raw_input(0)`` as an example. Tal Einat: > one would expect passing prompt=N

[issue37466] Move casting prompt after its validation in _raw_input()

2019-07-01 Thread Tal Einat
Tal Einat added the comment: This is a subtle change with the potential to affect more than just performance. Also, in this case, the performance is likely negligible in every actual use-case. This might actually be more correct, though. For example, one would expect passing prompt=None to

[issue37466] Move casting prompt after its validation in _raw_input()

2019-07-01 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch pull_requests: +14318 stage: -> patch review pull_request: https://github.com/python/cpython/pull/14502 ___ Python tracker ___ __

[issue37466] Move casting prompt after its validation in _raw_input()

2019-07-01 Thread myungsekyo
New submission from myungsekyo : I think it is more efficient to cast `variable prompt` into string after its validation in _raw_input(). Because If it is None or empty string then it is not used. ``` import timeit MAX = 1000 start = timeit.default_timer() for i in range(MAX): _raw