[Python-Dev] Should PEP 498 specify if rf'...' is valid?

Eric V. Smith eric at trueblade.com
Thu Oct 22 07:32:30 EDT 2015


On 10/21/2015 10:57 PM, Ryan Gonzalez wrote:
> It mentions fr'...' as a formatted raw string but doesn't say anything
> about rf'...'. Right now, in implementing PEP 498 support in Howl
> (https://github.com/howl-editor/howl/pull/118 and
> https://github.com/howl-editor/howl/commit/1e577da89efc1c1de780634b531f64346cf586d6#diff-851d9b84896270cc7e3bbea3014007a5R86),
> I assumed both were valid. Should the PEP be more specific?

Yes, I'll add some wording. Note that currently, there are 24 valid
prefixes:

['B', 'BR', 'Br', 'F', 'FR', 'Fr', 'R', 'RB', 'RF', 'Rb', 'Rf', 'U',
'b', 'bR', 'br', 'f', 'fR', 'fr', 'r', 'rB', 'rF', 'rb', 'rf', 'u']

> BTW, at the rate language-python is going, GitHub will get syntax
> highlighting for f-strings in 2050. :D

Heh. If we add binary f-strings, there are 80 permutations:

['B', 'BF', 'BFR', 'BFr', 'BR', 'BRF', 'BRf', 'Bf', 'BfR', 'Bfr', 'Br',
'BrF', 'Brf', 'F', 'FB', 'FBR', 'FBr', 'FR', 'FRB', 'FRb', 'Fb', 'FbR',
'Fbr', 'Fr', 'FrB', 'Frb', 'R', 'RB', 'RBF', 'RBf', 'RF', 'RFB', 'RFb',
'Rb', 'RbF', 'Rbf', 'Rf', 'RfB', 'Rfb', 'U', 'b', 'bF', 'bFR', 'bFr',
'bR', 'bRF', 'bRf', 'bf', 'bfR', 'bfr', 'br', 'brF', 'brf', 'f', 'fB',
'fBR', 'fBr', 'fR', 'fRB', 'fRb', 'fb', 'fbR', 'fbr', 'fr', 'frB',
'frb', 'r', 'rB', 'rBF', 'rBf', 'rF', 'rFB', 'rFb', 'rb', 'rbF', 'rbf',
'rf', 'rfB', 'rfb', 'u']

I think the upper/lower ones are nuts, but it's probably too late to do
anything about it. 'FbR', really?

Eric.


More information about the Python-Dev mailing list