{"id":329464,"date":"2023-05-29T15:10:00","date_gmt":"2023-05-29T15:10:00","guid":{"rendered":"http:\/\/itteacheritfreelance.hk\/wordpress\/?guid=8272826e3964789a0d9cf184c5add618"},"modified":"2023-05-29T15:10:00","modified_gmt":"2023-05-29T15:10:00","slug":"the-python-language-summit-2023-what-is-the-standard-library-for","status":"publish","type":"post","link":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/2023\/05\/29\/the-python-language-summit-2023-what-is-the-standard-library-for\/","title":{"rendered":"The Python Language Summit 2023: What is the Standard Library for?"},"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<p>&nbsp;Brett Cannon came to the <a href=\"https:\/\/pyfound.blogspot.com\/2023\/05\/the-python-language-summit-2023_29.html\" rel=\"nofollow\" >Python Language Summit<\/a> this year with a fundamental question for the assembled core developers: What is the standard library for?<\/p>\n<p>According to a quick&nbsp;<code>python -c \"import sys; print(len(sys.stdlib_module_names))\"<\/code>&nbsp;call on my laptop, the standard library in Python 3.11 consists of 305 importable modules. Many of these are implementation details that, if you\u2019re a good citizen, you really&nbsp;<em>shouldn\u2019t<\/em>&nbsp;be importing \u2013 but the point stands that the Python standard library is perhaps now larger than it should be.<\/p>\n<p>But the goal of his question, Cannon explained, wasn\u2019t to decide which modules to get&nbsp;<em>rid<\/em>&nbsp;of. Instead, it was to create guidelines on when and why&nbsp;<em>new<\/em>&nbsp;modules should be accepted into the standard library.<\/p>\n<blockquote>\n<p>&#8220;We need to audit the standard library, and not&nbsp;<em>deprecate<\/em>&nbsp;it, but decide which bits should probably not have been added if we had perfect hindsight.&nbsp;<\/p>\n<\/blockquote>\n<blockquote>\n<p>&#8212; <i>Guido van Rossum, CPython Core Developer and former BDFL<\/i><\/p>\n<\/blockquote>\n<p>Carol Willing agreed that the core dev team shouldn\u2019t be looking to remove modules&nbsp;<em>en masse<\/em>, but should decide what kinds of modules they wanted to admit in the future. \u0141ukasz Langa agreed, and pointed out that it was often hard removing modules even when we wanted to, due to the fact that \u201cthe standard library is a huge import cycle\u201d.<\/p>\n<h2 class=\"raw\">Where do we go now?<\/h2>\n<p>Cannon himself put forward two possible answers to his question, before tossing it out to the audience:<\/p>\n<ol>\n<li>The standard library should contain everything required to bootstrap an installer.<\/li>\n<li>The standard library should make it easy for beginners to be able to write scripts without installing anything.<\/li>\n<\/ol>\n<p>The conversation was free-flowing, but a common point of consensus among the attendees was that the standard library should focus on tools and utilities that allow users to write better Python code. Hynek Schlawack cited&nbsp;<a href=\"https:\/\/docs.python.org\/3\/library\/dataclasses.html\" rel=\"noopener\" ><code>dataclasses<\/code><\/a>&nbsp;as an example of a module that made writing classes much less painful, and generally led to them writing better code as a result. (Schlawack is the author of the&nbsp;<a href=\"https:\/\/www.attrs.org\/en\/stable\/\" rel=\"noopener\" >attrs<\/a>&nbsp;library, the third-party inspiration for&nbsp;<code>dataclasses<\/code>, which itself is still going strong.) Filipe La\u00edns agreed, arguing that the core dev team should focus on building business implementations for third-party libraries to build on top of.<\/p>\n<blockquote>\n<p>\u201cThe default answer for \u2018Should this be in the standard library?\u2019 should be \u2018No\u2019, but we should bless smaller utilities that help people write better Python code\u201d&nbsp;<\/p>\n<\/blockquote>\n<blockquote>\n<p>&#8212; <i>Antonio Cuni, HPy Core Developer<\/i><\/p>\n<\/blockquote>\n<p>There was a certain amount of regret in the air about modules that perhaps should never have been added to the standard library, and had proved themselves to be significant maintenance burdens in the years since, but could now never be removed.&nbsp;<a href=\"https:\/\/docs.python.org\/3\/library\/tkinter.html\" rel=\"noopener\" ><code>tkinter<\/code><\/a>, it was universally agreed, was the primary example here; possibly&nbsp;<a href=\"https:\/\/docs.python.org\/3\/library\/multiprocessing.html\" rel=\"noopener\" ><code>multiprocessing<\/code><\/a>&nbsp;also.<\/p>\n<p>Guido van Rossum pondered whether&nbsp;<a href=\"https:\/\/docs.python.org\/3\/library\/asyncio.html\" rel=\"noopener\" ><code>asyncio<\/code><\/a>&nbsp;should ever have been added to the standard library, remarking that it had been difficult to evolve&nbsp;<code>asyncio<\/code>&nbsp;while it was in the standard library, and had possibly been added before it was \u201cfully baked\u201d. The&nbsp;<code>ssl<\/code>&nbsp;integration had probably been a mistake, he said, and should have been left to third parties.<\/p>\n<p>\u0141ukasz Langa noted that modules such as&nbsp;<code>asyncio<\/code>&nbsp;and&nbsp;<a href=\"https:\/\/docs.python.org\/3\/library\/typing.html\" rel=\"noopener\" ><code>typing<\/code><\/a>, which had continued to evolve rapidly after being added to the standard library, had helped spur new syntax changes to Python that had been to the language\u2019s betterment. Without&nbsp;<code>asyncio<\/code>&nbsp;in the standard library, Langa argued, we would probably never have adopted the&nbsp;<code>async<\/code>\/<code>await<\/code>&nbsp;syntax that is now the foundation of asynchronous Python programming.<\/p>\n<p>Zac Hatfield-Dods, maintainer of several prominent third-party packages, said that different standard-library packages had different impacts on the Python ecosystem.&nbsp;<a href=\"https:\/\/docs.pytest.org\/en\/7.3.x\/\" rel=\"noopener\" >Pytest<\/a>, one of the libraries he maintains, had managed to flourish and find success despite the existence of&nbsp;<a href=\"https:\/\/docs.python.org\/3\/library\/unittest.html\" rel=\"noopener\" ><code>unittest<\/code><\/a>&nbsp;in the standard library. But another library he helps out with, the asynchronous&nbsp;<a href=\"https:\/\/trio.readthedocs.io\/en\/stable\/\" rel=\"noopener\" >Trio<\/a>&nbsp;framework, had struggled to attract users while&nbsp;<code>asyncio<\/code>&nbsp;had been part of the standard library. \u201cNobody supports alternative async implementations,\u201d he complained, despite Trio\u2019s development often being years ahead of where&nbsp;<code>asyncio<\/code>&nbsp;is. (In the coffee break afterwards, Hatfield-Dods was keen to emphasise that he is, in fact, a fan of&nbsp;<code>asyncio<\/code>&nbsp;and the work of the&nbsp;<code>asyncio<\/code>&nbsp;maintainers.)<\/p>\n<p><\/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\/b\/R29vZ2xl\/AVvXsEhNHMtg7BSQza8aOAebA4arhofrKFaaX0MulKsXjgTFBc--7H5bWHuumjdw-DMOHN_eGH1cBA4sZzumqMPp0caSMVZv2aySrlwd7R9jMgjwwsMEpluO89sKCEsbAiHli5fg_i65HkN2OJoXnCqlKQiCA9HBlICEB_NUcFOsN3WcCPKOAbU\/s959\/image_2023-05-27_223251699.png\" style=\"margin-left: auto; margin-right: auto;\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" data-original-height=\"719\" data-original-width=\"959\" height=\"240\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhNHMtg7BSQza8aOAebA4arhofrKFaaX0MulKsXjgTFBc--7H5bWHuumjdw-DMOHN_eGH1cBA4sZzumqMPp0caSMVZv2aySrlwd7R9jMgjwwsMEpluO89sKCEsbAiHli5fg_i65HkN2OJoXnCqlKQiCA9HBlICEB_NUcFOsN3WcCPKOAbU\/s320\/image_2023-05-27_223251699.png\" width=\"320\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\" style=\"text-align: center;\">Zac Hatfield-Dods (left), speaking at the Language Summit<br \/>(Photo by Hugo van Kemenade)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/p>\n<p>Cannon brought up the question of whether a module like&nbsp;<a href=\"https:\/\/docs.python.org\/3\/library\/pathlib.html\" rel=\"noopener\" ><code>pathlib<\/code><\/a>&nbsp;belonged. \u201cIt\u2019s just sugar,\u201d he remarked \u2013 i.e., hardly a \u201ccore utility\u201d or a protocol that allowed people to write better code. But it has nonetheless been one of the more popular additions to the standard library in recent years. Langa again pushed back, arguing that without the addition of&nbsp;<code>pathlib<\/code>&nbsp;to the standard library, we would never have added&nbsp;<a href=\"https:\/\/docs.python.org\/3\/library\/os.html#os.PathLike\" rel=\"noopener\" ><code>os.PathLike<\/code><\/a>, a protocol that had allowed a common interface for describing file-system paths in Python. \u201cA third-party PyPI package wouldn\u2019t have convinced us to make that change,\u201d Langa argued.<\/p>\n<p>Several attendees noted that adding a module to the standard library often made it hard for users to use features added to the module in newer versions of Python, due to CPython\u2019s slow development cycle. One solution could to provide third-party versions of standard-library modules on PyPI, backporting the latest features of a module to older versions of Python. Thomas Wouters argued that previous attempts at providing these backport modules had often been disastrous. However, Jelle Zijlstra noted that&nbsp;<a href=\"https:\/\/github.com\/python\/typing_extensions\" rel=\"noopener\" >typing_extensions<\/a>, which backports features from the latest version of the&nbsp;<code>typing<\/code>&nbsp;module, had been incredibly successful (though it was sometimes hard to maintain).<\/p>\n<p>Overall, there was agreement that the original motivations for a large, \u201cbatteries-included\u201d standard library no longer held up to scrutiny. \u201cIn the good old days,\u201d Ned Deily reminisced, \u201cWe said \u2018batteries-included\u2019 because we didn\u2019t have a good story for third-party installation.\u201d But in 2023, installing third-party packages from PyPI is much easier.<\/p>\n<p>Often, Thomas Wouters noted, people preferred using standard-library modules in a corporate setting due to the fact that the installation of any third-party package would require approval from their company\u2019s IT department. But, he noted, this was hardly Python\u2019s problem.<\/p>\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>&nbsp;Brett Cannon came to the Python Language Summit this year with a fundamental question for the assembled core developers: What is the standard library for?According to a quick&nbsp;python -c &#8220;import sys; print(len(sys.stdlib_module_names))&#8221;&nbsp;c&#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: What is the Standard Library for? - ITTeacherITFreelance.hk","description":"&nbsp;Brett Cannon came to the Python Language Summit this year with a fundamental question for the assembled core developers: What is the standard library for?"},"footnotes":""},"categories":[10700],"tags":[],"_links":{"self":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/329464"}],"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=329464"}],"version-history":[{"count":1,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/329464\/revisions"}],"predecessor-version":[{"id":329465,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/329464\/revisions\/329465"}],"wp:attachment":[{"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=329464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=329464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itteacheritfreelance.hk\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=329464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}