Disable automatic printing in Python interactive session -
I am going to organize a Python workshop to teach some early level programmers in my college Python.
I am looking for a way to modify the default behavior of Python interactive sessions so that the expression results do not print automatically. For example, take the following interactive session:
wil @ calcifer: ~ $ python python 2.7.3 (default, 1 August 2012, 05:16:07) at [gcc 4.6.3] Linux2 For more information, type "help", "copyright", "credit" or "license" & gt; & Gt; & Gt; X = 5> and gt; & Gt; Y = 7> and gt; & Gt; X + y12> gt; & Gt; & Gt; First_name = "test" & gt; & Gt; & Gt; Last_name = "person" & gt; & Gt; & Gt; First_name + last_name 'TestPerson' & gt; & Gt; & Gt; This will apply the use of the print statement to avoid confusion later on. This is not important, but I was surprised that I could not find any setting anywhere for this. I could already configure the machine in advance, so any solution would work. Does anyone know whether this is possible, or what changes in interactive sessions create this effect?
I know you did not come here to give advice, but without an output, X + y What to do? If you do not want to store the price or output anywhere, why exactly type it? Your students will be confused: "What does x + y ?" If you want to show some expression, give a print statement next to it, or give it a value. I have found that people are often confused in other ways, so that they do not know that returns actually values them back, and they always print Do not forget that you can implement tasks, and return there. You can then show them that the function returns the value, even print s.
Comments
Post a Comment