Planet Python RSS
214 subscribers
17.1K links
Unofficial Planet Python RSS feed from planetpython.org. Maintained by @cfinnberg
Download Telegram
Inspired Python: Mastering Structural Pattern Matching

Link: https://www.inspiredpython.com/course/pattern-matching/mastering-structural-pattern-matching?r=rss


Mastering Structural Pattern Matching
If you’re not familiar with the term Structural Pattern Matching then you are not alone. It’s a feature that, until about 10-15 years ago, you would not see outs
Inspired Python: Watch out for mutable defaults in function arguments

Link: https://www.inspiredpython.com/article/watch-out-for-mutable-defaults-in-function-arguments?r=rss


Watch out for mutable defaults in function arguments
Default arguments in functions are useful. When you write a function with defaults you do so with the understanding that other developers may not
Inspired Python: Separating type-specific code with single­dispatch

Link: https://www.inspiredpython.com/article/separating-type-specific-code-with-singledispatch?r=rss


Separating type-specific code with single­dispatch
Have you ever found yourself writing a litany of if-elif-else statements peppered with isinstance() calls? Notwithstanding error handling, they are
Inspired Python: Truthy and Falsy Gotchas

Link: https://www.inspiredpython.com/article/truthy-and-falsy-gotchas?r=rss


Truthy and Falsy Gotchas
Think back to when you wrote your first ever if statement in Python. I’m sure that intuition told you to only give Python boolean expressions that naturally evaluates to True
Real Python: Python's property(): Add Managed Attributes to Your Classes

Link: https://realpython.com/python-property/

With Python’s property(), you can create managed attributes in your classes. You can use managed attributes, also known as properties, when you need to modify their internal implementation without cha
Quansight Labs Blog: Array Libraries Interoperability

Link: https://labs.quansight.org/blog/2021/10/array-libraries-interoperability/

In this blog post I talk about the work that I was able to accomplish during
my internship at Quansight Labs and the efforts being made towards making
array libraries more interoperable.
Going ahead,
Python Bytes: #254 Do Excel things, get notebook Python code with Mito

Link: https://pythonbytes.fm/episodes/show/254/do-excel-things-get-notebook-python-code-with-mito

<p><strong>Watch the live stream:</strong></p>

<a href='https://www.youtube.com/watch?v=nm3i1VA9jFw' style='font-weight: bold;'>Watch on YouTube</a><br>
<br>

<p><strong>About the show</strong></p>
Python for Beginners: Generator Comprehension in Python

Link: https://www.pythonforbeginners.com/basics/generator-comprehension-in-python

You might have used list comprehension for creating lists from different sequences and container objects. In this article, We will discuss generator comprehension to create generators in Python. We wi
TestDriven.io: Accepting Crypto Payments with Django and Coinbase

Link: https://testdriven.io/blog/django-coinbase/

This tutorial looks at how to accept crypto Payments with Django and Coinbase Commerce.
Test and Code: 166: unittest expectedFailure and xfail

Link: https://testandcode.com/166

xfail isn't just for pytest tests. Python's unittest has @unittest.expectedFailure.
In this episode, we cover:

using @unittest.expectedFailure
the results of passing and failing tests with expectedFa
Ben Cook: How to Use the PyTorch Sigmoid Operation

Link: https://sparrow.dev/pytorch-sigmoid/

The PyTorch sigmoid function is an element-wise operation that squishes any real number into a range between 0 and 1. This is a very common activation function to use as the last layer of binary class
Ben Cook: PyTorch Tensor to NumPy Array and Back

Link: https://sparrow.dev/pytorch-numpy-conversion/

NumPy to PyTorch
PyTorch is designed to be pretty compatible with NumPy. Because of this, converting a NumPy array to a PyTorch tensor is simple:
import torch
import numpy as np

x = np.eye(3)

torch.
Ben Cook: TorchVision Transforms: Image Preprocessing in PyTorch

Link: https://sparrow.dev/torchvision-transforms/

TorchVision, a PyTorch computer vision package, has a simple API for image pre-processing in its torchvision.transforms module. The module contains a set of common, composable image transforms and giv
Stack Abuse: Creating a Form in a PDF Document in Python With borb

Link: https://stackabuse.com/creating-a-form-in-a-pdf-document-in-python-with-borb/

The Portable Document Format (PDF) is not a WYSIWYG (What You See is What You Get) format. It was developed to be platform-agnostic, independent of the underlying operating system and rendering engine
Real Python: The Real Python Podcast – Episode #82: Welcoming the CPython Developer in Residence

Link: https://realpython.com/podcasts/rpp/82/

Earlier this year, the Python Software Foundation announced the creation of the Developer in Residence role. The first Visionary Sponsors of the PSF have provided funding for this new role for one yea
Python for Beginners: Callable Objects in Python

Link: https://www.pythonforbeginners.com/basics/callable-objects-in-python

You might have heard that functions in python are callable objects. In this article, we will discuss what exactly we mean by the term callable object. We will discuss concepts behind the implementatio
Ben Cook: How the NumPy append operation works

Link: https://sparrow.dev/numpy-append/

Anyone familiar with Python will know about the list append method:
a = [1, 2, 3]
a.append(4)

print(a)

# Expected result
# [1, 2, 3, 4]
But what if you want to append to a NumPy array? In that case,