You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for _ and , separators for Python formats (#68)
* Support _ as well as comma for pyfmt
* Implement and cleanup support for , and _ separators for Python formats
* Add more tests for Python separators
Copy file name to clipboardexpand all lines: README.md
+14-16
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,16 @@ This package offers Python-style general formatting and c-style numerical format
34
34
35
35
## Getting Started
36
36
37
-
This package is pure Julia. It is now registered, so it can be added simply with `Pkg.add("Format")`.
37
+
This package is pure Julia. Setting up this package is like setting up other Julia packages:
38
+
39
+
```julia
40
+
Pkg.add("Format")
41
+
```
42
+
or
43
+
```julia
44
+
]add Format
45
+
```
46
+
38
47
It is forked off of [Formatting.jl](https://github.com/JuliaIO/Formatting.jl), and I try to keep the oldmaster branch up to date with the master branch of that, and cherry pick or port all necessary changes to `Format`).
39
48
40
49
To start using the package, you can simply write
@@ -43,7 +52,7 @@ To start using the package, you can simply write
43
52
using Format
44
53
```
45
54
46
-
This package depends on Julia of version 0.6 or above, and. The package is MIT-licensed.
55
+
This package depends on Julia of version 1.4 or above, and. The package is MIT-licensed.
47
56
48
57
49
58
## Python-style Types and Functions
@@ -133,10 +142,6 @@ One can use ``pyfmt`` to format a single value into a string, or ``format`` to f
133
142
134
143
At this point, this package implements a subset of Python's formatting language (with slight modification). Here is a summary of the differences:
135
144
136
-
-``g`` and ``G``for floating point formatting have not been supported yet. Please use ``f``, ``e``, or ``E`` instead.
137
-
138
-
- The package currently provides default alignment, left alignment ``<`` and right alignment ``>``. Other form of alignment such as centered alignment ``^`` has not been supported yet.
139
-
140
145
- In terms of argument specification, it supports natural ordering (e.g. ``{} + {}``), explicit position (e.g. ``{1} + {2}``). It hasn't supported named arguments or fields extraction yet. Note that mixing these two modes is not allowed (e.g. ``{1} + {}``).
141
146
142
147
- The package provides support for filtering (for explicitly positioned arguments), such as ``{1|>lowercase}`` by allowing one to embed the ``|>`` operator, which the Python counter part does not support.
@@ -171,19 +176,12 @@ fmtrfunc = generate_formatter( fmt ) # usage 2. This bypass repeated lookup of c
171
176
s = fmtrfunc( 3.14159 )
172
177
173
178
s = format( 3.14159, precision=3 ) # usage 3. Most flexible, with some non-printf options. Least performant.
174
-
```
175
-
### Speed
176
-
177
-
`cfmt`: Speed penalty is about 20%for floating point and 30%for integers.
178
-
179
-
If the formatter is stored and used instead (see the example using`generate_formatter` above),
180
-
the speed penalty reduces to 10%for floating point and 15%for integers.
181
179
182
180
### Commas
183
181
184
-
This package also supplements the lack of thousand separator e.g. `"%'d"`, `"%'f"`, `"%'s"`.
182
+
This package also supplements the lack of thousand separator e.g. `"%'d"`, `"%'f"`, `"%'g"`.
185
183
186
-
Note:`"%'s"` behavior is that for small enough floating point (but not too small),
184
+
Note: `"%'g"` behavior is that for small enough floating point (but not too small),
187
185
thousand separator would be used. If the number needs to be represented by `"%e"`, no
0 commit comments