learnpython.org - an online interactive Python tutorial
rantingrick
rantingrick at gmail.com
Sat Apr 23 11:21:14 EDT 2011
On Apr 22, 1:38 am, harrismh777 <harrismh... at charter.net> wrote:
> Strings should auto-type-promote to numbers if appropriate.
No they should not! We do not want a language to "guess" our
intentions. We are big boys and girls and should be responsible for
own actions.
> This behavior should occur in input() as well. If a 'number' string is
> entered and can be converted to a Python number (whatever I mean by that
> at the moment) then the string should be converted to a number (int or
> float as appropriate) and the input() should return a reference to the
> number type ( a value ); otherwise, input() should return the string
> entered, or throw a type error.
No, no, no! This is evil! That is what "eval" is for my friend.
> If an operation like (+) is used to add 1 + '1' then the string should
> be converted to int and the addition should take place, returning a
> reference to object int (2).
My god man, have you gone completely insane? 8-O
More information about the Python-list
mailing list