@bbelderbos@fosstodon.org
@bbelderbos@fosstodon.org avatar

bbelderbos

@bbelderbos@fosstodon.org

Software developer and entrepreneur. Helping people grow their Python + programming skills through https://fosstodon.org/@pybites

This profile is from a federated server and may be incomplete. Browse more on the original instance.

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

Looking back upon an amazing ๐Ÿ๐Ÿคฏ

It has shown me once more that although youโ€™ll learn about cool trends, ultimately itโ€™s all about the people + the opportunity to connect F2F. ๐Ÿ˜

Attend conferences! They are important for your career + ongoing inspiration๐Ÿ’ก ๐Ÿ“ˆ

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

In our latest @pybites podcast I list out 10 essential things to add to your project on .

Hope it helps you if you're not sure where to start.

Check it out here: https://youtu.be/eBq4v_eOD-Y

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

You want emojis in ?

Check out the emoji library ...

  • You can use emojize to convert a string to emoji,
  • demojize to go the other way,
  • or use EMOJI_UNICODE / EMOJI_ALIAS_UNICODE to search for emojis.

Example:

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

tip: you can use random.seed() to make random's outputs predictable ๐ŸŽฒ๐Ÿ”„ - example below.

Ideal for testing to ensure results are reproducible! ๐Ÿ’กโœ…

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

Need unique values from a list in ?

Use a set - example below. Do note that you'll lose the original order.

bbelderbos, to github
@bbelderbos@fosstodon.org avatar

๐Ÿš€ Quickly jump from your local #git repository to its corresponding GitHub page with this handy shell alias! โœจ

๐Ÿ”— Add openrepo to your shell profile or rc file, source it, and now you can simply type openrepo in your terminal to open your GitHub repo. ๐Ÿ˜Ž

#GitHub #DevTip

bbelderbos,
@bbelderbos@fosstodon.org avatar

@adamchainz interesting, thanks

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

tip: random.choices can be used to generate random samples with bias.

The weights parameter can be used to specify the probability of each item being chosen which is proportional to its weight relative to the sum of all weights.

Here is a simple example:

bbelderbos,
@bbelderbos@fosstodon.org avatar

Sign up for our weekly newsletter and get our ebook for free containing 250 more Pythonic code examples. ๐Ÿ ๐Ÿ˜ ๐Ÿ’ก ๐Ÿ“ˆ

http://pybit.es/newsletter/

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

Increase flexibility and reusability, reduce coupling, and avoid complex class inheritance issues.

The 'composition over inheritance' design pattern can simplify your codebase. ๐Ÿ› ๏ธ๐Ÿ’ก

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

With error handling in #Python, handle specific exceptions (known issues) first.

Reserve a general Exception catch-all for the end โ€” and only use it if you're unsure of more specific exceptions that may arise. ๐Ÿ’ก

Remember, explicit is better than implicit! ๐Ÿ ๐Ÿ˜

bbelderbos,
@bbelderbos@fosstodon.org avatar

@jamescooke interesting, can you share a horror story / what the risk is?

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

๐Ÿ” The other day I learned via @pythonbytes that you can also write decorators using classes! ๐Ÿ’ก

Check out the basic comparison below:

โ€ข Function-based: keeps it simple. ๐Ÿ› ๏ธ
โ€ข Class-based: scalable for more complex needs. ๐Ÿ“ˆ

Ever used class-based decorators? How?

bbelderbos,
@bbelderbos@fosstodon.org avatar
bbelderbos, to python
@bbelderbos@fosstodon.org avatar

Streamline your test data generation in with Faker ๐Ÿ’ก ๐ŸŽ‰

Here's a quick snippet to create realistic user profiles with matching names and emails.

Enhance your testing with data that feels real. ๐Ÿ๐Ÿ”ง๐Ÿ“ˆ

bbelderbos,
@bbelderbos@fosstodon.org avatar

For more tips join our weekly newsletter: https://pybit.es/newsletter/

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

In you can use sub() from the "re" module to do regex string replacing.

If you want to keep a count of the number of replacements done as well, you can use subn() which returns a tuple of the new (replaced) string and the number of replacements made.

For example:

bbelderbos,
@bbelderbos@fosstodon.org avatar

Practice regex on our platform with this learning path: https://codechalleng.es/bites/paths/regex

bbelderbos, to django
@bbelderbos@fosstodon.org avatar

Bootstrap might seem a bit unoriginal, but it's also a quick + easy way to make your app/MVP look 'good enough'.

So instead of manually linking JS/CSS files and adding css classes to forms, just use django-bootstrap.

bbelderbos,
@bbelderbos@fosstodon.org avatar

Here is a walk-through video:
https://www.youtube.com/watch?v=YmJ0TACm8oE

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

Custom exceptions boost code clarity and intent in , aligning with the Zen's "explicit is better than implicit."

Check out this clean example from the pyjokes package:

bbelderbos,
@bbelderbos@fosstodon.org avatar

@0x1ac interesting, is that just because you feel it's closer to that exception or does it have other benefits as well?

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

What is the Zen of all about? Robin and I produced a bunch of YouTube shorts a while back. ๐Ÿ’ช

We hope you indulge with us for a bit, reflecting on why we think it explains much of Python's elegance and awesomeness ๐Ÿ ๐Ÿ˜ ๐Ÿ’ก

Enjoy! https://www.youtube.com/watch?v=h-8Ij34nab8&list=PLhaG3iqe9VDa9uHRV3RBf8q1DCSSD5Vu7

bbelderbos, to random
@bbelderbos@fosstodon.org avatar

๐Ÿ”ฅ Boost your developer skills with our "9 Command Line Tips Every Developer Should Know" training.

Mastering will make you more productive in your daily dev workflow (and it'll compound!) ๐Ÿš€

Our favorite tricks + tips in one concise video ๐ŸŽฌโœจ
https://www.youtube.com/watch?v=PiVOxEsr-Ag

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

This is how you can figure out on what day you were born in ... enter the calendar module:

bbelderbos,
@bbelderbos@fosstodon.org avatar

@tshirtman really nice!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • โ€ข
  • provamag3
  • thenastyranch
  • magazineikmin
  • InstantRegret
  • Durango
  • rosin
  • Youngstown
  • everett
  • slotface
  • ngwrru68w68
  • mdbf
  • ethstaker
  • kavyap
  • DreamBathrooms
  • JUstTest
  • osvaldo12
  • cisconetworking
  • modclub
  • GTA5RPClips
  • khanakhh
  • tacticalgear
  • cubers
  • tester
  • Leos
  • megavids
  • normalnudes
  • anitta
  • lostlight
  • All magazines