On 05/06/2010 11:11, Gabriel Genellina wrote:
On 31 mayo, 08:11, moerchendiser2k3<googler.
1.webmas...@spamgourmet.com> wrote:
you are right, Python still holds the last
reference. I just set a dummy and thats it :)
Can you tell me where did you get the information from?
Do you mean the _ variable?
It's in the tutorial:
http://docs.python.org/tutorial/introduction.html#using-python-as-a-calculator
--
Gabriel Genellina
I have always believed that the _ variable is only available
interactively because of this comment in the tutorial:-
"In interactive mode, the last printed expression is assigned to the
variable _. This means that when you are using Python as a desk
calculator, it is somewhat easier to continue calculations, for example:
..."
However a thread from IIRC a couple of days back used _ to say "I'm not
interested in you, I'm throwing you away" in a list comprehension or
whatever. I've tried this in a script this evening and it works perfectly.
print 'total', sum(amount for _, amount in outputs)
Where is the use of _ in a script documented, I've searched all over and
can't find it, guess I don't have the Midas touch with google? :)
Kindest regards.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list