Skip to content

Conversation

rmliddle
Copy link
Contributor

@rmliddle rmliddle commented Jan 2, 2019

Tiny change to make things most consistent with python:

Previous Behaviour:

>>>>> b = b'abc'
>>>>> b
b'\x61\x62\x63'

Python 3:

>>> b = b'abc'
>>> b
b'abc'

let data: Vec<String> = data.iter().map(|b| format!("\\x{:02x}", b)).collect();
let data = data.join("");
let value = get_value(obj);
let data = String::from_utf8(value.to_vec()).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that it probably depends upon the exact ascii character whether or not it is printed as hex character.

@windelbouwman windelbouwman merged commit a28b665 into RustPython:master Jan 2, 2019
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.

2 participants