Added some number formatting capability#1
Added some number formatting capability#1deleted wants to merge 13 commits intodavidchambers:masterfrom
Conversation
All original tests now pass, plus new tests involving string formatting.
|
Thanks for the pull request, Ted. This functionality will make a nice addition. :) I'll review the changes now for style issues; I probably won't have time to review the pull request in depth until the weekend. |
README.md
Outdated
There was a problem hiding this comment.
Should be davidchambers's (according to the Chicago Manual of Style). :D
|
David, Thank you for reviewing my work, and bearing with my on style issues as this is my first adventure in Coffeescript. I've pushed two commits to my master that address your comments and make a few other changes for tidiness, consistency, and style. Tests still pass. |
|
Thanks, Ted. I look forward to familiarizing myself with this "mini-language" and reviewing these changes in earnest. |
test/string-format.coffee
Outdated
There was a problem hiding this comment.
Python (2.7.2) behaves differently:
>>> '{:03.2f}'.format(1.2345)
'1.23'
There was a problem hiding this comment.
You are correct. It helps to actually test against the python behavior. Fixed and added some additional tests.
|
Were you able to find comprehensive string formatting tests in Python's source code? I had a look, but the test cases I found in various files are not comprehensive, even collectively. |
Hi, davidchambers.
I added some functionality to string-format that allows you to specify number sign, float precision, and field padding.
Your tests pass and I added a few of my own. Any interest in merging this?
It now has the regexp-fu to parse everything in the python string format mini-language, although it doesn't implement absolutely everything yet. I implemented what I needed for the project I was working on. Perhaps someone else or a future me will be motivated to finish the job.
If you do decide to merge, you will want to change the part in the readme about this being a fork.
Cheers,
Ted Scharff