#Python tip of the day Got a slow import? You can trace it with the "importtime" module[1] (batteries included) and visualize those results with a project by kmichel[2]. For instance, I was curious about import times for #cvxpy. [1]: python -X importtime $MODULE 2> importtime.txt [2]: https://lnkd.in/dB4dcz-p
"Optimize Python imports with importtime module"
More Relevant Posts
-
"Hello World!" - 21/10/2025 #A package in Python is a folder that groups related modules (Python files) together. # __init__.py file tells Python: “This folder is a package—treat it like a module that can be imported.” #on this problem set we have run pytest on the whole folder instead of particular file.
To view or add a comment, sign in
-
-
Python trick: safe thread termination through an Event flag Many people simply set daemon=True and hope everything stops on its own. But that breaks control and can lead to leaks. A simpler and more reliable way is to use a shared Event to notify threads about shutdown. to learn more check python docs https://lnkd.in/eSxZ3Tds Want to discover python stuff like this, let connected 👨💻 #Python #Threading #Event
To view or add a comment, sign in
-
-
Powerful One Liners in Python 1. Swap two numbers n1, n2 = n2, nl 2. Reverse a string reversed_string = input_string[::-1] 3. Factorial of a number fact = lambda n: [1, 0] [n>1] or fact(n-1)*n 4. Prime numbers primes = list(filter (lambda x:all (x%y!=0 for y in range(2, x)), range(2, 10))) 5. String Palindrome palindrome = input_string == input_string[::-1] share your favorite one liner 👇 #python #programming
To view or add a comment, sign in
-
🚀 Python 3.14 introduces “t-strings” and here’s why they matter! If you’ve ever used f-strings in Python (f"Hello {name}"), you already know how convenient they are for string interpolation. But in Python 3.14, there’s a new player: t-strings (t"Hello {name}"). So, what’s the difference? 💡 f-strings: - Evaluate immediately at runtime. - Produce a regular string (str). - Great for logs, messages, and anything that’s safe to interpolate directly. 💡t-strings: - Introduced in Python 3.14. - Create a Template object instead of a plain string. - Interpolation happens later, when you explicitly substitute data. more details: https://lnkd.in/eQyTB_kQ #Python #Python314 #Programming
To view or add a comment, sign in
-
-
This is an IES Python script which automatically runs 6 simulations as a parametric analysis. ▪️6 heating thermostat setting are chosen from 10 degC to 20 degC. ▪️6 ApacheSim simulations are run, one for each thermostat setting. ▪️The simulation results are saved as separate .aps results files. 💡Full details and the Python script are available here: https://lnkd.in/ehV7GXSn ❓ Any thoughts or comments? Please let me know. #IES #Python
To view or add a comment, sign in
-
-
🐍 Day 1/30 — Print Statement in Python Today, I learned one of the most basic and essential concepts in Python how to display output using the print() function. It’s used to show messages, numbers, or results on the screen. 👇 print("Hello, Python!") Output: Hello, Python! 🧠 Tip: Always write text (strings) inside quotes " " or ' '. You can also print numbers or multiple values together, like this: print("Sum:", 5 + 3) #Python #LearnPython #PythonBasics #Scaler #CodingJourney #PythonForBeginners #30DaysOfCode #30DaysOfPythonjourney!
To view or add a comment, sign in
-
-
This blog post contains a few different tips on making nice line charts in python. https://lnkd.in/eX5baJf8 Two things I like to do: - superimpose points on top of the lines (makes it easier to identify specific time points) - draw some lines as lighter grey, so they fade into the background (and highlight only one or two lines)
To view or add a comment, sign in
-
-
Python Day 5 Tip: Difference Between append() and extend() Both are used to add elements to a list , but they work differently! # Example list1 = [1, 2, 3] list1.append([4, 5]) print(list1) #output is [1, 2, 3, [4, 5]] list1 = [1, 2, 3] list1.extend([4, 5]) print(list1) #output is [1, 2, 3, 4, 5] 1) append() adds the entire object as a single element. 2) extend() adds each element from the iterable individually. Tip: Use append() for single items and extend() for adding multiple items at once. #Python #30DaysOfpythonCode #PythonTips #Coding #FullStackDeveloper #LearnPython #PythonLearning
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
This is really convenient. Thanks for sharing I usually use pyinstrument for performance profiling like this: import pyinstrument profiler = pyinstrument.Profiler() profiler.Start() import my_slow_module profiler.Stop()