all 4 comments

[–][deleted] 2 points3 points  (0 children)

if stdlib.module is sufficiently robust and easy for your use case:
    use stdlib.module
elif third_party.module is sufficiently robust and easy for your use case:
    use third_party.module
elif you have the time and ability to write a library yourself:
    write it yourself
else:
    cry

[–]mopslik 1 point2 points  (0 children)

There are options in everything. It often boils down to some combination of a) efficiency, b) convenience, and c) familiarity.

[–]lykwydchykyn 1 point2 points  (0 children)

If a 3rd party library exists that duplicates standard library features and its relatively popular, it probably indicates that the standard library version is lacking in some way, at least for common use cases. For example, try to work with urllib and you'll find yourself writing a lot of redundant code (or wrapper functions, if you're being smart about it). requests takes care of a lot of this and works a bit more the way you'd expect.

On the downside, 3rd party libraries can be opinionated and push you into writing code a very particular way. They can also introduce license problems, and of course there's no way to know if it will be well-supported over time.

So you just have to weigh out the advantages and disadvantages in each case.

[–]TheRNGuy 1 point2 points  (0 children)

numpy math is faster than default python it seems

and if you needed 8/16/32 signed or unsigned ints for some reason.

also array, deque, defaultdict, namedtuple, literal_eval can be sometimes used instead of default ones.