This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DotExpandedDict(dict): | |
""" | |
A special dictionary constructor that takes a dictionary in which the keys | |
may contain dots to specify inner dictionaries. It's confusing, but this | |
example should make sense. | |
>>> d = DotExpandedDict({'person.1.firstname': ['Simon'], \ | |
'person.1.lastname': ['Willison'], \ | |
'person.2.firstname': ['Adrian'], \ | |
'person.2.lastname': ['Holovaty']}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
My solution to the Java-vs-C and later lisp-vs-java studies problem. | |
Test files and problem description: http://www.flownet.com/ron/papers/lisp-java/ | |
33 lines of non whitespace non comment code, Took about 3 hours. | |
run: | |
$ python encode.py dictionary.txt input.txt | |
""" |