Dan Bader
00h00 24  août
Functional Programming Primitives in Python
Functional Programming Primitives in Python In this tutorial we’ll take a look at the basic building blocks of functional programming in Python, like the filter , map , and reduce functions. What Is Functional Programming? Functional programming (FP) is a programming technique that...
00h00 27  février
Interfacing Python and C: The CFFI Module
Interfacing Python and C: The CFFI Module How to use Python’s built-in CFFI module for interfacing Python with native libraries as an alternative to the ctypes approach. In previous tutorials, we covered the basics of ctypes and some advanced ctypes usage. This tutorial will cover the CFFI...
00h00 25  janvier
Write More Pythonic Code by Applying the Things You Already Know
Write More Pythonic Code by Applying the Things You Already Know There’s a mistake I frequently make when I learn new things about Python... Here’s how you can avoid this pitfall and learn something about Python’s enumerate() function at the same time. When I learn a new trick for my Python...
00h00 16  janvier
Working With File I O in Python
Working With File I O in Python Learn the basics of working with files in Python. How to read from files, how to write data to them, what file seeks are, and why files should be closed. In this tutorial you’ll learn how to work with files using Python. Reading and writing to files in any...
00h00 09  janvier
How to Reverse a String in Python
How to Reverse a String in Python An overview of the three main ways to reverse a Python string: slicing , reverse iteration, and the classic in-place reversal algorithm. Also includes performance benchmarks. What’s the best way to reverse a string in Python? Granted, string reversal isn’t used...
00h00 02  janvier
Mastering Click: Writing Advanced Python Command-Line Apps
Mastering Click: Writing Advanced Python Command-Line Apps How to improve your existing Click Python CLIs with advanced features like sub-commands, user input, parameter types, contexts, and more. Welcome to the second Click tutorial on how to improve your command-line tools and Python scripts. I...
00h00 26  décembre
Working with Random Numbers in Python
Working with Random Numbers in Python An overview for working with randomness in Python, using only functionality built into the standard library and CPython itself. Generating Random Floats Between 0.0 and 1.0 The random.random() function returns a random float in the interval 0.0, 1.0). This...
00h00 19  décembre
How to Send an Email With Python
How to Send an Email With Python Learn how to send emails using Python code via the built-in smtplib module from the standard library. In most applications, you need to communicate with your users using electronic methods. Email is used to send password resets, confirmation of orders, and...
00h00 13  décembre
Python Tricks: The Book Is Now Available on Kindle
Python Tricks: The Book Is Now Available on Kindle Get the Kindle version of Python Tricks: A Buffet of Awesome Python Features and enjoy a smooth reading experience across all of your devices. My couch a good book on my Kindle bliss. I can’t help it, it’s my happy place. So whenever I can...
00h00 12  décembre
Python Multi-line Comments: Your Two Best Options
Python Multi-line Comments: Your Two Best Options Does Python support multi-line comments the way other languages do? What are your options for writing comment blocks in Python if you need them? Most programming languages have syntax for block comments that span multiple lines of text, like C or...
00h00 06  décembre
Writing Python Command-Line Tools With Click
Writing Python Command-Line Tools With Click An in-depth tutorial on writing Python command-line (CLI) apps using the Click library for argument parsing and more. Python is often referred to as a glue code language because it’s extremely flexible and integrates well with existing programs. This...
00h00 05  décembre
Python’s enumerate() Function Demystified
Python’s enumerate() Function Demystified How and why you should use the built-in enumerate function in Python to write cleaner and more Pythonic loops. Python’s enumerate function is a mythical beast it’s hard to summarize its purpose and usefulness in a single sentence. And yet, it’s a super...
00h00 28  novembre
Using Python for Mobile Development: Kivy vs BeeWare
Using Python for Mobile Development: Kivy vs BeeWare Mobile application development on Android and iOS wasn’t Python’s strong suit in the past but things might be changing... What about using Python for mobile app development? Historically, Python didn’t have a strong story when it came to writing...
00h00 21  novembre
Memoization in Python: How to Cache Function Results
Memoization in Python: How to Cache Function Results Speed up your Python programs with a powerful, yet convenient, caching technique called memoization. In this article, I’m going to introduce you to a convenient way to speed up your Python code called memoization (also sometimes spelled...
00h00 14  novembre
Finding Python Projects to Grow Your Programming Skills
Finding Python Projects to Grow Your Programming Skills Where to find inspiration for Python projects that will help you develop real-world coding skills and lay the foundation of your programming portfolio. I got this question from a newsletter reader who’s an entry-level Pythonista: What’s the...
00h00 07  novembre
Interfacing Python and C: Advanced ctypes Features
Interfacing Python and C: Advanced ctypes Features Learn advanced patterns for interfacing Python with native libraries, like dealing with C structs from Python and pass-by-value versus pass-by-reference semantics. The built-in ctypes module is a powerful feature in Python, allowing you to use...
00h00 01  novembre
Python Tricks: The Book Launch FAQ
Python Tricks: The Book Launch FAQ I’m getting a ton of emails, Tweets, and YouTube comments from people with questions about my new book. Here’s a quick Q&A to keep you informed and my carpal tunnel happy. Alright, I’m getting a ton (and I mean a ton) of emails, Tweets, and YouTube comments...
00h00 31  octobre
Announcing Python Tricks: The Book
Announcing Python Tricks: The Book It’s finally here I’m super excited to announce the release of my book Python Tricks: A Buffet of Awesome Python Features It’s been a crazy and awesome couple of weeks to get this 300 page book ready for release. I’ve spent almost a year writing and editing...
00h00 24  octobre
Python Parallel Computing (in 60 Seconds or less)
Python Parallel Computing (in 60 Seconds or less) If your Python programs are slower than you’d like you can often speed them up by parallelizing them. In this short primer you’ll learn the basics of parallel processing in Python 2 and 3. Basically, parallel computing allows you to carry out many...
00h00 17  octobre
Writing a Domain Specific Language (DSL) in Python
Writing a Domain Specific Language (DSL) in Python Learn how to create your own Domain Specific Language with Python from scratch with this step-by-step tutorial. A Domain Specific Language, or DSL for short, is a language that’s specialized to a particular application domain. In other words, it’s...
00h00 10  octobre
Getting a Job as a Self-Taught Python Developer
Getting a Job as a Self-Taught Python Developer Do you need a university degree to get a coder job? Is a generic Computer Science degree best or are there more specific programs? I got this email with Python career questions from newsletter reader Brad: First, with regards to your Python Tricks...
00h00 03  octobre
How to Structure Your Python Programs
How to Structure Your Python Programs Learn a simple trick for keeping your Python code organized and maintainable even as a project grows over time. How should you structure your Python programs? Is there a recommended way to bring structure to the chaos? If you’re writing anything that goes...
00h00 26  septembre
I’m bad at math and I’ll never be a real programmer
I’m bad at math and I’ll never be a real programmer Do you have to be good at math to be a good programmer? Should you pursue a computer science career if you’re bad at math? There’s a phase in the life of every coder I call The Valley of Despair. It looks something like this: It’s 3am and my...
00h00 19  septembre
Contributing to Python Open-Source Projects
Contributing to Python Open-Source Projects How can you become a contributor on popular, high-profile Python open-source projects like Django, Requests, and so on? Contributing to open-source projects is a great way to build your programming skills, take part in the community, and to make a...
00h00 12  septembre
Iterator Chains as Pythonic Data Processing Pipelines
Iterator Chains as Pythonic Data Processing Pipelines Here’s another great feature of iterators in Python: By chaining together multiple iterators you can write highly efficient data processing pipelines. If you take advantage of Python’s generator functions and generator expressions, you’ll be...
00h00 05  septembre
Extending Python With C Libraries and the ctypes Module
Extending Python With C Libraries and the ctypes Module An end-to-end tutorial of how to extend your Python programs with libraries written in C, using the built-in ctypes module. The built-in ctypes module is a powerful feature in Python, allowing you to use existing libraries in other...
00h00 29  août
Generator Expressions in Python: An Introduction
Generator Expressions in Python: An Introduction Generator expressions are a high-performance, memory-efficient generalization of list comprehensions and generators. In this tutorial you’ll learn how to use them from the ground up. In one of my previous tutorials you saw how Python’s generator...
00h00 22  août
What Are Python Generators?
What Are Python Generators? Generators are a tricky subject in Python. With this tutorial you’ll make the leap from class-based iterators to using generator functions and the yield statement in no time. If you’ve ever implemented a class-based iterator from scratch in Python, you know that this...
00h00 15  août
Unpacking Nested Data Structures in Python
Unpacking Nested Data Structures in Python A tutorial on Python’s advanced data unpacking features: How to unpack data with the operator and for-loops. Have you ever seen Python’s enumerate function being used like this? for (i, value) in enumerate(values): ... In Python, you can unpack...
00h00 08  août
Python String Conversion 101: Why Every Class Needs a repr
Python String Conversion 101: Why Every Class Needs a repr How and why to implement Python to string conversion in your own classes using Python’s repr and str mechanisms and associated coding conventions. When you define a custom class in Python and then try to print one of...
00h00 01  août
Python Iterators: A Step-By-Step Introduction
Python Iterators: A Step-By-Step Introduction Understanding iterators is a milestone for any serious Pythonista. With this step-by-step tutorial you’ll understanding class-based iterators in Python, completely from scratch. I love how beautiful and clear Python’s syntax is compared to many other...
00h00 25  juillet
How to Install and Uninstall Python Packages Using Pip
How to Install and Uninstall Python Packages Using Pip A step-by-step introduction to basic Python package management skills with the pip command. Learn how to install and remove third-party modules from PyPI. Python is approaching its third decade of good old age, and over the years many...