I have a function where certain data is being processed, and if the data meets a certain criteria, it's to be handled separate while the rest of the data is being processed.
As an arbitrary example if I'm scraping a web page and collecting all the attributes of an element, one of the elements is a form and just so happens to be hidden, I want to handle it separate, while the rest of the elements can continue being processed:
def get_hidden_forms(element_att):
if element_att == 'hidden':
os.fork()
# handle this seperate
else:
# continue handling any elements that are not hidden
#join both processes
Can this be done with os.fork() or is it intended for another purpose?
I know that os.fork() copies everything about the object, but I could just change values before forking, as stated in this post.