MikeTrendsTrends right now

Mmastodon TechnologySoftware first seen 28 d ago, last 28 d ago, peak #12

Python's import semantics trip up developers

Original: Fun with Python: from mod import X imports the **value** of mod.X and binds it to a variable named X in the importing mo

A programmer is highlighting a common Python misunderstanding: 'from mod import X' copies the value of mod.X into a new local variable, so reassigning X in the importing module does not change mod.X. The two remain separate bindings, and the original module attribute stays untouched unless you import the module itself and modify the attribute directly.

Why now: Developers frequently hit this confusion and share explanations of Python's import behaviour online.

Python

Open on mastodon →

Rank over time, top of the chart is #1. 2 snapshots from 28 d ago to 28 d ago.

Evidence

API: https://socialmediatrends-api.osmike.com/v1/trends/2764936