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

Implement string formatting #2

Open
rochacbruno opened this issue Jun 7, 2017 · 1 comment
Open

Implement string formatting #2

rochacbruno opened this issue Jun 7, 2017 · 1 comment

Comments

@rochacbruno
Copy link
Collaborator

rochacbruno commented Jun 7, 2017

This joke can be really useful if implements this

a = '12'
b = 2.7182
lst = f['{a:d}',  '{b:.3f}']
12, 2.718

The way I found to implement this is getting all sttring occurences in the args and pass it through .format passing the globals dictionary.

@Carreau
Copy link
Owner

Carreau commented Jun 7, 2017

Arguably that should be f[f'{a:d}', f'{b:.3f}'] no? You can also inspect.get_frames() and look up to have it work in local scopes I guess. Happy to get that in if you think it is useful. Though if we go that route we'll have to ass some tests and documentation 😆

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

No branches or pull requests

2 participants