{"id":329462,"date":"2023-05-29T15:13:00","date_gmt":"2023-05-29T15:13:00","guid":{"rendered":"http:\/\/itteacheritfreelance.hk\/wordpress\/?guid=f2cdee4a8f8cb2ab334d2d85290f0355"},"modified":"2023-05-29T15:13:00","modified_gmt":"2023-05-29T15:13:00","slug":"the-python-language-summit-2023-lightning-talks","status":"publish","type":"post","link":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/2023\/05\/29\/the-python-language-summit-2023-lightning-talks\/","title":{"rendered":"The Python Language Summit 2023: Lightning Talks"},"content":{"rendered":"<p class=\"syndicated-attribution\"><meta name= \\\"keywords \\\" content= \\\"\u96fb\u5b50\u8a08\u7b97\u6a5f, \u6559\u80b2, IT \u96fb\u8166\u73ed,\u96fb\u8166\u88dc\u7fd2\uff0c \u96fb\u8166\u73ed\uff0c \u5bb6\u6559\uff0c \u79c1\u4eba\u8001\u5e2b\uff0c \u8cc7\u8a0a\u6280\u8853\uff0c \u7a0b\u5e8f\u8a2d\u8a08\uff0c \u96fb\u5b50\u8a08\u7b97\u6a5f\uff0c \u904a\u6232\uff0c \u860b\u679c\uff0c \u96fb\u5f71\uff0c \u8a08\u7b97\u6a5f\uff0c\u7de8\u78bc\uff0c Java\uff0c C\/C++\uff0c JavaScript\uff0c PHP\uff0c HTML\uff0c CSS\uff0c MySQL\uff0c mobile\uff0c Android\uff0c \u52d5\u6f2b\uff0c Python\uff0c teacher\uff0c \u88dc\u7fd2\uff0c \u96fb\u8166\u88dc\u7fd2 \u8cc7\u8a0a, \u7535\u5b50\u8ba1\u7b97\u673a, IT ,Game, apple, movie, Computer,student,Java,\u6559\u80b2, ,\u5b66\u751f, \u5b66\u4e60, learn, \u6559\u5b66,  Android, apple,anime, animation, \u4fe1\u606f\u6280\u672f, \u7a0b\u5e8f\u8bbe\u8ba1, \u79fb\u52a8\u7535\u8bdd, \u8cc7\u8a0a\u79d1\u6280,Game, Jeu, Juego,Call Of Duty ,\u4f7f\u547d\u53ec\u559a , \u6e38\u620f, \u7535\u5b50\u6e38\u620f,, \u591a\u4eba\u7535\u5b50\u6e38\u620f, \u7f51\u7edc\u6e38\u620f\uff0conline\uff0conline game, \u624b\u673a\u6e38\u620f, mobile \\\"><\/p>\n<div class=\"markdown-body container-fluid comment-inner comment-enabled\" data-hard-breaks=\"true\" id=\"doc\">The <a href=\"https:\/\/pyfound.blogspot.com\/2023\/05\/the-python-language-summit-2023_29.html\" rel=\"nofollow\" >Python Language Summit 2023<\/a> closed off with a trio of lightning talks from Dong-hee Na, Carl Meyer and Amethyst Reese.<\/div>\n<div class=\"markdown-body container-fluid comment-inner comment-enabled\" data-hard-breaks=\"true\" id=\"doc\"><\/div>\n<div class=\"markdown-body container-fluid comment-inner comment-enabled\" data-hard-breaks=\"true\" id=\"doc\"><\/div>\n<hr \/>\n<div class=\"markdown-body container-fluid comment-inner comment-enabled\" data-hard-breaks=\"true\" id=\"doc\"><\/div>\n<div class=\"markdown-body container-fluid comment-inner comment-enabled\" data-hard-breaks=\"true\" id=\"doc\">\n<h2 class=\"raw\"><span>Dong-hee Na: Let\u2019s support LLVM-BOLT as an official feature<\/span><\/h2>\n<p><span>CPython Core Developer Dong-hee Na gave a short presentation on the LLVM-BOLT optimiser, arguing that we should support it as a standard feature of CPython.<\/span><\/p>\n<p><span>LLVM-BOLT is a \u201cpost link time binary optimiser\u201d that was adopted by <\/span><a href=\"https:\/\/github.com\/pyston\" rel=\"noopener\" ><span>the Pyston project<\/span><\/a><span>, a performance-oriented fork of CPython 3.8. The Pyston team had reported that use of the optimiser resulted in performance gains of 2-4% on their benchmarks, although the&nbsp;<\/span><a href=\"https:\/\/devblogs.microsoft.com\/python\/python-311-faster-cpython-team\/\" rel=\"noopener\" ><span>Faster CPython team<\/span><\/a><span>&nbsp;and Dong-hee Na <a href=\"https:\/\/github.com\/faster-cpython\/ideas\/issues\/224\" rel=\"nofollow\" >had reported smaller returns<\/a> when they had applied the optimiser to Python 3.11.<\/span><\/p>\n<p><span>Dong-hee Na showed benchmark results that showed significant speedups in some areas with LLVM-BOLT applied to Python 3.12, but noted that LLVM-BOLT also caused regressions in some other areas due to overly aggressive optimisations. He announced that he had added support for LLVM-BOLT to CPython as an optional compile-time flag, <\/span><code>--enable-bolt<\/code><span>, to allow experimentation with the feature.<\/span><\/p>\n<p><span><br \/><\/span><\/p>\n<p><span><\/span><\/p>\n<table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"tr-caption-container\" style=\"margin-left: auto; margin-right: auto;\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a href=\"https:\/\/blogger.googleusercontent.com\/img\/a\/AVvXsEi0d1JAcXu962gjfuEKscZMczSxI7IAnt7EvD_MLu7BoMClEYxIl1fzdlnSbnYa0XzvfM-gOLOia2dIUewL6JFgbyjeBtYUUKR9Mpshg_7U0fwqXhY9Mkeg-uV3D5Ru-uKyUOswg2hySU6kGflLpBWY-kJ3gC3960SODPRsmASkuiavjbU\" style=\"margin-left: auto; margin-right: auto;\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" data-original-height=\"768\" data-original-width=\"1366\" height=\"180\" src=\"https:\/\/blogger.googleusercontent.com\/img\/a\/AVvXsEi0d1JAcXu962gjfuEKscZMczSxI7IAnt7EvD_MLu7BoMClEYxIl1fzdlnSbnYa0XzvfM-gOLOia2dIUewL6JFgbyjeBtYUUKR9Mpshg_7U0fwqXhY9Mkeg-uV3D5Ru-uKyUOswg2hySU6kGflLpBWY-kJ3gC3960SODPRsmASkuiavjbU\" width=\"320\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">A slide from Dong-hee Na&#8217;s talk on LLVM-Bolt<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span><\/p>\n<p><\/span><\/p>\n<hr \/>\n<\/p>\n<p><span><br \/><\/span><\/p>\n<h2 class=\"raw\"><span>Carl Meyer: Lazy Imports \u2013 the sequel<\/span><\/h2>\n<p><span>Carl Meyer instigated a short discussion on proposals to introduce a mechanism enabling lazy imports in Python. Following <\/span><a href=\"https:\/\/pyfound.blogspot.com\/2022\/05\/the-2022-python-language-summit.html\" rel=\"noopener\" ><span>Meyer\u2019s lightning talk on the same subject last year<\/span><\/a><span>, Meyer \u2013 along with his colleague, Germ\u00e1n M\u00e9ndez Bravo (who, according to Meyer, deserves \u201cmost of the credit\u201d) \u2013 had written <\/span><a href=\"https:\/\/peps.python.org\/pep-0690\/\" rel=\"noopener\" ><span>PEP 690<\/span><\/a><span>, proposing a compile-time flag that would make imports in Python lazy by default. The PEP, however, was <\/span><a href=\"https:\/\/discuss.python.org\/t\/pep-690-lazy-imports-again\/19661\/26\" rel=\"noopener\" ><span>rejected by the Steering Council<\/span><\/a><span> in December 2022, due to concern that the new flag would have created a split in the community between programmers who used Python with lazy imports enabled, and those who used Python with eager imports.<\/span><\/p>\n<p><span>Meyer\u2019s question to the audience was: where next for lazy imports? Was it worth modifying the proposal and trying again, or was the whole idea doomed? Meyer noted that the team at Instagram, where he worked, had seen start-up time improvements of 50-80%, and 40-90% reductions in memory usage, by adopting lazy imports in the <\/span><a href=\"https:\/\/github.com\/facebookincubator\/cinder\" rel=\"noopener\" ><span>fork of CPython<\/span><\/a><span> they used for the Instagram web server.<\/span><\/p>\n<p><span>Meyer floated a series of possible changes (some mutually exclusive) that could be made to the PEP. For each possible change, he asked if the change would make attendees more or less likely to support adding support for lazy imports to Python:<\/span><\/p>\n<ol>\n<li><span>Explicit opt-in syntax marking a specific import as lazy (e.g. <\/span><code>lazy import inspect<\/code><span>).<\/span><\/li>\n<li><span>A clear roadmap detailed in the PEP, outlining the timeframe in which it was expected that lazy-import behaviour would become the default in Python.<\/span><\/li>\n<li><span>A promise that the implementation of lazy imports would not lead to any changes being made to the <\/span><code>dict<\/code><span> data structure.<\/span><\/li>\n<li><span>Generalised support of \u201clazy names\u201d, rather than just support for lazy <\/span><em><span>imports<\/span><\/em><span> specifically.<\/span><\/li>\n<\/ol>\n<p><span>The room unanimously agreed that change (3) would make them more likely to support the PEP, and largely agreed that change (4) would make them less likely to support it. The room was (frustratingly, for Meyer) split on whether proposals (1) and (2) would make them more or less likely to give the PEP their support.<\/span><\/p>\n<p><span>On the bright side, only one attendee said they thought they could never support a proposal for lazy imports in Python. <\/span><em><span>Unfortunately<\/span><\/em><span> for Meyer, the attendee in question was Thomas Wouters, currently serving on the Steering Council.<\/span><\/p>\n<p><span style=\"font-size: medium;\"><br \/><\/span><\/p>\n<h2 class=\"raw\">\n<hr \/>\n<\/h2>\n<h2 class=\"raw\"><span style=\"font-size: medium;\"><br \/><\/span><\/h2>\n<h2 class=\"raw\"><span>Amethyst Reese: Can we <\/span><code>__call__<\/code><span> modules?<\/span><\/h2>\n<p><span>Amethyst Reese presented on an idea that has since become <\/span><a href=\"https:\/\/peps.python.org\/pep-0713\/\" rel=\"noopener\" ><span>PEP 713<\/span><\/a><span>: a proposal to add a mechanism allowing developers to easily create callable modules.<\/span><\/p>\n<p><span><br \/><\/span><\/p>\n<p><span><\/span><\/p>\n<table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"tr-caption-container\" style=\"margin-left: auto; margin-right: auto;\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a href=\"https:\/\/blogger.googleusercontent.com\/img\/a\/AVvXsEiY5RbnRYMXpHo5AYTKNrKuRGJH9uwQ8158ypEk9tb09F7AK_XpST-9SfY9Prn6Rw8fd1syzEqVRTCzuPVrTAjYn8VGJmJbIjhaxwWjG8STo6SU9m4ais2PKwQPlHJ_ByqK20J9uWbojLt2ojf3LgSeFVy7RG1L4UjCF7Ol1i3hGYZ7Wyw\" style=\"margin-left: auto; margin-right: auto;\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" data-original-height=\"719\" data-original-width=\"959\" height=\"240\" src=\"https:\/\/blogger.googleusercontent.com\/img\/a\/AVvXsEiY5RbnRYMXpHo5AYTKNrKuRGJH9uwQ8158ypEk9tb09F7AK_XpST-9SfY9Prn6Rw8fd1syzEqVRTCzuPVrTAjYn8VGJmJbIjhaxwWjG8STo6SU9m4ais2PKwQPlHJ_ByqK20J9uWbojLt2ojf3LgSeFVy7RG1L4UjCF7Ol1i3hGYZ7Wyw\" width=\"320\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">Amethyst Reese at the Python Language Summit<br \/>(Photo by Hugo van Kemenade)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span><\/p>\n<p><\/span><\/p>\n<p><span>Strictly speaking, it\u2019s <\/span><em><span>possible<\/span><\/em><span> to create a callable module today, but it\u2019s not exactly easy. The example given in the PEP looks something like the following:<\/span><\/p>\n<pre><code class=\"python hljs\"><div class=\"wrapper\"><div class=\"gutter linenumber\"><span><\/span>\n<span><\/span><\/div><div class=\"code\"><span class=\"hljs-keyword\">import<\/span> sys\n<span class=\"hljs-keyword\">import<\/span> types\n\n<span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title function_\">fancy<\/span>(<span class=\"hljs-params\">...<\/span>):\n    ...\n\n<span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title class_\">FancyModule<\/span>(types.ModuleType):\n    <span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title function_\">__call__<\/span>(<span class=\"hljs-params\">self, ...<\/span>):\n        <span class=\"hljs-keyword\">return<\/span> fancy(...)\n\nsys.modules[__name__].__class__ = FancyModule\n<\/div><div class=\"code\"><br \/><\/div><\/div><\/code><\/pre>\n<p><span>Reese proposes that we provide a simpler mechanism to create callable modules: simply provide special recognition for module-level <\/span><code>__call__<\/code><span> functions, similar to the way that <\/span><a href=\"https:\/\/peps.python.org\/pep-0562\/\" rel=\"noopener\" ><span>PEP 562<\/span><\/a><span> added special recognition of module-level <\/span><code>__getattr__<\/code><span> and <\/span><code>__dir__<\/code><span> functions. With the semantics specified in <\/span><a href=\"https:\/\/peps.python.org\/pep-0713\/\" rel=\"noopener\" ><span>PEP 713<\/span><\/a><span>, <\/span><code>fancy.py<\/code><span> could be rewritten as follows:<\/span><\/p>\n<pre><code class=\"python hljs\"><div class=\"wrapper\"><div class=\"gutter linenumber\"><span><\/span>\n<span><\/span><\/div><div class=\"code\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title function_\">fancy<\/span>(<span class=\"hljs-params\">...<\/span>):\n    ...\n\n__call__ = fancy\n<\/div><div class=\"code\"><br \/><\/div><\/div><\/code><\/pre>\n<p><span>With a module, <\/span><code>fancy.py<\/code><span>, defined like the above, users would simply be able to do the following:<\/span><\/p>\n<pre><code class=\"python hljs\"><div class=\"wrapper\"><div class=\"gutter linenumber\"><span><\/span>\n<span><\/span><\/div><div class=\"code\"><span class=\"hljs-keyword\">import<\/span> fancy\nfancy()\n<\/div><div class=\"code\"><br \/><\/div><\/div><\/code><\/pre>\n<p><span>This would allow users of Python to avoid constructs which often feel unnecessarily verbose and involve frustrating amounts of boilerplate, such as:<\/span><\/p>\n<pre><code class=\"python hljs\"><div class=\"wrapper\"><div class=\"gutter linenumber\"><span><\/span>\n<span><\/span><\/div><div class=\"code\"><span class=\"hljs-keyword\">import<\/span> datetime\n<span class=\"hljs-keyword\">import<\/span> pprint\n<span class=\"hljs-keyword\">import<\/span> dis\n\nd = datetime.datetime()\npprint.pprint(...)\ndis.dis(...)\n<\/div><div class=\"code\"><br \/><\/div><\/div><\/code><\/pre>\n<p><span>It would also allow users to create callable modules in a way that would be easier for type checkers to support, as dynamically inserting custom objects into <\/span><code>sys.modules<\/code><span> can cause issues for these tools.<\/span><\/p>\n<p><span>The proposal was met with curiosity by attendees of the Language Summit. Thomas Wouters said that he had originally opposed the addition of module-level <\/span><code>__getattr__<\/code><span> and <\/span><code>__dir__<\/code><span>, introduced by PEP 562. However, now they had been introduced to Python, he was of the opinion that it might make sense to add support for module-level dunder methods including <\/span><code>__call__<\/code><span>, but also others such as <\/span><code>__setattr__<\/code><span>.<\/span><\/p>\n<\/div>\n\n<p class=\"syndicated-attribution\"><figure class= \\\"wp-block-image alignnone \\\"><img src= \\\"http:\/\/itteacheritfreelance.hk\/test\/wordpress\/wp-content\/uploads\/2016\/05\/logo2-2.png\\\" alt=\\\"IT\u96fb\u8166\u88dc\u7fd2 java\u88dc\u7fd2 \u70ba\u5927\u5bb6\u914d\u5c0d\u96fb\u8166\u88dc\u7fd2,IT freelance, \u79c1\u4eba\u8001\u5e2b, PHP\u88dc\u7fd2,CSS\u88dc\u7fd2,XML,Java\u88dc\u7fd2,MySQL\u88dc\u7fd2,graphic design\u88dc\u7fd2,\u4e2d\u5c0f\u5b78ICT\u88dc\u7fd2,\u4e00\u5c0d\u4e00\u79c1\u4eba\u88dc\u7fd2\u548cFreelance\u81ea\u7531\u5de5\u4f5c\u914d\u5c0d\u3002\\\"\/><figcaption>\u7acb\u523b\u8a3b\u518a\u53ca\u5831\u540d\u96fb\u8166\u88dc\u7fd2\u8ab2\u7a0b\u5427!<\/figcaption><\/figure>\r\n<\/br>Find A Teacher Form:\r\n<\/br>https:\/\/docs.google.com\/forms\/d\/1vREBnX5n262umf4wU5U2pyTwvk9O-JrAgblA-wH9GFQ\/viewform?edit_requested=true#responses\r\n<\/br><\/br>Email:\r\n<\/br>public1989two@gmail.com<br><br><br><br><br><br><br>\r\n<a href=www.itsec.hk style=color:#FFFFFF;>www.itsec.hk<\/a><br>\r\n<a href=\\\"www.itsec.vip\\\" style=color:#FFFFFF;>www.itsec.vip<\/a><br>\r\n<a href=\\\"www.itseceu.uk\\\" style=color:#FFFFFF;>www.itseceu.uk<\/a><br><\/p>","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>The Python Language Summit 2023 closed off with a trio of lightning talks from Dong-hee Na, Carl Meyer and Amethyst Reese.Dong-hee Na: Let\u2019s support LLVM-BOLT as an official featureCPython Core Developer Dong-hee Na gave a short presentation on the LL&#8230;<\/p>\n<\/div>","protected":false},"author":2053,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"The Python Language Summit 2023: Lightning Talks - ITTeacherITFreelance.hk","description":"The Python Language Summit 2023 closed off with a trio of lightning talks from Dong-hee Na, Carl Meyer and Amethyst Reese.Dong-hee Na: Let\u2019s support LLVM-BOLT a"},"footnotes":""},"categories":[10700],"tags":[],"_links":{"self":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/329462"}],"collection":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/2053"}],"replies":[{"embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=329462"}],"version-history":[{"count":1,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/329462\/revisions"}],"predecessor-version":[{"id":329463,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/329462\/revisions\/329463"}],"wp:attachment":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=329462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=329462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=329462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}