Python-style Format Strings

Discussion of proposed new features.

Python-style Format Strings

PostPosted by Sir Nate » 08 Aug 2016, 06:01

http://fmtlib.net/latest/index.html provides such. I'll probably use it for my own project regardless, but some of the things provided by the python-style format strings (mostly specifying argument order and repetition) I find to be very useful. Mostly I just want to be able to specify argument order and repetition in strings, which could be done internally, but apparently this library has very good performance (and is already written).
(To be clear, the more recent python format strings, not the copy of the printf style ones, e.g:) Formatting such as ToString("{1} {0} {1}",3.14, "hello") -> "hello 3.14 hello", as opposed to manually having to add the third argument.

If it is added, I would suggest a different function name, such as AsString or FormatString to not break compatability.
User avatar
Sir Nate
Some active
Some active
 
Posts: 64
Joined: 30 Apr 2015, 20:12

Re: Python-style Format Strings

PostPosted by rku » 09 Aug 2016, 07:08

I would love that, but i guess it would provide little to no benefit including it in engine. I mean it would work mostly the same then whats the point..
User avatar
rku
Active user
Active user
 
Posts: 103
Joined: 06 May 2015, 08:24

Re: Python-style Format Strings

PostPosted by hd_ » 09 Aug 2016, 08:19

I had begun work on a pull request previously with this feature, although my implementation wasn't very clean as far as an engine-feature goes. If you come to a clean PR, feel free to submit !
User avatar
hd_
Contributor
Contributor
 
Posts: 220
Joined: 21 Jul 2014, 08:55
Location: Australia


Return to Feature Request

Who is online

Users browsing this forum: No registered users and 0 guests

cron