Machine Translation and Multilinguality in July 2022

Here is my monthly summary of what I found worth reading on arXiv in the past month. A preprint from JHU studies zero-shot cross-lingual transfer using pretrained multilingual representation and comes to the conclusion that it is an under-specified optimization problem. In other words, with a multilingual representation model, there are potentially many solutions that are good for the source language, but only some of them are good for the target language. In practice, the solution is probably proper training […]

Read more

Python Constants: Improve Your Code’s Maintainability

In programming, the term constant refers to names representing values that don’t change during a program’s execution. Constants are a fundamental concept in programming, and Python developers use them in many cases. However, Python doesn’t have a dedicated syntax for defining constants. In practice, Python constants are just variables that never change. To prevent programmers from reassigning a name that’s supposed to hold a constant, the Python community has adopted a naming convention: use uppercase letters. For every Pythonista, it’s […]

Read more

The best way to find performance bottlenecks: observing production

Your customers are complainin’, your monitors are alertin’, your thumbs are a-twiddlin’—whatever the symptom, the problem is that your application is too slow. And you want to find out why, so you can fix it. You could spin up your application on your laptop, do some benchmarking, and try to find the bottleneck. Sometimes, that’s all it takes, but quite often, local testing tells you nothing useful. For many performance bottlenecks, the only way to identify the problem is to […]

Read more

Python Basics: Finding and Fixing Code Bugs

Everyone makes mistakes—even seasoned professional developers! IDLE is pretty good at catching mistakes like syntax errors and run-time errors, but there’s a third type of error that you may have already experienced. Logic errors occur when an otherwise valid program doesn’t do what was intended. Logic errors cause unexpected behaviors called bugs. Removing bugs is called debugging, and a debugger is a tool that helps you hunt down bugs and understand why they’re happening. Knowing how to find and fix […]

Read more

Asynchronous Tasks With Django and Celery

You’ve built a shiny Django app and want to release it to the public, but you’re worried about time-intensive tasks that are part of your app’s workflow. You don’t want your users to have a negative experience navigating your app. You can integrate Celery to help with that. Celery is a distributed task queue for UNIX systems. It allows you to offload work from your Python app. Once you integrate Celery into your app, you can send time-intensive tasks to […]

Read more

The limits of Python vectorization as a performance technique

Vectorization in Python, as implemented by NumPy, can give you faster operations by using fast, low-level code to operate on bulk data. And Pandas builds on NumPy to provide similarly fast functionality. But vectorization isn’t a magic bullet that will solve all your problems: sometimes it will come at the cost of higher memory usage, sometimes the operation you need isn’t supported, and sometimes it’s just not relevant. For each problem, there are alternative solutions that can address the problem. […]

Read more

Primer on Jinja Templating

Templates are an essential ingredient in full-stack web development. With Jinja, you can build rich templates that power the front end of your Python web applications. But you don’t need to use a web framework to experience the capabilities of Jinja. When you want to create text files with programmatic content, Jinja can help you out. In this tutorial, you’ll learn how to: Install the Jinja template engine Create your first Jinja template Render a Jinja template in Flask Use […]

Read more

Managing Attributes With Python’s 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 changing the public API of the class. Providing stable APIs can help you avoid breaking your users’ code when they rely on your classes and objects. Properties are arguably the most popular way to create managed attributes quickly and in the purest Pythonic style. In this video course, you’ll learn how […]

Read more

Your Python Coding Environment on Windows: Setup Guide

Are you interested in writing Python code on a Windows machine? Maybe you’re a lifelong Windows user getting into coding with Python, or perhaps you’re just beginning to branch out from macOS or Linux. In this tutorial, you’ll walk through an easy-to-follow and flexible Python coding setup on Windows 10. Note: Most of the steps here will work equally well on Windows 11. To set up your Windows machine for Python coding, you’ll: Clean and update a new Windows install […]

Read more

Finding performance bottlenecks in Celery tasks

When your Celery tasks are too slow, and you want them to run faster, you usually want to find and then fix the performance bottleneck. It’s true, you can architect a solution where slow tasks don’t impact faster ones, and you may sometimes need to. But if you can manage to make all your tasks fast, that is ideal. To speed up your code, you need to identify the bottlenecks: which task is slow, and why it’s slow. In this […]

Read more
1 146 147 148 149 150 908