{"id":648,"date":"2013-07-24T16:02:21","date_gmt":"2013-07-24T23:02:21","guid":{"rendered":"http:\/\/www.partofthething.com\/thoughts\/?p=648"},"modified":"2013-07-24T16:02:21","modified_gmt":"2013-07-24T23:02:21","slug":"import-precedence-for-different-types-of-python-extensions","status":"publish","type":"post","link":"https:\/\/partofthething.com\/thoughts\/import-precedence-for-different-types-of-python-extensions\/","title":{"rendered":"Import precedence for different types of python extensions"},"content":{"rendered":"<p>I was doing some speed tests with cython in Windows and started wondering what the import precedence was between py, pyc, and pyd files (not to mention pyo). So I did a simple little test with two files, test.py and test2.py. Test.py just had a print statement in it and test2 just imported test1 (so it would create the pyc). I compiled test.py with cython into test.pyd and then changed test.py to print something else.<\/p>\n<p>Conclusion: The pyd file was always imported if it was present. If it wasn&#8217;t there, then the new print statement from the new test.py was printed out. I&#8217;m sure this is documented somewhere but I&#8217;m not sure where. The conclusion holds if there are &#8220;optimized&#8221; pyo files present as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was doing some speed tests with cython in Windows and started wondering what the import precedence was between py, pyc, and pyd files (not to mention pyo). So I did a simple little test with two files, test.py and test2.py. Test.py just had a print statement in it and test2 just imported test1 (so &hellip; <a href=\"https:\/\/partofthething.com\/thoughts\/import-precedence-for-different-types-of-python-extensions\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Import precedence for different types of python extensions<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-648","post","type-post","status-publish","format-standard","hentry","category-computers"],"_links":{"self":[{"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/posts\/648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/comments?post=648"}],"version-history":[{"count":0,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/posts\/648\/revisions"}],"wp:attachment":[{"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/media?parent=648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/categories?post=648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/tags?post=648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}