Re: Was: Dynamic Data type assignment

2020-01-30 Thread Dan Sommers
On Thu, 30 Jan 2020 20:40:50 +1300 DL Neil via Python-list wrote: > Why do we have [argparse] at the cmdLN and yet not have something > similar for input? Because argparse works on input, too? Many examples on https://docs.python.org/3/library/argparse.html¹ explicitly pass a list of strings

Was: Dynamic Data type assignment

2020-01-29 Thread DL Neil via Python-list
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

[issue39476] Not convinced with the dynamic data type assignment

2020-01-28 Thread Sushma
Sushma added the comment: Thank you On Tue, Jan 28, 2020, 6:30 PM Steven D'Aprano wrote: > > Steven D'Aprano added the comment: > > The "num" variable is not a number, it *is* a string. Just because you > call it "num" doesn't magically turn it into a number. The `input` function > returns

Re: [docs] Dynamic Data type assignment

2020-01-28 Thread DL Neil via Python-list
On 29/01/20 4:51 PM, sushma ms wrote: Thanks a lot. But why can't we make output of input also dynamic data assignment. 1 please don't 'top post': the normal sequence of a conversation is question THEN answer! 2 ambiguity! It is not possible for the input() mechanism to tell whether you

Re: [docs] Dynamic Data type assignment

2020-01-28 Thread sushma ms
Thanks a lot. But why can't we make output of input also dynamic data assignment. Thanks & Regards, Sushma MS On Tue, Jan 28, 2020, 9:54 PM Mariatta wrote: > input() returns a string. If you want it to be treated as an int you need > to cast it, example: > > num =int(input ("Enter number")) >

[issue39476] Not convinced with the dynamic data type assignment

2020-01-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: Sushma, asking about the exception message on python-list was the right thing to do. You should have waited for the answers you got there. At this point, bugs in basic python operations are extremely rare. -- nosy: +terry.reedy

Re: Dynamic Data type assignment

2020-01-28 Thread Rhodri James
On 28/01/2020 12:03, sushma ms wrote: Hi Please find below example and the compiler error, when i'm assigning value dynamically and when we comparing in "if" loop it is throwing compiler error. It should not throw error It absolutely should throw an error. it should assign and act as int

Re: [docs] Dynamic Data type assignment

2020-01-28 Thread Mariatta
input() returns a string. If you want it to be treated as an int you need to cast it, example: num =int(input ("Enter number")) On Tue, Jan 28, 2020, 5:13 AM sushma ms wrote: > Hi > > Please find below example and the compiler error, > > when i'm assigning value dynamically and when we

[issue39476] Not convinced with the dynamic data type assignment

2020-01-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: The "num" variable is not a number, it *is* a string. Just because you call it "num" doesn't magically turn it into a number. The `input` function returns a string. You might be thinking of Python 2.7 where `input` automatically evaluated the string as

[issue39476] Not convinced with the dynamic data type assignment

2020-01-28 Thread Sushma
ot all arguments converted during string formatting -- messages: 360865 nosy: Sush0907 priority: normal severity: normal status: open title: Not convinced with the dynamic data type assignment type: compile error versions: Python 3.8 ___ Python trac