spongebob
spongebob copied to clipboard
spongebobcase.spongebobsay() prints two copies
I installed spongebobcase 0.4.0 from PyPi today and ran this
import spongebobcase
print(spongebobcase.spongebobsay("this is working"))
And got two spongebobs!

oh I see, I think you must be both printing AND returning. When I assign to a variable I only get one printed

There is a print_ argument that controls whether it prints internally in the function. Happy to take feedback about if that seems intuitive.
https://jayqi.github.io/spongebob/py-pkg/api-reference/spongebobsay/#spongebobcase.spongebobsay.spongebobsay
It's the same way the R function works
https://jayqi.github.io/spongebob/r-pkg/reference/spongebobsay.html
R has the concept of returning invisibly but unfortunately Python does not.
ooooo I didn't realize! Ok my fault for not RTFM.
My expectation from using {cowsay} in the past was that I could just run this function and it would print one thing, without me needing to do any assignment.
I think that argument does what I want, but seeing it I would have expected it's default value to be False. I expect that the interactive case is a lot more common than the "return a value" case.
Anyone, that did answer my question so you can close this, thanks!
Yeah, I mean, it's kind of tricky. I meant for the print_ argument to be there for the interactive case, and I personally do _ = spongebobsay("whatever") to suppress the returned string. In R, it both prints and returns the string the same way, but the string is just returned invisibly.