<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>Programming Language Feature - Tag - MartinLwx&#39;s Blog</title>
        <link>https://martinlwx.github.io/en/tags/programming-language-feature/</link>
        <description>Programming Language Feature - Tag - MartinLwx&#39;s Blog</description>
        <generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>martinlwx@163.com (MartinLwx)</managingEditor>
            <webMaster>martinlwx@163.com (MartinLwx)</webMaster><copyright>&lt;a rel=&#34;license noopener&#34; href=&#34;https://creativecommons.org/licenses/by-nc-nd/4.0/&#34; target=&#34;_blank&#34;&gt;CC BY-NC-ND 4.0&lt;/a&gt;</copyright><lastBuildDate>Sat, 17 Aug 2024 14:22:14 &#43;0800</lastBuildDate><atom:link href="https://martinlwx.github.io/en/tags/programming-language-feature/" rel="self" type="application/rss+xml" /><item>
    <title>Learn to Use @dataclass (Python 3.7)</title>
    <link>https://martinlwx.github.io/en/learn-to-use-dataclass-in-python/</link>
    <pubDate>Sat, 17 Aug 2024 14:22:14 &#43;0800</pubDate><author>
        <name>MartinLwx</name>
    </author><guid>https://martinlwx.github.io/en/learn-to-use-dataclass-in-python/</guid>
    <description><![CDATA[<h2 id="intro" class="headerLink">
    <a href="#intro" class="header-mark"></a>Intro</h2><p>I like Python&rsquo;s tuple, which allows us to quickly <em>bundle</em> together values of <em>different types</em> as a single entity and manage them in an intuitive and easy-to-use way. However, I find that once the tuple has <em>many fields</em>, I&rsquo;m <em>forced to</em> add a comment to indicate the meaning of each field. For example,</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    
    tw-flex 
    tw-flex-row
    tw-flex-1 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        code-block-button
        tw-mx-2 
        tw-flex
        tw-flex-row
        tw-flex-1"
      aria-hidden="true">
          <div class="group-[.is-open]:tw-rotate-90 tw-transition-[transform] tw-duration-500 tw-ease-in-out print:!tw-hidden tw-w-min tw-h-min tw-my-1 tw-mx-1"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></div>
          <p class="tw-select-none !tw-my-1">python</p>]]></description>
</item><item>
    <title>Walrus Operator (Python 3.8)</title>
    <link>https://martinlwx.github.io/en/walrus-operator-in-python/</link>
    <pubDate>Sat, 29 Oct 2022 23:36:12 &#43;0800</pubDate><author>
        <name>MartinLwx</name>
    </author><guid>https://martinlwx.github.io/en/walrus-operator-in-python/</guid>
    <description><![CDATA[<h2 id="intro" class="headerLink">
    <a href="#intro" class="header-mark"></a>Intro</h2><p>Today, I would like to share a neat introduced in Python3.8 - the walrus operator. It sparked quite a bit of discussion before ultimately being accepted. 🤔️</p>
<p>The power of the walrus operator lies in turning an assignment <em>statement</em> into an assignment <em>expression</em>. You may be wondering: what exactly is the difference between a statement and an expression?</p>
<h2 id="expression-vs-statement" class="headerLink">
    <a href="#expression-vs-statement" class="header-mark"></a>Expression vs Statement</h2><p>In programming languages, you may encounter many different constructs. Broadly, they can be divided into two categories - expressions and statements. An expression is evaluated and produces a value, whereas a statement performs an action and does not return anything.</p>]]></description>
</item></channel>
</rss>
