Different inputs for an "IF" node issue

I came across a pretty interesting problem:

@Zschlave posted a question about lists with subitems:

I thought I had found a solution:


As you can see it doesn’t work.

@kennyb6 responded to me and we figured there needs to be a degree of consistency between the true and false inputs.

Anyway. I thought I’d just share the issue here. I’m not necessarily looking for a solution (although you might indirecly solve @Zschlave’s problem with it). I do already know that creating the same thing with just a code block doesn’t work either (in fact that was the first thing I tried).

1 Like

I see 2 approaches here:

image

1 Like

I’m not completely sure what happens here (my Python knowledge really isn’t good enough for that).
If I’m understanding correctly, with the first python script you’re basically doing what I was doing in Dynamo but in Python, which then works because it’s in Python.

Here’s a node approach for the second option:

As @Ritesh_Chandawar pointed out in the other thread, there is another node that works the way @PauLtus wants, which is ScopeIf. It does not matter what the structure of the true and false inputs are, it will return it as is.

1 Like

I saw it.
Pretty funny these things just happen to exist.
I do wonder why you’d ever use the regular If node then. Might be more efficient, maybe you occasionally want the error to show up before there’s a bigger problem spreading though the entire code.

2 Likes

I guess in a way, if node is like if + normalize depth built into one, which may be more useful or rather more common than a non normalized depth testing.