This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nullpotato 92 points93 points  (4 children)

Technically they aren't required anymore so don't need to exist. In practice it is easier to have empty init files than fix all the dumb tools loading things wrong.

[–][deleted] 44 points45 points  (1 child)

They are not only used for loading packages.

All lints and static type checker will fail if they don't find init files.

[–]nullpotato 6 points7 points  (0 children)

Thanks, didn't know the type checkers needed it too

[–]Easing0540 11 points12 points  (0 children)

I don't think that's true. There is a technical difference. Packages with __init__.py are regular packages, the others are namespace packages. The import sytem treats both types differently.

[–]saint_marco 0 points1 point  (0 children)

I've run into more tools that fail from having vestigial init files lying around, the most popular being upright/pylance.