weixin_39942191 2020-11-20 20:36
浏览 0

Add encoding utility

Originally reported by: Claude Paroz (Bitbucket: claudep, GitHub: claudep)

Hi,

We're planning to embed six in Django as the blessed Python 3 compatibility layer. One thing we're missing is a function that returns a byte string on Python 2 and Unicode in Python 3. This is typically useful when providing arguments for strftime() or type(). Our current implementation is: * Python 2: n = lambda n: n.encode('utf-8') * Python 3 (noop): n = lambda n: n

We could of course provide it in some of our own modules, but it would be nice to have it in six, unless you suggest a better replacement.

  • Bitbucket: https://bitbucket.org/gutworth/six/issue/12

该提问来源于开源项目:benjaminp/six

  • 写回答

9条回答 默认 最新

  • weixin_39942191 2020-11-20 20:36
    关注

    Original comment by Aymeric Augustin (Bitbucket: aaugustin, GitHub: aaugustin):

    This issue was opened on behalf of the Django core team.

    The discussion above didn't mention any other use case.

    Since Django finally isn't going to need this addition, I'm closing this ticket.

    评论

报告相同问题?