<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Code on Den's Hub: Technology Solutions, Guides and Best Practices</title><link>https://denshub.com/en/tags/code/</link><description>Recent content in Code on Den's Hub: Technology Solutions, Guides and Best Practices</description><generator>Hugo</generator><language>en</language><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.</copyright><lastBuildDate>Sun, 19 Nov 2023 12:00:00 +0100</lastBuildDate><atom:link href="https://denshub.com/en/tags/code/index.xml" rel="self" type="application/rss+xml"/><item><title>Introduction to Python Code Testing with PyTest</title><link>https://denshub.com/en/intro-to-testing-pytest/</link><pubDate>Sat, 12 Feb 2022 12:00:00 +0100</pubDate><guid>https://denshub.com/en/intro-to-testing-pytest/</guid><description>&lt;p&gt;A test is code that executes code. When you start developing a new feature for your Python project, you could formalize its requirements as code. When you do so, you not only document the way your implementation&amp;rsquo;s code shall be used, but you can also run all the tests automatically to always make sure your code matches your requirements. One such tool, which assists you in doing this is &lt;code&gt;pytest&lt;/code&gt; and it&amp;rsquo;s probably the most popular testing tool in the Python universe.&lt;/p&gt;</description></item><item><title>Speed up your Python code with Microsoft Pyjion</title><link>https://denshub.com/en/pyjion-speed-up-python-code/</link><pubDate>Fri, 12 Nov 2021 10:10:00 +0100</pubDate><guid>https://denshub.com/en/pyjion-speed-up-python-code/</guid><description>&lt;p&gt;Pyjion is a tool that can significantly boost Python performance by integrating a Just-In-Time (JIT) compiler into the Python runtime. This article explains how Pyjion works and how developers can use it to speed up their Python code without needing to make any major changes to their projects. It’s a great option for anyone looking to optimize Python’s execution speed while maintaining simplicity.&lt;/p&gt;
&lt;h2 id="what-is-pyjion" class="headerLink"&gt;&lt;a href="#what-is-pyjion" class="header-mark" aria-label="Permalink to What is Pyjion"&gt;&lt;/a&gt;What is Pyjion
&lt;/h2&gt;
&lt;p&gt;The most common way to speed up your Python code is to use CPython, the official Python interpreter. It compiles code into an intermediary language called &lt;code&gt;bytecode&lt;/code&gt; and evaluates this code whenever your code is executed. This allows lots of flexibility, but has a downside. Simple calculations where CPUs are very efficient, like arithmetic of integers and floating point numbers are significantly &lt;em&gt;slower&lt;/em&gt; in CPython than other interpreters.&lt;/p&gt;</description></item><item><title>How to save information to a log file in Python</title><link>https://denshub.com/en/python-save-to-log-file/</link><pubDate>Sun, 03 Nov 2019 14:28:40 +0100</pubDate><guid>https://denshub.com/en/python-save-to-log-file/</guid><description>&lt;p&gt;This article provides a comprehensive guide on how to save logs in Python using the built-in logging module. It walks you through the process of setting up a log file, configuring logging levels, and customizing log formats to suit your needs. Whether you&amp;rsquo;re debugging or tracking application behavior, these techniques will help you effectively manage your logs and gain better insights into your Python applications.&lt;/p&gt;
&lt;p&gt;Suppose you need to save some information about an event and when it happened to a log file. One of the most appropriate file formats for this is JSON.&lt;/p&gt;</description></item></channel></rss>