Skip to content

Instantly share code, notes, and snippets.

@atdt
Created March 21, 2012 22:21
Show Gist options
  • Select an option

  • Save atdt/2153762 to your computer and use it in GitHub Desktop.

Select an option

Save atdt/2153762 to your computer and use it in GitHub Desktop.
Dart-like print function for Python
-*- 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