[bip] Bioinformatics Programming Language Shootout, Python performance poopoo'd
Paul Davis
paul.joseph.davis at gmail.com
Fri Feb 8 17:04:33 PST 2008
>
> > I'm not a C++ programer any more - haven't been for 10 years - so
> > there's probably cleaner ways to do some of this.
>
> Duh! I forgot about sscanf. That's been the way to do this sort of
> lightweight parsing in C for 30+ years, and it works just fine with C+
> + strings. It does about as much validation as the regexp patterns do.
>
Not to be a picky bastard about a different language, but sscanf
generally shouldn't be used in C++ code.
Variable arguments and their inherent lack of typesafety pretty much
violate every aspect of C++. Or to put it differently, C++ BDFL
Stroustrup says don't use them.
Basic formatted input would be accomplished with the istringstream
extraction operator.
template <class T>
std::istringstream::operator>>(T& dest)
But, that'd kill your LOC count...
Just my $0.02
Paul Davis
More information about the biology-in-python
mailing list