does the file which is sent as an argument to execfile runs as an independent process / thread or is the code imported and then executed ? . Also i wanted to know how efficient is it compared to running threads / process .
asked Oct 27, 2010 at 13:19
Rahul
11.8k19 gold badges69 silver badges79 bronze badges
-
"compared to running threads / process". It can't be compared. Why do you ask?S.Lott– S.Lott2010年10月27日 13:50:17 +00:00Commented Oct 27, 2010 at 13:50
-
well i didnt know , it cant be compared . the reason i asked was to know how actually it works , since i come from c/c++ background i thought this would work similar to inline function concept or so , which i m unsure of.Rahul– Rahul2010年10月29日 10:00:35 +00:00Commented Oct 29, 2010 at 10:00
1 Answer 1
The file is not run in a separate thread or process, it runs synchronously with the caller.
answered Oct 27, 2010 at 13:23
Ned Batchelder
378k77 gold badges583 silver badges675 bronze badges
Sign up to request clarification or add additional context in comments.
3 Comments
Rahul
well can u elaborate a bit on that . Is it that the code in the file is imported via execfile() and after execution the the next instruction in the parent file is executed ?
Ned Batchelder
yes, exactly. You might try experimenting with it to see how it behaves for your application.
S.Lott
"try experimenting". Good suggestion.
lang-py