r/pythontips • • May 09 '25

Standard_Lib Anyone else lowkey scared of *args and **kwargs for the longest time?

90 Upvotes

Whenever I saw *args or **kwargs in a function, I’d immediately zone out. It just looked... weird. Like some advanced Python wizardry I wasn’t ready for.

But I recently hit a point where I had to use them while building a CLI tool, and once I actually tried it—it wasn’t that bad. Kinda cool, actually. Being able to pass stuff without hardcoding every single parameter? Big win.

Now I keep spotting them everywhere—in Flask, pandas, decorators—and I’m like, ohhh okay… that’s how they do it.

Just curious—did anyone else avoid these too? What finally helped you get comfortable with them?


r/pythontips • • Oct 30 '20

Python3_Specific Learn to code with Python for FREE on Udemy!

88 Upvotes

r/pythontips • • May 10 '21

Syntax String Interning in Python: A Hidden Gem That Makes Your Code Faster

87 Upvotes

I didn't know this mechanism for the first time of using Python. But when I found it, I think it's really a hidden gem to speed up string comparisons.

Full article:

String Interning in Python: A Hidden Gem That Makes Your Code Faster


r/pythontips • • Jan 28 '24

Python2_Specific I want to learn python but I don't know how to start

85 Upvotes

I'm 16 years old and I want to begin at learn python I want some advises for start


r/pythontips • • Apr 05 '21

Meta Passing along a good free course to learn Python basics

85 Upvotes

Hey everyone!

I’ve spent the past few months building courses that teach Python through real-life projects like analyzing NBA data or web scraping listings from Airbnb. I designed my courses so a complete beginner would understand them with 0 prior coding experience and each one takes less than 4 hours.

I’ve been teaching coding for a while (previously at General Assembly before starting my own site) and am really passionate about helping people learn to code. I thought it would be fun to design a course around a topic people love - basketball - to teach the basics of Python in less than 1 hour. You can see a sneak peak of the course here.

You can sign up to take the course with me live on April 13th @ 6pm EST here. I've also pre-recorded the course if you want to take it on your own time - the course is free regardless of how you take it :)

Also, I’ll be giving away lifetime access to the courses I’ve come out with (web scraping listings from Airbnb and analyzing NBA data) to 3 people who join the live course. I’d love for as many people to join as possible, so I’ll share a personalized referral link with you that helps you increase your odds of winning the giveaway when you sign up.

Really excited to teach you all!


r/pythontips • • May 27 '21

Module Tkinter Designer, Automate and beautify GUI creation ☄️

84 Upvotes

Tkinter Designer is created to speed up and beautify Python GUI Experience. It uses well know design software called Figma. Which makes creating Tkinter GUI in Python a piece of cake.

https://github.com/ParthJadhav/Tkinter-Designer

Of course you will need to tweak some things after it’s created but it saves a lot of time


r/pythontips • • Jul 03 '22

Python3_Specific New Python Anvil tutorial, 150+ pages, with 220 screenshots, and 25 app examples

83 Upvotes

Hi all,

I wrote a new tutorial for the Python Anvil framework, intended for absolute beginners. It’s a total of 150 pages, with more than 220 screenshots and 25 app examples. It covers the basics of coding in Python, in context, so users who’ve never written a line of code before can use Anvil to take their first steps (and get quite a way on their journey). I put the tutorial, maybe better described as a mini-course, up for free at:

pythonanvil.com

I hope it’s useful for new users. Please let me know if there’s anything you’d like to see added/updated. Thank you!

Nick Antonaccio


r/pythontips • • Mar 26 '23

Python3_Specific Python Now has Switch Statements!

81 Upvotes

If you have been using Python for some time now you may have overlooked the fact that Python recently has incorporated "Switch Statements" in the form of "Match Case"! This was notoriously a lacking thing in the language, many programmers coming from other languages complained about this...

Thankfully, Python 3.10 introduced the new functionality. "Match" is used to match a value against a set of patterns and execute the corresponding block of code for the first matching pattern. This removes the need to write long code in nested if-else blocks which greatly helps the readability of your code! I suggest everyone be familiar with this logic as it will be much more prevalent in codebases going forward.

You can find out more about how to use it in my Youtube Video as well as other Python tips as well. Don't forget to like, comment, and subscribe. Hope you learn something new!

https://www.youtube.com/watch?v=2U98PgL-kuI


r/pythontips • • Jun 04 '16

Syntax Demystifying underscores in Python

80 Upvotes

One Underscore

