Hi Reader, happy Tuesday! My recent tips have been rather lengthy, so I'm going to mix it up with some shorter tips (like today's). Let me know what you think! 💬 🔗 Link of the week​A stealth attack came close to compromising the world's computers (The Economist) If you haven't heard about the recent "xz Utils backdoor", it's an absolutely fascinating/terrifying story! In short, a hacker (or team of hackers) spent years gaining the trust of an open-source project by making helpful contributions, which eventually allowed them to smuggle a sophisticated, hidden exploit into the code. Had a single developer at Microsoft not discovered the problem (in his spare time!), hackers would soon have gained secret access to hundreds of millions of computers, allowing them to steal private data from banks, governments, and more. For more technical details, see this article from Ars Technica. 👉 Tip #44: Augmented assignment in PythonIf you're new to Python (or programming in general), you might be confused by code like this: x += 1 As long as x is a number, that code translates to: x = x + 1 In other words, it's a concise way to increment the value of x by 1. This is known as "augmented assignment," and there are actually a dozen other augmented assignment operators in Python. Here are the most common ones: x -= 3 (translates to x = x - 3) x *= 4 (translates to x = x * 4) x /= 2 (translates to x = x / 2) Under the hood, these statements call dunder methods such as __iadd__, __isub__, and so on, which means that their behaviors can be customized for different types of objects. In case you're curious, the "i" in __iadd__ stands for "in-place" because it mutates the original object. As such, you may notice an unexpected behavior if you try to use these operations with Python lists. 👋 See you next Tuesday!Did you like this week’s tip? Please forward it to a friend or share this link with your favorite online community. It really helps me out! - Kevin P.S. xkcd comes true (a reference to the link of the week) Did someone AWESOME forward you this email? Sign up here to receive Data Science tips every week! |
Join 25,000+ intelligent readers and receive AI tips every Tuesday!
Hi Reader, Here are your top AI stories for the week: ChatGPT can weaken your brain Claude shares nerve gas recipe Amsterdam ends AI experiment due to bias Read more below! 👇 Sponsored by: Brain.fm Transform Your Focus With Brain.fm I know you're always on the hunt for tools that genuinely improve your life—which is why I'm excited to introduce you to Brain.fm's groundbreaking focus music. Brain.fm's patented audio technology was recently validated in a top neuroscience journal, showing how...
Hi Reader, Last week, I invited you to help me test Google's Data Science Agent in Colab, which promises to automate your data analysis. Does it live up to that promise? Let's find out! 👇 Sponsored by: Morning Brew Business news you’ll actually enjoy Join 4M+ professionals who start their day with Morning Brew—a free daily newsletter that makes business, tech, and finance news genuinely enjoyable to read and hard to forget. Each morning, it breaks down complex stories in plain English—cutting...
Hi Reader, Today I'm trying something brand new! I wrote short summaries of the 5 most important AI stories this week, and also turned it into a video: Watch the video I'd love to know what you think! 💬 AI-generated TV ad airs during NBA finals Prediction market Kalshi just aired this AI-generated ad on network TV during the NBA finals. It was created in just two days by one person using Google's new Veo 3 video model, plus scripting help from Google's Gemini chatbot. Expect to see many more...