{"id":2329,"date":"2018-10-26T19:23:20","date_gmt":"2018-10-26T23:23:20","guid":{"rendered":"http:\/\/ninecrows.com\/career\/?p=2329"},"modified":"2018-10-26T11:38:03","modified_gmt":"2018-10-26T15:38:03","slug":"native-extensions-to-python","status":"publish","type":"post","link":"https:\/\/ninecrows.com\/career\/2018\/10\/26\/native-extensions-to-python\/","title":{"rendered":"Native extensions to Python"},"content":{"rendered":"\n<p>I spent a little time last night looking at the coding requirements for creating native (C essentially) extensions to Python. This has come up previously in conversations as another way to make native code accessible functions available for scripting by folks who aren&#8217;t development engineers.<\/p>\n\n\n\n<p>The facility appears similar in style to that provided for writing perl extensions or JNI. No surprise here. I&#8217;ll probably try playing with this a little bit sometime soon just to get a feel for the full series of steps. The process involved in getting the *.dll or *.so file into the right spot to be usable seems a little bit opaque, but perhaps it is just so automated that it isn&#8217;t much of an issue.<\/p>\n\n\n\n<p>I&#8217;m not a huge fan of Python but it has a huge following and seems to be a useful intermediate step between shell scripting sorts of activity and full powered implementation languages (C++\/C#\/Java). <\/p>\n\n\n\n<p>I wish python had not chosen such a poorly conserved item as white-space to represent block scoping (the tabs\/spaces issues are not generally fixable without making the representation issues worse). They also seem to have created a permanent 2.x\/3.x schism where quite a few years after the major version upgrade there is still a substantial amount of code on either side of the divide. Perl 5\/6 had a similar issue, but perl 6 never seems to have taken off so the impact is much smaller.<\/p>\n\n\n\n<p>Some links that seemed useful:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/docs.python.org\/2\/extending\/extending.html\">Extending Python with C or C++<\/a><\/li><li><a href=\"https:\/\/docs.python.org\/3\/extending\/building.html\">Building C and C++ Extensions<\/a><\/li><li><a href=\"https:\/\/www.tutorialspoint.com\/python\/python_further_extensions.htm\">Python &#8211; Extension Programming with C<\/a><\/li><li><a href=\"https:\/\/tutorialedge.net\/python\/python-c-extensions-tutorial\/\">Creating Basic Python C Extensions &#8211; Tutorial<\/a><\/li><li><a href=\"https:\/\/dfm.io\/posts\/python-c-extensions\/\">Python modules in C<\/a><\/li><li><a href=\"https:\/\/pythonextensionpatterns.readthedocs.io\/en\/latest\/\">Coding Patterns for Python Extensions<\/a><\/li><li><a href=\"https:\/\/en.wikibooks.org\/wiki\/Python_Programming\/Extending_with_C\">Python Programming\/Extending with C<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I spent a little time last night looking at the coding requirements for creating native (C essentially) extensions to Python. This has come up previously in conversations as another way to make native code accessible functions available for scripting by folks who aren&#8217;t development engineers. The facility appears similar in style to that provided for &hellip; <a href=\"https:\/\/ninecrows.com\/career\/2018\/10\/26\/native-extensions-to-python\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Native extensions to Python<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[9,71,5,7],"tags":[],"class_list":["post-2329","post","type-post","status-publish","format-standard","hentry","category-daily-blog","category-python","category-thoughts","category-topics"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7F2Qc-Bz","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/2329"}],"collection":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/comments?post=2329"}],"version-history":[{"count":4,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/2329\/revisions"}],"predecessor-version":[{"id":2333,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/posts\/2329\/revisions\/2333"}],"wp:attachment":[{"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/media?parent=2329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/categories?post=2329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ninecrows.com\/career\/wp-json\/wp\/v2\/tags?post=2329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}