En Fri, 26 Dec 2008 03:59:25 -0200, Carl Banks <pavlovevide...@gmail.com>
escribió:
To be honest I am a little concerned over the more-or-less knee-jerk
suggestions to refactor this into a highly object-oriented approach.
For the task at hand the OP's approach is fine (aside from the use of
exec).
Yep. There is a simple solution that still nobody suggested: rename all of
__parse_foo as _parse_foo (single leading underscore), then:
def parse(self, data, data_type)
return getattr(self, "_parse_%s" % data_type)(data)
unless there are strong reasons to keep the __ names.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list