[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Sun Jun 4 17:40:50 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=1094
--- Comment #43 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Dmitry Selyutin from comment #42)
> I'd like something intermediate between context managers (which are simple
> but not flexible) and pyomo (which perhaps powerful but overkill).
trust me it only looks that way because it is a new concept and use-cases
haven't been envisaged/understood yet :)
pyomo's code can actually call contextmanagers.
> How about three methods to be overriden?
ngggh, the Visitor-pattern doesn't quite work that way
(the python-html-walker doesn't either: the functions
all conform to "handle_{database_sub-type}_{start/end}" )
okok one way to *make* it conform is for the functions to
be:
def handle_start(DATABASE_TYPE, node, data):
def handle_child(DATABASE_TYPE, node, child_idx, child_data):
def handle_end(DATABASE_TYPE, node, data):
instead of handle_db_start handle_db_child handle db_end
it is
handle_start("db",...)
handle_child("db", ...)
handle_en ("db", ...)
but this way also lies another form of madness: a massive suite
of "if DATABASE_TYPE == 'db' do this else do that"
in every visitor-instance
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list