pythonbase (@pythonbase) header
pythonbase (@pythonbase) profile picture

Python Base covers Python news, resources and Python code snippets.

Joined April 2019
"Give someone a program, you frustrate them for a day; teach them how to program, you frustrate them for a lifetime." - David Leinweber
12
359
25
1,312
#python tip: Make self-describing data by adding docstrings to named tuple attributes and to properties: OMS_Burn = namedtuple('OMS_Burn', ('thrust', 'impulse')) OMS_Burn.__doc__ = 'RCS MMH/N₂O₄' OMS_Burn.thrust.__doc__ = 'kilonewtons' OMS_Burn.impulse.__doc__ = 'milliseconds'
5
50
3
213
#Python cuteness: The walrus assignment expression operator and an f-string reverse walrus operator on the same line: for angle in range(360): print(f'{angle=}\N{degree sign} {(theta:=radians(angle))=:.3f} {sin(theta)=:.3f}')
24
37
10
161
As a #python 3.8 learning exercise, I'm using the walrus operator, / notation, and f= at every opportunity and then evaluating the result for clarity. The goal is to learn when the new features are better and when they are worse. On Twitter, I'm presenting them without judgment.
5
23
2
163
pythonbase retweeted
Have 100+ books (mostly non-fiction) that I need to dispose of urgently in order to make space for new purchases. Selling as low as Rs 300 /book. Huge discount if someone can take all of them. Plz RT I am in Karachi.
3
8
2
#pytest 5.0 has been released! This is the first release which is **Python 3 Only** -- the release also contains a bunch of new features and fixes. Check out the full changelog: docs.pytest.org/en/latest/ch…
1
76
5
159
pythonbase retweeted
Since Yahoo Finance API is deprecated, there are limited options to grab their data. If you're doing it in Python, go for yfinance package by @Aroussi, pulls data in pandas frame. Fun to work with. 👍 github.com/ranaroussi/yfinan… nitter.cf/kashaziz/status/114463…
Working on #Python #Flask web service to provide stock related info. 1. Input: Stock symbol, say MSFT via URL end point 2. Data fetched from Yahoo Finance and other sources 3. Excel document generated with company info, financials, stock history 4. Output: base64 encoded JSON
1
3
4
🐍📰 Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 3 — realpython.com/flask-connexi…
16
52
how I got better at debugging
136
3,199
266
10,695
pythonbase retweeted
Working on #Python #Flask web service to provide stock related info. 1. Input: Stock symbol, say MSFT via URL end point 2. Data fetched from Yahoo Finance and other sources 3. Excel document generated with company info, financials, stock history 4. Output: base64 encoded JSON
1
1
1
1
Are you a novice Python user, and want to help the community? Nicole is specifically looking for people with little or no experience with security and 2FA to provide feedback. If that’s you, please sign up for a session - you can help make PyPI better for everyone!
🐍📦✨ Searching for #python people to user test the latest security features deployed to @pypi Do you have a PyPI account? Do you have 30 minutes to speak with me? I'd love to find out if the new interfaces work for you :) Please signup here: calendly.com/nlhkabu/pypi 🐍📦✨
13
15
#python tip: itertools.repeat() is faster than range() for looping a fixed number of times when you don't need the loop variable. min(random() for i in range(10_000)) # 1.03 msec per loop min(random() for _ in repeat(None, 10_000)) # 841 usec per loop
6
116
6
496