regebro / supporting-python-3

Supporting Python 3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: about commercial use of code sample.

igreenfield opened this issue · comments

Hi,
Can I copy one sample code from the book and use it in a commercial product?

Probably, what bit of code?

this:
http://python3porting.com/problems.html#nicer-solutions:

import sys
if sys.version_info < (3,):
    def b(x):
        return x
else:
    import codecs
    def b(x):
        return codecs.latin_1_encode(x)[0]