Skip to content

Conversation

@cclauss
Copy link
Contributor

@cclauss cclauss commented Jan 11, 2018

unicode() was removed from Python 3 because all strs are unicode.

Executing these lines in Python 3 would raise a NameError.

__unicode()__ was removed from Python 3 because all strs are unicode.

Executing these lines in Python 3 would raise a NameError.

* https://pythonhosted.org/six/#six.u
@dbieber
Copy link
Collaborator

dbieber commented Jan 11, 2018

lgtm!, thanks

@dbieber dbieber merged commit 9bff9d0 into google:master Jan 11, 2018
@cclauss cclauss deleted the patch-1 branch January 11, 2018 00:22
@djizm
Copy link

djizm commented Jan 12, 2018 via email

@dbieber
Copy link
Collaborator

dbieber commented Jun 21, 2018

Turns out six.u does not behave the same as unicode in Python 2. six.u expects a string literal as input, whereas unicode can accept other types like bool and converts them to unicode.
So when value is a bool, six.u errors.

@cclauss
Copy link
Contributor Author

cclauss commented Jun 21, 2018

six.text_type() seems like a better substitute.

@dbieber
Copy link
Collaborator

dbieber commented Jun 21, 2018

Yeah, that looks right. Thanks.

cclauss pushed a commit to cclauss/python-fire that referenced this pull request Jun 22, 2018
dbieber pushed a commit that referenced this pull request Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants