Closed
Description
It would be nice if b"foo"
could be used instead of str::as_bytes_slice("foo")
, and especially ~b"bar"
instead of vec::from_slice(str::as_bytes_slice("bar"))
. Python uses this convention and only allows ASCII inside the byte string literals (along with byte escape codes). I don't really think it's necessary to forbid Unicode though - Python does that to make a very clear distinction between bytes and strings.
There could also be a byte version of a char
literal, allowing any ASCII character (b'\n'
) - a 55u8
literal removes the need for escape codes there.