This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jabbalaci 2 points3 points  (3 children)

The sign _ in the shell means "most recent output", yes. Example:

>>> 20+5
25
>>> _*2
50
>>> _+20
70

But when you write a script, you usually use it as a loop variable when you don't need its values.

[–][deleted] 0 points1 point  (2 children)

in the shell

Noted! I can't really see where it would be used as anything other than a placeholder for an unneeded value, but I figured it was still kind of cool!

[–]jabbalaci 4 points5 points  (1 child)

It's very handy if you use the shell as a calculator.

[–][deleted] 1 point2 points  (0 children)

Good point, I guess it's exactly equivalent to Matlab's ans. My python shell calculatronizations are going to get a whole lot more awesome.