Faur
Faur

Reputation: 5968

Python 2+3 compatible code: Should I avoid six?

This guide, Writing code that runs under both Python2 and 3, states that

Use the third party six module sparingly (i.e. only if necessary). One good use case is the reraise() method.

Why is this? I thought the whole point of six was to make Python 2+3 compatible code easier.

Upvotes: 3

Views: 194

Answers (1)

Darkstarone
Darkstarone

Reputation: 4730

I think the point is to try and avoid 2/3 specific constructs where possible, and only employ things like six when you have no other native option - as it adds complexity and additional fault points to the code. Since six is faking some stuff to bridge the gap, you may find it doesn't always work exactly as intended.

Upvotes: 4

Related Questions