Answer the question
In order to leave comments, you need to log in
Is the string initialized at the time of the error?
Good evening, tell me the answer to this question :)
I have the following piece of code:
int_text = int(input("it's just an instance, bro"))
Answer the question
In order to leave comments, you need to log in
As I understand it, how "initialization" happens.
An object is created somewhere, and an int_text variable is created and "attached" to that object, like a tag on a tea bag.
And the “empty string” object is not created here. Well, more precisely, it does not work out at the output of the right side of the "equation". And the label int_text is not attached anywhere. And, apparently, it is immediately eaten by the garbage collector.
If we consider everything not as an assignment, but as a "binding" of a variable name with an object.
And submit the assignment record itself in a slightly different form.
globals().__setitem__('int_text', int(input("it's just an instance, bro")) )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question