Share
 

Hey Pythonista,

Hope your week is going well!

Here are our 5 bullets of the week:

1) We now officially support veterans 🎉

We’re excited to introduce to you the Pybites Developer Initialization (PDI) Program for Veterans 🎉

We designed this program to support active duty military personnel and military veterans as they transition from the military into the corporate world.

This program offers personalized coaching, a veteran-focused tech curriculum emphasizing Python and essential tech concepts, and hands-on project experience.

Our aim is to highlight the strengths of veterans, such as leadership and discipline, and help prepare them for successful roles in the tech industry.

Without a doubt, PDI for Veterans is a labour of love and something that we're incredibly proud to be rolling out. It's also something very close to Julian's heart.

The page still has a little way to go, but we're not going to let perfectionism slow down the launch!


If you know any veterans that can benefit from this program, please send this email to them. 🙏

And finally, if you, your company or if you know of any institution that would sponsor a veteran to go through the program, please reply to this email or message Julian directly in the Pybites Community or on LinkedIn.

2) Python pitfall: mutable default arguments

In Python, using mutable objects (e.g. lists / dicts) as default arguments in functions can lead to unexpected behavior.

This happens because the default argument is evaluated only once when the function is defined, not each time it's called.

Better solution: use `None`:

>>> def sum_numbers(number, all_numbers=[]):
...     all_numbers.append(number)
...     return sum(all_numbers)
...
>>> sum_numbers(1, [2, 3])
6
>>> sum_numbers(1)
1
>>> sum_numbers(2)  # oops, should return 2!
3
>>> def sum_numbers(number, all_numbers=None):
...     if all_numbers is None:
...         all_numbers = []
...     all_numbers.append(number)
...     return sum(all_numbers)
...
>>> sum_numbers(1)
1
# ok now
>>> sum_numbers(2)
2
>>> sum_numbers(3)
3


3) The story behind Pydantic

We recorded an amazing interview with Pydantic creator Samuel Colvin last week.

Delving into the origins, Samuel shared how Pydantic was conceived to streamline data validation, drawing inspiration from similar tools but quickly exceeding expectations in popularity and adoption.

Samuel touched on the monumental speed improvements in version 2, achieved by incorporating Rust, and shared insights into the transition of Pydantic into a company.

And last but not least Samuel demo'd Pydantic's new exciting Logfire product that just came out!

So make sure you watch this one on YouTube to get the full benefit, it will drop there soon: https://youtube.com/c/pybites

4) We love Django and if you were to pick up just one book ...

... it would be Django by Example. 💪

Antonio Melé is putting the finishing touches on his brand new v5 edition. 🎉

This to us is the best book on the market to supplement your project work in Django (yes, first and foremost you have to build!), because:
  • It's project based,

  • It goes deep into the inner workings of the framework, and

  • It includes a lot of related tools + tech the typical Python web dev working with Django will encounter.

Other changes / updates in the new edition:
  • New Django 5 features (e.g. database-computed default values, admin facets, simplified templates for form field rendering)

  • More chapter technical overview diagrams (25+), for example to explain middleware execution

  • More content on Django management commands and using python-decouple for environment variables

  • Updated content on TrigramExtension for postgres and dockerized Redis and RabbitMQ setups

  • Added tasks to extend each project leveraging ChatGPT prompts 😎

Antonio / Packt were so nice to create a discount voucher especially for the Pybites Community. We'll be sharing it in this thread in the community when we receive it this week.


(Not in our Circle community yet? Good time to join now!)

5) From the archives


In this episode we use our pybites-search tool as an example to explain how to package a Python project and upload it to PyPI.

If you want to ship your own project, we hope this resource makes this easier for you. Let us know ...

---

Have a great rest of your week!

Bob & Julian


P.S.

Interested in really mastering Python development?

There's no better way than joining our PDM program!

Here is what a recent graduate has to say about it:

> Another important concept for me was “JIT learning,” that is, the approach of not trying to master the entirety of a subject before you start to build but rather learning as you build. This approach helps to counter the uncertainty and paralysis that kills so many projects before they even begin, and is something I continue to rely on even after finishing the program. I’ve emerged from PDM much more confident, chiefly because I can now point to something concrete that I built.

So, working with us gives you triple the benefit:
  • Really grasping SW development

  • Coming out with tangible projects and proof of your skill level

  • Ongoing confidence and a more effective approach to whatever you tackle from there on!

It all starts with a strategy session about your goals and what you want to build with Python.

When ready book Julian or I (Bob) in for such a call: https://go.oncehub.com/pybiteschat


Email Marketing by ActiveCampaign