
On Mon, Aug 10, 2015 at 1:52 PM, David Mertz <mertz@gnosis.cx> wrote:
I know. I elided including the nonexistent `nonlocals()` in there. But it *should* be `lngb()`. Or call it scope(). :-) On Aug 10, 2015 10:09 AM, "Steven D'Aprano" <steve@pearwood.info> wrote:
On Sun, Aug 09, 2015 at 06:14:18PM -0700, David Mertz wrote:
[...]
That said, there *is* one small corner where I believe f-strings add something helpful to the language. There is no really concise way to spell:
collections.ChainMap(locals(), globals(), __builtins__.__dict__).
I think that to match the normal name resolution rules, nonlocals() needs to slip in there between locals() and globals(). I realise that there actually isn't a nonlocals() function (perhaps there should be?).
If we could spell that as, say `lgb()`, that would let str.format() or %-formatting pick up the full "what's in scope". To my mind, that's the only good thing about the f-string idea.
I like the concept, but not the name. Initialisms tend to be hard to remember and rarely self-explanatory. How about scope()?
#letsgoblues! scope(**kwargs), lngb(**kwargs), lookup(**kwargs) could allow for local attr override.
-- Steve _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/mertz%40gnosis.cx
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/wes.turner%40gmail.com