Necarion
Necarion

Reputation: 105

Shortcut for print() function in Spyder

Yes I know that using print() as a function rather than a statement is "better" in a bunch of ways. I still hate it, in part because it makes debugging and checking things so much more annoying. If you had a line

do_thing(stuff)

and you wanted to see if it was doing what you thought it was, you could just add a print to it and get

print do_thing(stuff)

However, adding the parentheses can sometimes be a bit fiddly.

Yes I know I'm lazy, but is there a shortcut in Spyder or other consoles for highlighting a line of text and putting a print() wrapper around it like it does for parentheses (which is about 80:20 useful:annoying)

Thanks!

Upvotes: 0

Views: 838

Answers (1)

Carlos Cordoba
Carlos Cordoba

Reputation: 34156

(Spyder maintainer here) You can do this, and not only for print but for any function, by going to the menu

Tools > Preferences > IPython console > Advanced settings > Autocall

and selecting there the Smart or Full options.

To learn about the difference between them, please go here (Smart is equivalent to Active and Full to Active always).

Upvotes: 1

Related Questions