2015-02-10 1:29 GMT+01:00 Neil Girdhar <mistersh...@gmail.com>: > For some reason I can't seem to reply using Google groups, which is is > telling "this is a read-only mirror" (anyone know why?) Anyway, I'm going > to answer as best I can the concerns. > > Antoine said: > >> To be clear, the PEP will probably be useful for one single line of >> Python code every 10000. This is a very weak case for such an intrusive >> syntax addition. I would support the PEP if it only added the simple >> cases of tuple unpacking, left alone function call conventions, and >> didn't introduce **-unpacking. > > > To me this is more of a syntax simplification than a syntax addition. For > me the **-unpacking is the most useful part. Regarding utility, it seems > that a many of the people on r/python were pretty excited about this PEP: > http://www.reddit.com/r/Python/comments/2synry/so_8_peps_are_currently_being_proposed_for_python/
I used grep to find how many times dict.update() is used. haypo@selma$ wc -l Lib/*.py (....) 112055 total haypo@selma$ grep '\.update(.\+)' Lib/*.py|wc -l 63 So there are 63 or less (it's a regex, I didn't check each line) calls to dict.update() on a total of 112,055 lines. I found a few numbers of codes using the pattern: "dict1.update(dict2); func(**dict1)". Examples: functools.py: def partial(func, *args, **keywords): def newfunc(*fargs, **fkeywords): newkeywords = keywords.copy() newkeywords.update(fkeywords) return func(*(args + fargs), **newkeywords) ... return newfunc => def partial(func, *args, **keywords): def newfunc(*fargs, **fkeywords): return func(*(args + fargs), **keywords, **fkeywords) ... return newfunc The new code behaves differently since Neil said that an error is raised if fkeywords and keywords have keys in common. By the way, this must be written in the PEP. pdb.py: ns = self.curframe.f_globals.copy() ns.update(self.curframe_locals) code.interact("*interactive*", local=ns) Hum no sorry, ns is not used with ** here. Victor _______________________________________________ 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/archive%40mail-archive.com