Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Python sort of did too, you can use _ to access the last-returned variable in the interpreter.

    [testfunc(x) for x in testlist]

    <successful result>

    success = _

    print _

    <successful result>
It's useful when using the interpreter as a calculator, or when you're bashing out some calculation you can never remember how to do properly.


The same thing also works in irb.

    >> "foo"
    => "foo"
    >> bar = _
    => "foo"
    >> bar
    => "foo"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: