Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow write() to print non-string objects #111

Merged

Conversation

sebageek
Copy link
Contributor

@sebageek sebageek commented Feb 8, 2021

Allow write() to print anything that is not a string by converting it
via str(), just like the builtin print() does.

Fixes #34


This version does not do any *args foo just to behave exactly like print. I have found it useful though to just trow any object I currently have into print and have yaspin printig, whatever that may be.

In PR #37 I took a bit of a different approach for converting the text argument to string, but I find it to be more concise this way. If there are plans to drop python2 support somewhen in the future this could also be made a lot simpler.

And, as always, I'm open to discussing this. :)

@sebageek sebageek force-pushed the make-write-print-non-string-objects branch from 84ae048 to 347fad0 Compare February 9, 2021 16:40
@pavdmyt
Copy link
Owner

pavdmyt commented Feb 10, 2021

Hi @sebageek

Thanks for the PR!
I'll try to review it during this week (pretty busy with other stuff right now).

Copy link
Owner

@pavdmyt pavdmyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good, just a few minor fixes and we can proceed with this PR 👍

yaspin/core.py Show resolved Hide resolved
yaspin/core.py Show resolved Hide resolved
tests/test_in_out.py Outdated Show resolved Hide resolved
Allow write() to print anything that is not a string by converting it
via str(), just like the builtin print() does.

Fixes pavdmyt#34
@sebageek sebageek force-pushed the make-write-print-non-string-objects branch from 347fad0 to f566d85 Compare February 18, 2021 14:22
@pavdmyt pavdmyt merged commit 0109ffa into pavdmyt:master Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow write() to print non-string objects
2 participants