Deprecate input()

Alex Martelli aleax at aleax.it
Mon Apr 15 07:46:32 EDT 2002


Magnus Lie Hetland wrote:

> In article <a9cv63$qhu$1 at bob.news.rcn.net>, Raymond Hettinger wrote:
>>The help and tutor maillists indicate that the use of input() rather than
>>raw_input() is widespread. I think this function is so harmful and so
>>likely to be used that it should be deprecated hasta pronto (right away).
>>When really needed, eval(raw_input()) is easy enough to code and explicit
>>about what it does.
>>
>><no wink -- this function needs to go away>
>>
> 
> But (in the (very?) long run) I think that the name "input" should
> then be used for what is now raw_input. I know -- breakage, and all
> that... I just think it fairly odd to have *only* raw_input, since the
> "raw" qualification then becomes fairly meaningless.

I think the best name for what's now raw_input might be something
like getline.  That's what it does, net of line ending issues -- get
one line (from stdin).  'input' is too vague.  And with a zillion
existing books explaining 'input', we can never reuse that name
for anything else, IMHO, without utterly confusing future newbies
who happen to have an old book or website or &c at hand.


Alex




More information about the Python-list mailing list