>>> def a(): b = lambda: defaultdict(b); return b() >>> x = a(); x[1][2][3] = 'Infinity!'; print dumps(x) {"1": {"2": {"3": "infinity!"}}}Defining B in A prevents renames of A from breaking dictionaries made with B.
prior art
>>> def a(): b = lambda: defaultdict(b); return b() >>> x = a(); x[1][2][3] = 'Infinity!'; print dumps(x) {"1": {"2": {"3": "infinity!"}}}Defining B in A prevents renames of A from breaking dictionaries made with B.
Hacker Poesy is a GNU social hub. It runs version 1.1.3-beta3, available under the GNU Affero General Public License.
All Hacker Poesy content and data are available under the Creative Commons Attribution 3.0 license.