less verbose Python lib
Nico Schlömer <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CAK6Z60e8Pe89KvXP6jPKSA+O+91BMPrRW8Aox1DSY6_bM2xQbw@mail.gmail.com> |
Hi all,
in C++, typical YAML usage looks like
============ *snip* ============
YAML::Emitter out;
out << YAML::BeginSeq;
out << "eggs";
out << "bread";
out << "milk";
out << YAML::EndSeq;
============ *snap* ============
while the same thing in Python is (as far as I know)
============ *snip* ============
print yaml.emit([yaml.StreamStartEvent(),
yaml.DocumentStartEvent(),
yaml.SequenceStartEvent(anchor=None, tag=None, implicit=True),
yaml.ScalarEvent(anchor=None, tag=None,
implicit=(True, False), value=u'eggs'),
yaml.ScalarEvent(anchor=None, tag=None,
implicit=(True, False), value=u'bread'),
yaml.ScalarEvent(anchor=None, tag=None,
implicit=(True, False), value=u'milk'),
yaml.SequenceEndEvent()
])
============ *snap* ============
Is there any way to make this less verbose? (I don't even know why I
need all these options.)
Cheers,
Nico
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/