<?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: Md Mahiuddin</title>
    <description>The latest articles on DEV Community by Md Mahiuddin (@mahiuddindev).</description>
    <link>https://dev.to/mahiuddindev</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%2F951385%2F401a06d3-b169-4101-98ef-4fcca112e3d0.png</url>
      <title>DEV Community: Md Mahiuddin</title>
      <link>https://dev.to/mahiuddindev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahiuddindev"/>
    <language>en</language>
    <item>
      <title>What’s New In Python 3.12</title>
      <dc:creator>Md Mahiuddin</dc:creator>
      <pubDate>Fri, 25 Aug 2023 16:30:20 +0000</pubDate>
      <link>https://dev.to/mahiuddindev/python-312-4n43</link>
      <guid>https://dev.to/mahiuddindev/python-312-4n43</guid>
      <description>&lt;p&gt;In this concise overview, we'll delve into Python 3.12 and its exciting new features. Additionally, I'll provide my personal insights on each enhancement or adjustment.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Nested F-Strings&lt;/strong&gt;
Python 3.12 introduces a captivating feature: nested f-string expressions. Let's explore a fresh example to illustrate this.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def create_welcome_message(name: str) -&amp;gt; str:
    return f"Welcome, {f"{name}"}!"

visitor_name = "Jennifer"
welcome_message = create_welcome_message(visitor_name)
print(welcome_message)
# Output: Welcome, Jennifer!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Quote Reuse:&lt;/strong&gt;
In Python 3.11, attempting to reuse the same quotation marks within an f-string would result in a SyntaxError. This constraint compelled users to resort to different quotation marks (for instance, using double quotes or triple quotes) if the f-string itself utilized single quotes. However, Python 3.12 introduces a new capability that facilitates more flexible usage:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In Python 3.12 and subsequent versions, you are now able to reuse the same quotation marks that enclose the surrounding f-string without encountering a SyntaxError. This advancement allows for constructs like the following:&lt;/p&gt;

&lt;p&gt;Before&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;words = ['Python', '3.11']
print(f"This is {': '.join(words)}")
# Output: This is Python: 3.11
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;words = ['Python', '3.12']
print(f"This is: {": ".join(words)}")
# Output: This is Python: 3.12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's worth noting that there was previously no explicit limitation on the depth of f-string nesting. However, the inability to reuse string quotes within the expression component of f-strings limited the extent to which f-strings could be nested. Even the most complex f-string nesting prior to this change was constrained as follows:&lt;/p&gt;

&lt;p&gt;Before&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(f"""{f'''{f'{f"{1+1}"}'}'''}""")
# Output: '2'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}")
# Output: '2'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Multiline F-Strings&lt;/strong&gt;&lt;br&gt;
A remarkable addition in version 3.12 is the ability to create multiline f-strings. In Python 3.11, expressions within f-strings were required to be defined on a single line, even though outside of f-strings, expressions could span multiple lines (such as defining literal lists over multiple lines). This limitation made the f-strings less readable. However, Python 3.12 introduces the ability to define multi-line expressions within f-strings and include comments as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;greeting = f"Hey there {
    name  # User.name
}"
# Output: Hey there Python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Tokenization&lt;/strong&gt;&lt;br&gt;
Since Python 3.11, the tokenizer module has been built in Python for examining lexical elements and keywords. Now, with the advent of nested and multiline f-strings in 3.12, this module has been reimplemented in C, resulting in nearly a 40% performance boost. This advancement significantly benefits linting and formatting tools that rely on this module.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Per-Interpreter GIL&lt;/strong&gt;&lt;br&gt;
Python 3.12 introduces a groundbreaking feature: the Per-Interpreter GIL. This advancement allows us to exert full control over the Global Interpreter Lock's utilization in sub-interpreters. As the official documentation explains, this feature enables Python programs to optimally utilize multiple CPU cores.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Distutils Deprecated&lt;/strong&gt;&lt;br&gt;
The ongoing debate between setuptools and distutils within the Python community has culminated in the decision to phase out the distutils standard library. Setuptools, a feature-rich fork of distutils, has gained widespread preference. Consequently, distutils has been deprecated.&lt;/p&gt;

&lt;p&gt;Moreover, pip employs setuptools to create distributions. If you create a virtual environment with Python versions up to 3.11 and pip versions up to 22.1, you'll notice setuptools is pre-installed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pip list
Package    Version
---------- -------
pip        23.2.1
setuptools 68.0.0    &amp;lt;--
wheel      0.41.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Given setuptools' independence from distutils and pip's reduced reliance on setuptools for versions 22.1 and beyond, freshly installed Python environments no longer include a distribution tool. The setuptools package no longer depends on the virtualenv package either. Thus, even with setuptools installed, you cannot create a virtual environment using commands like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python -m venv venv
# ERROR: venv module is not found.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The distutils package has become an external third-party package. To access both virtualenv and setuptools functionalities, separate installations are required.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. kwargs Type Hinting&lt;/strong&gt;&lt;br&gt;
Python 3.12 introduces significant changes to the typing module. Previously, I used typing.Any for type hinting **kwargs in functions and methods. With Python 3.12, type annotations can be more precise using typing.TypedDict.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from typing import TypedDict, Unpack

