Wednesday, March 5, 2008

Interactive Python and It's Good Friend _

I had no idea, but when using the interactive Python interpreter, the variable '_' (without quotes, of course) stores the last thing that was successfully printed to the screen.


>>>> 2 ** 8
>256
>>>> _
>256
>>>> _ ** 8
>18446744073709551616L
>>>> 'Oh yeah'
'Oh yeah'
>>> _.split()
['Oh', 'yeah']


You get the idea. How convenient! I should read the docs more often.

No comments:

Post a Comment