Was: Dynamic Data type assignment

DL Neil PythonList at DancesWithMice.info
Thu Jan 30 02:40:50 EST 2020


Further thoughts on the OP's point:-


> On 29/01/20 4:51 PM, sushma ms wrote:
...

>> But why can't we make output of input also dynamic data assignment.
...
 >>>> when i'm assigning value dynamically and when we comparing in "if" 
loop
 >>>> it is throwing compiler error. It should not throw error it should
 >>>> assign
 >>>> and act as int why it is thinking as string.


NB am not disputing the facts:
> WebRef: https://docs.python.org/3/library/functions.html#input


Coincidentally, not long after this list-conversation, I was asked to 
take a look at a command-line program(me) which was not accepting 
arguments per spec.

First, I dived into the PSL to refresh my memory. There we find all 
manner of 'goodies' for formatting the cmdLN I/P, selecting its type, 
defaults, etc, etc.

Why do we have this at the cmdLN and yet not have something similar for 
input?

Perhaps there is a small library available (that I've never gone looking 
to find) which wraps input() and facilitates the input of int[egers], 
for example?

What the OP asks is not really 'out there', we used FORMAT to type INPUT 
data in FORTRAN, back in the ?good old days!
(don't over-excite me or I'll threaten you with my walking-stick...)

-- 
Regards =dn


More information about the Python-list mailing list