class Movie(TypedDict):
  name: str
  year: int

def foo(**kwargs: Unpack[Movie]): ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;8. @override Type Hinting&lt;/strong&gt;&lt;br&gt;
A novel addition in the typing module is the @override type annotation. This annotation helps indicate methods intended for overriding in object-oriented design. This aids typing tools like mypy in identifying code issues.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from typing import override

class Parent:
    def greet(self):
        pass

class Child(Parent):
    @override
    def greet(self):
        pass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if a typo like changing Child.greet to Child.great occurs, mypy would likely generate non-zero output, indicating the absence of the expected overridden method from the base class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. New Type Defining&lt;/strong&gt;&lt;br&gt;
Python 3.12 introduces a new syntax for defining Type Aliases. This new syntax streamlines the process.&lt;/p&gt;

&lt;p&gt;Before&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from typing import TypeAlias

  Players: TypeAlias = List[str]

  def list_players(players: Players) -&amp;gt; None: ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type Players = list[str]

def list_players(players: Players) -&amp;gt; None:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This convention affects the appearance of functions and methods. For instance, the function scope can be structured as follows:&lt;/p&gt;

&lt;p&gt;Before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def analyze_data(data: List[str], values: List[float]) -&amp;gt; None:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type Data = List[str]
type Values = List[float]

def process_data[data, values](data: Data, values: Values) -&amp;gt; None:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The new function definition pattern follows: def NAME&lt;a href="https://dev.to*ARGS:%20TYPE"&gt;*TYPES&lt;/a&gt; -&amp;gt; TYPE. It's important to note that the types preceding the function name are confined to the function's scope.&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Binary Search Algorithm</title>
      <dc:creator>Md Mahiuddin</dc:creator>
      <pubDate>Thu, 19 Jan 2023 15:11:46 +0000</pubDate>
      <link>https://dev.to/mahiuddindev/binary-search-algorithm-2mbp</link>
      <guid>https://dev.to/mahiuddindev/binary-search-algorithm-2mbp</guid>
      <description>&lt;p&gt;Binary search is an efficient algorithm for finding an item from a sorted list of items. It works by repeatedly dividing the search interval in half. The idea is to determine, in logarithmic time, whether the item you are searching for is in the lower or upper half of the interval. If it is in the lower half, you repeat the process on that half; if it is in the upper half, you repeat the process on that half. This process continues until the item is found or the search interval is empty.&lt;/p&gt;

&lt;p&gt;Here is an example of a binary search algorithm implemented in Python.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low &amp;lt;= high:
        mid = (low + high) // 2
        guess = list[mid]
        if guess == item:
            return mid
        if guess &amp;gt; item:
            high = mid - 1
        else:
            low = mid + 1
    return None

my_list = [1, 3, 5, 7, 9]

print(binary_search(my_list, 3)) # Output: 1
print(binary_search(my_list, -1)) # Output: None

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

&lt;/div&gt;



&lt;p&gt;In this example, we define a function called binary_search() that takes in two parameters: an array and a target element. The function uses a while loop to repeatedly divide the array in half until the target element is found or the array is exhausted. The loop starts by setting two pointers, left and right, to the first and last elements of the array, respectively. The pointer mid is set to the middle of the array by taking the average of left and right. If the element at the mid index is equal to the target element, the function returns the index of the target element. If the element at the mid index is less than the target element, the left pointer is set to one position to the right of mid. If the element at the mid index is greater than the target element, the right pointer is set to one position to the left of mid. The loop continues until the left pointer is greater than the right pointer, at which point the function returns -1 to indicate that the target element was not found in the array. It’s important to note that the array should be sorted to be able to use binary search. In the example above, the array is sorted in ascending order. Binary search has a time complexity of O(log n) which is faster than linear search (O(n)), which makes it suitable for large datasets.&lt;/p&gt;

&lt;p&gt;JavaScript and C++ example on this &lt;a href="https://mahiuddin.me/blogs/binary-search-algorithm/" rel="noopener noreferrer"&gt;post&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gratitude</category>
      <category>watercooler</category>
    </item>
    <item>
      <title>Introduction to Python Programming</title>
      <dc:creator>Md Mahiuddin</dc:creator>
      <pubDate>Wed, 18 Jan 2023 14:22:55 +0000</pubDate>
      <link>https://dev.to/mahiuddindev/introduction-to-python-programming-176p</link>
      <guid>https://dev.to/mahiuddindev/introduction-to-python-programming-176p</guid>
      <description>&lt;p&gt;Python is a popular, high-level programming language known for its simplicity, readability, and versatility. It is often used for web development, data analysis, artificial intelligence, and scientific computing.&lt;/p&gt;

&lt;p&gt;Python Programming&lt;br&gt;
Python is a versatile, high-level programming language that has gained immense popularity in recent years, thanks to its simplicity, readability, and wide range of uses. Whether you’re a beginner looking to start coding or an experienced programmer looking to add a new language to your toolbox, Python is a great choice.&lt;/p&gt;

