[Python-ideas] Briefer string format

Stephen J. Turnbull stephen at xemacs.org
Tue Jul 21 06:22:18 CEST 2015

Ryan Gonzalez writes:
 > >I suppose the OP will claim that an explicit call to locals() is
 > >verbose and redundant, but if that really is a problem:
 > >
 > >    def format_with_locals(fmtstr):
 > >        return fmtstr % locals()
 > >
 > Won't this use the locals of the function format_with_locals over its caller?

Yes, it will.  I apologize for posting untested code.

More information about the Python-ideas mailing list