Menu

#GlobalS

1 post

Feed
1 of 1 post
0Read More

Mysterious Lazy Imports

Reddit r/Python·u/__peg_parser__·16 days ago
#KKuEfj4c
#json#lazy#import#type#globals

Run this on Python 3.15: >>> lazy import json >>> type(globals()['json']) Now try separating that into an innocent variable: >>> lazy import json >>> x = globals()['json'] >>> type(x) Looks like the same code, but what?! The output changes!…

15s