Created
March 21, 2012 22:21
-
-
Save atdt/2153762 to your computer and use it in GitHub Desktop.
Dart-like print function for Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -*- coding: utf-8 -*- | |
| """ | |
| Dart-like print function | |
| (C) 2012 by Ori Livneh | |
| MIT License | |
| """ | |
| from __future__ import print_function | |
| import inspect | |
| import string | |
| def sprint(template): | |
| template = string.Template(template) | |
| caller_frame = inspect.stack()[1][0] | |
| print(template.safe_substitute(**caller_frame.f_locals)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment