Python Advanced Tips (@AdvancedPython) profile picture

Tips for programming in #Python and programming in general, especially in data science and machine learning field. More advanced than what's usually on Twitter.

Joined September 2020
Python Advanced Tips retweeted
Python decorators, level 2: decorators that take arguments In this thread we'll try to wrap our heads around functions that create functions that create functions. Let's dive in.
1
2
7
Python Advanced Tips retweeted
Let's learn a bit about Python decorators. 🧵 Bear with me for a couple of tweets and I am sure you'll understand them. Decorators are mind-bending sometimes, so I'll try to use very self-explanatory names. This is my first thread ever, let's see how it goes. ^^
14
113
15
526
You can pass a keyword argument containing a whitespace to a function like this: >>> foo(**{"the argument": 1}) Useful when adding columns with pd.DataFrame.assign()
1
2
If you rename your #python project, be sure to remove <old-project-name>.egg-info directory before reinstalling it in your venv. Otherwise #pip will get confused and may not be able to install all project's dependencies.