Thursday, December 20, 2018

Representative Line: Explicitly True

Part of Python’s appeal is its rich class library. The old XKCD about import antigravity sometimes doesn’t feel that far off. Combined with a few third-party libraries, like NumPy, you can do a lot with very little code.

Of course, that feels a bit like magic. As Python gurus like to say, “Explicit is better than implicit”. One of Mark’s co-workers took this perhaps a bit too far, when they started adding this import to every file:

from __builtin__ import True

As you might imagine from a name like __builtin__, everything in that namespace, including True, is imported by default. Mark found this “among other useless stuff”.

[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!


To read the full article, please visit The Daily WTF

No comments:

Post a Comment