A single underscore by itself is usually to convey a dummy variable that need not be used but was still encountered. This is merely a convention. An example of this is when iterating over an enumerated list and only the index is required, not the item. You may wish to convey in the code as follows:

for i, _ in enumerate(my_list):
  print i

 

One Underscore Before Name

_variable 

This is semiprivate and indicates to others that this is a hidden variable. It appears hidden at first glance but can be both found and accessed easily by anyone using your code. Note that names starting with _ will not be imported via "from module import *".

 

Two Underscores Before Name

__variable 

This is often incorrectly considered superprivate, while it's actual meaning is just to namemangle to prevent accidental access. This can happen if a child class inherits from your class but __variable needs to be unique to both. Under the hood it is now:

_parentclass__variable and _childclass__variable.

 

Double Underscores (also known as dunder)

__variable__ 

This is typically reserved for builtin methods like __init__, __str__, etc.

 

Underscores used in numbers (as of Python 3.6)

As of Python 3.6, the underscore can be used as a separator in numeric values, to make them more readable:

>>>100_000_000 == 100000000
True

Edit: Added more as they were pointed out in the comments. Thanks to u/SLGC, u/pvkooten, u/Underyx for the updates!


r/pythontips • • Jan 03 '21

Data_Science [For Any python programmers interested in AI] Join a community of over 6 000 AI enthusiasts, ask questions, get access to the best resources, keep up to date with the news, find a job, find teammates to learn and much more! The Official Discord Partnered Community for AI

79 Upvotes

Join a community of over 6 000 AI enthusiasts, ask questions, get access to the best resources, keep up to date with the news, find a job, find teammates to learn, and much more!

It is an Official Discord Partnered Community for AI

You can join it by clicking this link:
https://discord.gg/learnaitogether


r/pythontips • • Dec 31 '19

Python Project Ideas for 2020 – Work on real-time projects to head start your career

79 Upvotes

Python is the most used programming language on the planet. Gaining Python knowledge will be your best investment in 2020. So, if you want to achieve expertise in Python than it is crucial to work on some real-time Python project ideas.

Python is booming and so is its Github page. This year was great for Python and we saw some very powerful python open-source projects to contribute to. Today, we’re listing down some of the top python open-source projects; try contributing to at least one of these, it will help improve your Python skills. Read More


r/pythontips • • Apr 19 '24

Python3_Specific The *Best Python Cheat Sheet

77 Upvotes

