Python’s .__call__() Method: Creating Callable Instances

In Python, a callable is any object that you can call using a pair of parentheses and, optionally, a series of arguments. Functions, classes, and methods are all common examples of callables in Python. Besides these, you can also create custom classes that produce callable instances. To do this, you can add the .__call__() special method to your class. Instances of a class with a .__call__() method behave like functions, providing a flexible and handy way to add functionality to […]

Read more

Using k-Nearest Neighbors (kNN) in Python

In this video course, you’ll get a thorough introduction to the k-Nearest Neighbors (kNN) algorithm in Python. The kNN algorithm is one of the most famous machine learning algorithms and an absolute must-have in your machine learning toolbox. Python is the go-to programming language for machine learning, so what better way to discover kNN than with Python’s famous packages NumPy and scikit-learn! You’ll explore the kNN algorithm both in theory and in practice. It’s important to learn about the mechanics […]

Read more

How to Launch an HTTP Server in One Line of Python Code

Traditionally, if you wanted to handle HTTP requests and serve static content from files, then you had to set up a full-fledged web server like Apache or NGINX, which could be a tedious process. Building a dynamic web application requires installing a web framework, such as Django, Flask, or FastAPI, which adds yet another complexity layer. Fortunately, you can take advantage of a basic HTTP server built into Python to avoid all this hassle. Python’s HTTP server can come in […]

Read more

ChatGPT: Your Personal Python Coding Mentor

Large language models (LLMs) have quickly gained popularity since OpenAI released ChatGPT for public access. Since then, people have used ChatGPT for fun, creative, and useful purposes. If you’ve dreamed about using ChatGPT as your Python coding mentor, then keep on reading. Using ChatGPT as your mentor doesn’t mean that you should try to build a software solution without knowing anything about programming. Instead, you’ll focus on using ChatGPT as a learning tool. It probably can’t replace you as a […]

Read more

Metaclasses in Python

In Python, everything is an object, even the classes that create objects. You used a class to instantiate an object instance, but classes themselves are also instantiated behind the scenes. This mechanism is available to you as a programmer through the concept of metaclasses. Metaclasses allow you to hook when classes are created, and this technique is what’s behind magical frameworks like Django and SQLAlchemy where class definitions have side effects that impact databases. In this course you’ll learn about […]

Read more
1 90 91 92 93 94 908