"if request.pipeline.command_stack != []"
No
That's the worse way to checking it's empty, even if pipeline was a python list
And this pipeline is interesting, but in this case, it's useful for setting values, not reading them.
No
That's the worse way to checking it's empty, even if pipeline was a python list
And this pipeline is interesting, but in this case, it's useful for setting values, not reading them.
It implements __len__ so there's your answer
if request.pipeline.command_stack: request.pipeline.execute()
rather than
if len(request.pipeline) > 0: request.pipeline.execute()
thoughts?
(Yes, if len returns 0 it's evaluated as false, just tested this)
But for the 2nd I would prefer
if not len(request.pipeline):
you want to execute only if it has a length.
cool though, I am using pipelines for something at work and read this post and realized I was executing even if there was nothing to execute!
I don't know why I put the 'not' there