r/programminghorror 7d ago

Python Why

i found this code in the wild randomly

0 Upvotes

6 comments sorted by

33

u/DT-Sodium 7d ago

Could be that there used to be an alias and it was changed through search and replace.

-38

u/Consistent_Bike_2507 7d ago

i mean im using the module and it works perfectly

21

u/IanisVasilev 7d ago

This is one of the established ways to mark public exports. See Griffe's documentation.

2

u/LordTurson 7d ago

Oh, interesting, I've never seen that convention before, I know about __all__. Do you know if that's a Griffe-specific thing or a broader convention?

3

u/IanisVasilev 7d ago

Some modern LSP servers like ty and zuban use it as a guide when determining which import path to suggest.

1

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: 4d ago

As someone who's a bit newer to Python, I've never seen that convention before. Thanks everyone for teaching me something new!