Sign in

Ivan Karabadzhak

@jakeroid.bsky.social
89 followers 157 following 916 posts

Data Engineer ⋅ Perfecting Python & SQL ⋅ Mastering Vim ⋅ Obsessed with Efficiency ⋅ Using AI/ML to Get Things Done ⋅ Building Wealth Doing What I Love

PostsRepliesMedia
Ivan Karabadzhak @jakeroid.bsky.social · 09/10/2026
Friday brings #Python Did you know that the default value in dict.get() is evaluated even if the key already exists? Now you do.
000
Ivan Karabadzhak @jakeroid.bsky.social · 03/10/2026
Sometimes, to recharge, you need to touch the grass.
000
Ivan Karabadzhak @jakeroid.bsky.social · 02/10/2026
Friday brings #Python Well, actually it brings Python 3.10+. By default, zip silently drops elements without a matching pair. However, starting with 3.10, you can use the strict argument to raise an exception when there’s no matching pair.
010
Ivan Karabadzhak @jakeroid.bsky.social · 25/09/2026
Friday brings #Python With defaultdict + lambda you can build a nested tree that never raises a KeyError. Isn't that cool?
111
Ivan Karabadzhak @jakeroid.bsky.social · 24/09/2026
Sleeping well is crucial.
000
Ivan Karabadzhak @jakeroid.bsky.social · 18/09/2026
Friday brings #Python Let's quickly refresh our memory on what groupBy does. It groups consecutive elements in the input data, which could be useful.
000
Ivan Karabadzhak @jakeroid.bsky.social · 11/09/2026
Friday brings #Python I hope you know about the __missing__ hook for dict subclasses. One interesting detail: it is called only by __getitem__() when a key is missing. Other operations like in or .get() do not trigger it.
000
Ivan Karabadzhak @jakeroid.bsky.social · 04/09/2026
Friday brings #Python There’s a way to provide an end user with a “kind-of-dict” object, but as read only view. This can be useful in some situations.
000
Ivan Karabadzhak @jakeroid.bsky.social · 01/09/2026
Look into these beautiful eyes.
000
Ivan Karabadzhak @jakeroid.bsky.social · 28/08/2026
Friday brings #Python `lru_cache` keys on function args—on methods that includes `self`, so the cache can keep objects alive. Use `maxsize` to cap growth, but note it only limits entries; it doesn’t free objects immediately.
000
Ivan Karabadzhak @jakeroid.bsky.social · 21/08/2026
Friday brings #Python Did you know where self comes from? There is no magic. Python binds an object to the method.
000
Ivan Karabadzhak @jakeroid.bsky.social · 20/08/2026
I like numbers.
000
Ivan Karabadzhak @jakeroid.bsky.social · 14/08/2026
Friday brings #Python Did you know that the dict methods keys() and items() return views? They support set algebra, which allows you to do things like in the screenshot.
000
Ivan Karabadzhak @jakeroid.bsky.social · 08/08/2026
This guy stole my fishing rod, and I was lucky to get it back and then get him out.
000
Ivan Karabadzhak @jakeroid.bsky.social · 07/08/2026
Friday brings #Python Did you know about the sys.intern function? CPython interns some string literals at compile time, but that doesn't affect strings built at runtime. Using this function, you can intern those strings too.
000
Ivan Karabadzhak @jakeroid.bsky.social · 31/07/2026
Friday brings #Python If you need to get columns from the list of tuples, there is an obvious way, but also utilizing the zip method.
000
Ivan Karabadzhak @jakeroid.bsky.social · 24/07/2026
Friday brings #Python If you need to replace three chars in the same string, there is a way. You can use the maketrans and translate methods to do so. Honestly, I didn't know that. Did you?
000
Ivan Karabadzhak @jakeroid.bsky.social · 18/07/2026
I’m crushing!
000
Ivan Karabadzhak @jakeroid.bsky.social · 17/07/2026
Friday brings #Python Last Friday, I showed that accessing the same variable from different coroutines could be tricky. Here's the way to do it.
000
Ivan Karabadzhak @jakeroid.bsky.social · 10/07/2026
Friday brings #Python When you try to access the same variable from coroutines, that could give you unexpected results. As you can see in the screenshot, it's tricky. Next Friday I'll tell you how to avoid that.
010
Ivan Karabadzhak @jakeroid.bsky.social · 09/07/2026
Fishing helps to recharge after a crazy week!
000
Ivan Karabadzhak @jakeroid.bsky.social · 03/07/2026
Friday brings #Python It's one of my favorite quirks of Python. It gives you an error, but simultaneously adds items to the list. Better to know that before shooting yourself in the leg.
000
Ivan Karabadzhak @jakeroid.bsky.social · 26/06/2026
Friday brings #Python ChainMap allows you to use elements from different dictionaries in a chain. It could be useful.
000
Ivan Karabadzhak @jakeroid.bsky.social · 19/06/2026
Friday brings #Python If you need to "wrap" a function with predefined argument values, then partial could be a nice choice for you. I use it actively at my job when I need to chain transformations, but some of them require additional arguments.
000
Ivan Karabadzhak @jakeroid.bsky.social · 12/06/2026
Friday brings #Python Did you know that Python has a built-in graph dependency resolver? Of course, it's not Airflow - but for small projects, it's all you need.
000
Ivan Karabadzhak @jakeroid.bsky.social · 06/06/2026
This weekend is going to be a chill one. Maybe I’ll do a little bit of work on personal projects. I'm not going fishing, but I'll post a photo.
000
Ivan Karabadzhak @jakeroid.bsky.social · 05/06/2026
Friday brings #Python You can play around with files directly in the RAM with Python. For instance, in this example I've created a zip file with two files, txt and csv, directly into memory by utilizing io.BytesIO. That could be useful if you don't want to deal with a temporary directory.
010
Ivan Karabadzhak @jakeroid.bsky.social · 04/06/2026
I've started practicing math, logic, and some other things on Brilliant more than a year ago. Now my streak is 500. That surprises me consistency really works. Thanks to Twitter for telling me that.
010
Ivan Karabadzhak @jakeroid.bsky.social · 29/05/2026
Friday brings #Python Did you know that since Python 3.7, dictionaries preserve the insertion order of elements? If you update an existing key, the order does not change. However, if you delete a key and then add it again, it moves to the end of the dictionary.
020
Ivan Karabadzhak @jakeroid.bsky.social · 22/05/2026
Friday brings #Python Usually, objects in Python have a hidden __dict__ that stores values. However, that adds memory overhead. If you want to reduce it, you can use __slots__. The tradeoff is that in such cases, you cannot dynamically add new attributes.
000
Ivan Karabadzhak @jakeroid.bsky.social · 15/05/2026
Friday brings #Python It's going to be the shortest one. Did you know that bool is a subclass of int?
000
Ivan Karabadzhak @jakeroid.bsky.social · 14/05/2026
Having a cat could improve your mental health.
000
Ivan Karabadzhak @jakeroid.bsky.social · 11/05/2026
It’s a challenge to write something meaningful when you have a 1-month-old baby, a job, some freelance work, and a pet project. My capacity for productivity is high but limited.
000
Ivan Karabadzhak @jakeroid.bsky.social · 08/05/2026
Friday brings #Python Did you know that you can use dict.setdefault() to group values without writing the usual “if key not exists” boilerplate?
010
Ivan Karabadzhak @jakeroid.bsky.social · 01/05/2026
Friday brings #Python 🐍 Have you ever used cached_property? It lets you create a lazily computed property that is calculated only once, on first access.
000
Ivan Karabadzhak @jakeroid.bsky.social · 27/04/2026
When you don’t know what to post, just post your cat.
010
Ivan Karabadzhak @jakeroid.bsky.social · 25/04/2026
Touching the grass!
000
Ivan Karabadzhak @jakeroid.bsky.social · 24/04/2026
Friday brings #Python Did you know that Python allows you to write conditions in a more natural way?
010
Ivan Karabadzhak @jakeroid.bsky.social · 23/04/2026
Clearing my mind from coding!
000
Ivan Karabadzhak @jakeroid.bsky.social · 22/04/2026
Mom would be proud.
000
Ivan Karabadzhak @jakeroid.bsky.social · 21/04/2026
By the way, I haven't mentioned directly that I became a dad. Any congratulations are appreciated alongside luck wishes.
000
Ivan Karabadzhak @jakeroid.bsky.social · 19/04/2026
Look at this beauty!
000
Ivan Karabadzhak @jakeroid.bsky.social · 18/04/2026
It's easy to do on PRO 😁
000
Ivan Karabadzhak @jakeroid.bsky.social · 17/04/2026
Friday brings #Python Let me share another trick. Are you ready for a simple one? You can merge two dictionaries in Python by using the | operator. Isn't that elegant?
010
Ivan Karabadzhak @jakeroid.bsky.social · 10/04/2026
Friday brings #Python Even though I became a dad a week ago, I'll continue posting about Python. I think dedicating time teaches me discipline. Anyways, I hope you haven't forgotten that you can use the = sign inside f-strings to print a variable's name and value at the same time?
010
Ivan Karabadzhak @jakeroid.bsky.social · 03/04/2026
Friday brings #Python Starting with version 3.7, Python guarantees that dict preserves insertion order. You can use it for removing duplicates while preserving order. Looks kind of elegant.
000
Ivan Karabadzhak @jakeroid.bsky.social · 27/03/2026
Friday brings #Python I’m pretty loaded at work and want to wrap everything up before my paternity leave. It’s 11pm here, so I’m sharing this post at the last moment. Do you need to build a simple socket server in Python? There’s a way!
000
Ivan Karabadzhak @jakeroid.bsky.social · 21/03/2026
Here we go.
000
Ivan Karabadzhak @jakeroid.bsky.social · 20/03/2026
Friday brings #Python Today, let’s explore something interesting. If you read io.BytesIO via io.TextIOWrapper inside a function scope, you might lose your data. When the TextIOWrapper is garbage-collected, it automatically closes the underlying BytesIO stream, wiping your bytes! Be careful!
000
Ivan Karabadzhak @jakeroid.bsky.social · 16/03/2026
oh shit, I have to spend them 😁
000