I ha d not read all the e-mails in the thread - but just to announce to people eager for a similar feature - I have a package on pypi that enables one to do:
In [74]: with extradict.MapGetter({'a': 1}) as d: ...: from d import a ...: In [75]: a Out[75]: 1 (just pip install extradict ) On 8 June 2017 at 23:00, Joshua Morton <joshua.morto...@gmail.com> wrote: > While I don't like that syntax, we do know that sets are unhashable, so we > can be certain that that would be a TypeError if it was meant to construct a > set containing a set. (ie. {{foo}} will always result in a TypeError in > python). > > On Thu, Jun 8, 2017 at 1:40 PM Chris Angelico <ros...@gmail.com> wrote: >> >> On Fri, Jun 9, 2017 at 6:02 AM, MRAB <pyt...@mrabarnett.plus.com> wrote: >> > It could also be used on the RHS to pack: >> > >> >>>> a = 1 >> >>>> b = 2 >> >>>> c = 3 >> >>>> d = 4 >> >>>> foo = {{a, b, c, d}} >> >> The trouble with that is that it's syntactically identical to creating >> a set containing a set containing four values. That may cause >> problems. >> >> ChrisA >> _______________________________________________ >> Python-ideas mailing list >> Python-ideas@python.org >> https://mail.python.org/mailman/listinfo/python-ideas >> Code of Conduct: http://python.org/psf/codeofconduct/ > > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/