<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ganesan Krishnan</title>
    <description>The latest articles on DEV Community by Ganesan Krishnan (@ganesan_krishnan_dc888df2).</description>
    <link>https://dev.to/ganesan_krishnan_dc888df2</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1758785%2Fa8ce8d65-646e-4d5b-809d-a939eae2fd56.png</url>
      <title>DEV Community: Ganesan Krishnan</title>
      <link>https://dev.to/ganesan_krishnan_dc888df2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ganesan_krishnan_dc888df2"/>
    <language>en</language>
    <item>
      <title>@classmethod and @staticmethod</title>
      <dc:creator>Ganesan Krishnan</dc:creator>
      <pubDate>Mon, 28 Jul 2025 20:47:06 +0000</pubDate>
      <link>https://dev.to/ganesan_krishnan_dc888df2/classmethod-and-staticmethod-2a35</link>
      <guid>https://dev.to/ganesan_krishnan_dc888df2/classmethod-and-staticmethod-2a35</guid>
      <description>&lt;p&gt;&lt;strong&gt;@classmethod generally used as factory methods, takes in a parameter representing the class&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Book:
    TYPE = ('tech', 'fiction')
    def __init__(self, name, book_type):
        self.name = name
        self.book_type = book_type

    @classmethod 
    def tech_book(cls, name):
        cls(name, cls.TYPE[0])

    @staticmethod 
    def print_book(book):
      send_to_printer(book)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;@staticmethod generally refers to simple method that happens to be inside the class and generally provides some utility to the class that perform some operation without changing the data stored in the object.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
    </item>
  </channel>
</rss>