A dense Python cheat sheet (https://kieranholland.com/best-python-cheat-sheet/) with just what you need.
Design principles:

  • Focus on Python core

  • Comprehensive but selective (Just what you need)

  • Densely packed

  • Well-linked and linkable

  • Responsive

  • Printable version

Issues and feedback are tracked at the best-python-cheat-sheet repository.
*It may not be the best Python cheat sheet, but it aspires to be. Send feedback.


r/pythontips • • Nov 09 '20

Meta 10 ideas to reverse engineer web apps : Web scraping 101

77 Upvotes

Hi all, I have done quite a lot of web scraping / automations throughout the years as a freelancer.

So following are few tips and ideas to approach problems that occurs when doing a web scraping projects.

I hope this could be of some help.

There is a TL;DR on my page if you have just 2 minutes to spare.

http://thehazarika.com/blog/programming/how-to-reverse-engineer-web-apps/


r/pythontips • • Mar 04 '19

Python Security Best Practices Cheat Sheet

77 Upvotes

r/pythontips • • May 29 '24 Take My Silver

Module What is your favorite Python library and why?

76 Upvotes

What is your favorite Python library and why? Because I am searching for libs to study in the free time.


r/pythontips • • Aug 21 '21

Python3_Specific 70+ Python Projects for Beginners, Intermediate and Experienced Developers

76 Upvotes

Some of my favorite projects from the list are

  • Blog Web Application Project using Python

  • Full-Stack Ecommerce Website

  • Bitcoin Price Notification

  • Scraping StackOverFlow using Scrapy and MongoDB

  • URL Shortener with PyShortener

I think it's worth to give a look at all the projects.

You can check all the projects from here: Python Projects


r/pythontips • • Dec 02 '20

Python3_Specific Send an email through your Gmail account using python

74 Upvotes

Hello everyone

I wrote a blog about how to send an email through your Gmail account using python script. It includes sending a plain text email, an email with attachments, and an email with HTML content. please provide your feedback on this.

https://thequickblog.com/sending_email_in_python/

Thank you !!

#python #automation #tutorail


r/pythontips • • Jul 11 '23

Syntax How to download a specific segment of a youtube video?

73 Upvotes

Hey guys, is there a way to download a specific segment of a youtube video? I am able to download the entire video but I only want the first 20 seconds. Is there a way to do this?


r/pythontips • • Oct 03 '19

71 Python Interview Questions and Answers [New] – Get Ready for Technical Round

73 Upvotes

Welcome to the second part of DataFlair’s Python Interview Questions and Answer Series. If you are the first time visitor then you must take a quick look at the series –

As I told you, this is the second part, it mainly focuses on intermediates. In all the parts we have divided the questions into below subcategories so that it will be easier for you to find the question and answer you are searching for. Also, as per the feedback, this is the best way for Python Interview Preparations. Have a look –

  • Basic Python Interview Questions for Intermediates

  • Top Python Interview Questions

  • Python Developer Interview Questions

  • Python OOPS and Library Interview Questions

  • Technical Python Interview Questions and Answers

  • Advanced Python Interview Questions

  • Open-ended Python Interview Questions

Basic Python Interview Questions for Intermediates

Below are some basic python interview questions for intermediates, I recommend you to try to answer them by yourself. If you feel you are not able to answer the question, refer to the answers given by interview experienced.

Q.1. When is the else part of a try-except block executed?

In an if-else block, the else part is executed when the condition in the if-statement is False. But with a try-except block, the else part executes only if no exception is raised in the try part.

Q.2. If a list is nums=[0,1,2,3,4], what is nums[-1]?

This code does not throw an exception. nums[-1] is 4 because it begins traversing from right

Q.3. What is the PYTHONPATH variable?

PYTHONPATH is the variable that tells the interpreter where to locate the module files imported into a program. Hence, it must include the Python source library directory and the directories containing Python source code. You can manually set PYTHONPATH, but usually, the Python installer will preset it.

Read More


r/pythontips • • Apr 10 '21

Python3_Specific Basic GUI Calculator in Python

72 Upvotes

One of the great ways to learn building GUIs with tkinter is to try creating a calculator app:

https://pyshark.com/basic-gui-calculator-in-python/


r/pythontips • • Nov 12 '25

Data_Science Stop skipping statistics if you actually want to understand data science

71 Upvotes

I keep seeing the same question: "Do I really need statistics for data science?"

Short answer: Yes.

Long answer: You can copy-paste sklearn code and get models running without it. But you'll have no idea what you're doing or why things break.

Here's what actually matters:

**Statistics isn't optional** - it's literally the foundation of:

  • Understanding your data distributions

  • Knowing which algorithms to use when

  • Interpreting model results correctly

  • Explaining decisions to stakeholders

  • Debugging when production models drift

You can't build a house without a foundation. Same logic.

I made a breakdown of the essential statistics concepts for data science. No academic fluff, just what you'll actually use in projects: Essential Statistics for Data Science

If you're serious about data science and not just chasing job titles, start here.

Thoughts? What statistics concepts do you think are most underrated?


r/pythontips • • Jul 31 '20

Short_Video Make a Twitter bot that bothers your ISP about slow internet

71 Upvotes

No guarantees that it will fix your internet, but a fun Python project no less. ;) https://youtu.be/yKqBI5nVHvE


r/pythontips • • Mar 27 '23

Module 10 highly effective BI dashboards built with Python

70 Upvotes

Hey folks,

As a freelancer, I have built multiple dashboards for a lot of clients. I decided to combine all of them together into a blog.

The 10 plots and problem scenarios discussed in my blog are:-

  1. Line Chart - How has the news paradigm in India shifted over the last 10 years?

  2. Stacked Area Chart - What are the total sales generated by an MNC across all its market during the last year?

  3. Bar Chart - What is the YoY(Year-on-Year) monthly sales comparison for a company?

  4. Pie Chart - What was the approval % of a bill introduced in the winter session of Parliament?

  5. Scatter Plot - How does the rent of a house vary with the house size?

  6. Bubble chart - How deadly(fatality rate) and widespread(number of fatalities) is a particular disease?

  7. Candlestick - How has Nifty 50 performed on the National Stock Exchange in the month of October?

  8. Timeseries - What is the distribution of "Close" value of Nifty 50 for the last 1 year?

  9. Histograms - What is the gender-wise distribution of students' height in a school?

  10. Heatmap - What is the Monthly Recurring Revenue(MRR) retention of a company?

I have also added a lot of helper articles for getting acquainted with plotting libraries in Python. Check them out!


r/pythontips • • Sep 07 '22

Standard_Lib Don't use the time() function to measure performance!

70 Upvotes

The time library actually has tools made just to measure the performance of functions or tasks:

Don't use time() to measure the performance of a function in python