&lt;p&gt;One of the key features of Python is its use of indentation to indicate code blocks, rather than curly braces or keywords. This makes the code more readable and easier to understand, especially for beginners. Python also has a simple, easy-to-learn syntax that makes it a great choice for those new to programming.&lt;/p&gt;

&lt;p&gt;Python is a general-purpose language, which means it can be used for a wide range of tasks. It’s often used in web development, data analysis, artificial intelligence, and scientific computing. The large and active Python community has also created a wide range of libraries and frameworks that are available for specific tasks, such as Django for web development or NumPy for scientific computing. This makes it easier to accomplish certain tasks and also to share and collaborate with others.&lt;/p&gt;

&lt;p&gt;How To Start&lt;br&gt;
Getting started with Python is easy. You can download the Python interpreter from the official website and start writing code in the interactive shell. You can also use an integrated development environment (IDE) like PyCharm or Visual Studio Code, which provide additional features like code completion and debugging.&lt;/p&gt;

&lt;p&gt;Basic You Need to Know&lt;br&gt;
Python has a number of built-in data types, including numbers, strings, lists, and dictionaries. Numbers can be integers or floating-point numbers and can be used for arithmetic operations like addition and multiplication. Strings are sequences of characters and can be used for text manipulation. Lists are ordered collections of items and can be used to store multiple values in a single variable. Dictionaries are collections of key-value pairs and can be used to store data like a database.&lt;/p&gt;

&lt;p&gt;Python also has a number of control structures that can be used to control the flow of a program. These include if-else statements, for loops, and while loops. The if-else statement is used to make decisions in a program, while the for and while loops are used to repeat a block of code multiple times.&lt;/p&gt;

&lt;p&gt;Functions are also an important part of Python programming. They allow you to define a block of code that can be reused multiple times, with different input values. Python also has a number of built-in functions, such as the print() function for displaying text on the screen and the input() function for getting input from the user.&lt;/p&gt;

&lt;p&gt;Python also has classes and objects, which are used for object-oriented programming. A class is a blueprint for creating objects, and an object is an instance of a class. This allows you to create complex, reusable code that can be easily understood and maintained.&lt;/p&gt;

&lt;p&gt;Another important feature of Python is its support for modules and packages. Modules are separate files that contain Python code and can be imported into other files to be used. Packages are collections of modules and can be used to organize code into logical groups. This makes it easier to manage and organize large codebase and also share it with others.&lt;/p&gt;

&lt;p&gt;Python also has a number of built-in libraries which provides a lot of functionality, for example, the “os” library provides functionality to interact with the Operating System, the “math” library provides mathematical functions and so on. This makes it easy to perform complex tasks with just a few lines of code.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
In conclusion, Python is a powerful and versatile programming language that is well-suited for a wide range of tasks. With its simple syntax, large community, and wide range of libraries and frameworks, Python is a great choice for anyone looking to start programming.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mahiuddin.me/blogs/introduction-to-python-programming/"&gt;My Blog&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Top 12 Code Review Tools</title>
      <dc:creator>Md Mahiuddin</dc:creator>
      <pubDate>Wed, 18 Jan 2023 09:37:32 +0000</pubDate>
      <link>https://dev.to/mahiuddindev/top-12-code-review-tools-4bh1</link>
      <guid>https://dev.to/mahiuddindev/top-12-code-review-tools-4bh1</guid>
      <description>&lt;p&gt;Code review is an essential part of the software development process, it helps to improve the quality of code and detect errors early on. It’s a process where developers review each other’s code, looking for bugs, inconsistencies, and potential improvements.&lt;/p&gt;

&lt;p&gt;There are many code review tools available today, each with their own unique features and capabilities. In this article, we will take a look at the top 12 code review tools that are currently available in the market:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;GitHub&lt;br&gt;
GitHub: One of the most popular code review tools, GitHub is a web-based platform that allows developers to host, review, and collaborate on code. It offers a variety of features such as pull requests, code review, and issue tracking.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Gerrit&lt;br&gt;
Gerrit: Gerrit is an open-source code review tool that is designed for use with the Git version control system. It offers a web-based interface and advanced features such as code review, change management, and integration with other development tools.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;GitLab&lt;br&gt;
GitLab: GitLab is a web-based platform that offers code review, issue tracking, and project management capabilities. It also offers a built-in continuous integration/continuous delivery (CI/CD) pipeline, making it a popular choice for DevOps teams.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Crucible&lt;br&gt;
Crucible: Crucible is a code review tool from Atlassian that offers a web-based interface and advanced features such as code review, discussion, and reporting. It also integrates with other Atlassian tools such as JIRA and Confluence.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Phabricator&lt;br&gt;
Phabricator: Phabricator is an open-source code review tool that offers a web-based interface and advanced features such as code review, task management, and integration with other development tools.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Review Board&lt;br&gt;
Review Board: Review Board is an open-source code review tool that offers a web-based interface and advanced features such as code review, change management, and integration with other development tools.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://mahiuddin.me/blogs/code-review-tools/" rel="noopener noreferrer"&gt;Read More&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudwatch</category>
      <category>serverless</category>
      <category>monitoring</category>
    </item>
  </channel>
</rss>
