Hi Julien, that’s a very handy tool!
Since you said, that you’re open to suggestions: I have a few.
First of all, I usually try to use as little Python as possible. You could substitute your filtered element collector with a type selector to get rid of your first Python node.
Secondly, I think the functionality of deleting items from the model merits a package of its own, so I would make that into a separate custom node. Actually, thinking about this - it’s hard to believe there’s no built-in node for this. This should most definitely be a built-in node.
Also, I would try to anticipate the case where you only want to delete one item. I actually try to do that with most of my custom nodes, so they stay flexible. To that end, I made the Turn Into List node, that will force any input into a flat list - very handy if you want to pass items to a Python node but you don’t know whether it’s just one object or several or a list of lists.
And finally, I’m not sure if this may ever happen, but I imagine it might: if the delete command fails it might be nice if your graph would still evaluate. That is, of course, a matter of taste. I often use try/except to catch those types of errors and get a list of objects that caused the node to fail - see the attached screenshot of the Python code for details.
And another thought: To me, your custom node is more like a universal workflow for deleting any type of object. I wonder if it wouldn’t make sense to rather publish a node called Delete Objects From List By Name (or something like that) with a string and a list as an input.