Smart config file parsing
Gustavo Niemeyer
gustavo at niemeyer.net
Wed Jun 11 03:03:45 PDT 2008
Cliff Wells wrote:
> Looking at smart/channel.py, it appears that the config file is manually
> parsed, despite the fact that it's just an RFC 822 (ini) file that could
> be much more easily parsed by ConfigParser or equivalent.
>
> Is there a particular reason for this? AFAIK, ConfigParser has been in
> the Python standard library since at least 2.3, so portability shouldn't
> be an issue.
Let me invert the question: is there a particular reason to
use ConfigParser?
The whole channel parsing logic is done in a function of 18 lines, and
that includes the application logic which does the actual processing
of the channel turning it into a Channel instance, and verifying if
the channel has a type. I doubt using ConfigParser would be easier
or simpler, and it'd be slower for sure.
--
Gustavo Niemeyer
http://niemeyer.net
More information about the Smart
mailing list