Custom Query (121 matches)
Results (10 - 12 of 121)
I would like to bring up two issues with Unicode support in PyYAML's emitter. First, it emits a type annotation of !!python/unicode whenever emitting a unicode string that can be encoded in ASCII:
>>> print yaml.dump(u'Fran\xe7ais') "Fran\xE7ais" >>> print yaml.dump(u'hello') !!python/unicode 'hello'
I assume this is to force the value to be a unicode string when read back in. However, it makes for rather ugly files. In my case, and I imagine many others, I really don't care whether a string is stored as a 'str' or as a 'unicode' object in Python. And in YAML, the native string type is Unicode anyway. So it seems strange to have this distinction at the level of the YAML file. On the other hand, I understand the desire to have yaml.load(yaml.dump(x)) == x. Perhaps this should be another configuration option? (Of course, I could just convert my ASCII-encodable unicode objects to str objects...)
The second issue is that the emitter escapes non-ASCII characters even when all characters are printable (according to 'c-printable' in the YAML spec) when using an encoding (UTF8) that supports such characters. I don't find this as elegant as could be. Instead of the "Fran\xE7ais" output above, I would have hoped for the UTF8-encoded byte string Fran\xc3\xa7ais\n.
I guess this is as stylistic an issue as the previous one. It makes me wonder again whether there should be a Style object that can specify various emitting options, instead of many keyword arguments...
|#12||fixed||PyYAML is slow||xi||edemaine@…|
Here are two simple wall-clock timings comparing PyYAML to PySyck on a Pentium 4 2.8GHz with 1MB cache and 1GB RAM:
$ wc file1.yaml 2036 8767 59154 file1 $ test.py file1.yaml 0:00:00.001419 to read the YAML via Syck 0:00:04.029627 to read the YAML via PyYAML $ wc file2.yaml 8949 35105 317342 file2 $ test.py file2.yaml 0:00:00.001564 to read the YAML via Syck 0:00:19.288912 to read the YAML via PyYAML
I do not expect PyYAML to be terribly competitive with Syck: the language barrier is big, and PyYAML is written with a higher level of abstraction. But I was surprised to see a factor of 12,000 difference. I wonder if a bit of profiling and tuning might reduce this gap to just a couple of orders of magnitude (100x) instead of four? Personally, 19 seconds to read a 0.3 meg file is too slow for my application, so I'll have to switch back to Syck for now, unfortunately. Just food for thought...
|#13||fixed||Windows install broken||xi||anonymous|
None of the source files install except the EGG-INFO directory.
C:\>easy_install -Z PyYAML Searching for PyYAML Reading http://www.python.org/pypi/PyYAML/ Reading http://pyyaml.org/wiki/PyYAML Best match: PyYAML 3.01 Downloading http://pyyaml.org/download/pyyaml/PyYAML-3.01.win32.exe Processing PyYAML-3.01.win32.exe WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/resolver.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/parser.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/scanner.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/error.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/composer.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/loader.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/events.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/dumper.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/tokens.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/serializer.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/constructor.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/representer.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/__init__.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/nodes.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/reader.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/emitter.py creating 'c:\docume~1\user\locals~1\temp\easy_install-wfs0iv\PyYAML-3.01-py2.4-w in32.egg' and adding 'c:\docume~1\user\locals~1\temp\easy_install-wfs0iv\PyYAML- 3.01-py2.4-win32.egg.tmp' to it creating c:\python24\lib\site-packages\PyYAML-3.01-py2.4-win32.egg Extracting PyYAML-3.01-py2.4-win32.egg to c:\python24\lib\site-packages Adding PyYAML 3.01 to easy-install.pth file Installed c:\python24\lib\site-packages\pyyaml-3.01-py2.4-win32.egg Processing dependencies for PyYAML C:\>