pyheck
pyheck copied to clipboard
why is unicode segmentation used?
Just curious. Basically, in the context of this line:
https://github.com/kevinheavey/pyheck/blob/28fa3d995c73e4931421a361748a588ec1774ebf/Cargo.toml#L17
I'm not too sure about what the unicode
feature is myself, reading up on it in the heck
docs now.
Currently i have some test code in rust at least:
assert_eq!("a.b.c".to_snake_case(), "a_b_c");
assert_eq!("a'b'c".to_snake_case(), "a_b_c");
assert_eq!("2this##@$@#$.23432isaTest.Thanks.To.BOB.Myf\"r'e\"'e''nd.".to_snake_case(),
"2this_23432isa_test_thanks_to_bob_myf_r_e_e_nd")
this appears to work without the unicode
feature, i.e. with heck = "0.4.0"
, but when I add the unicode feature then the assert stmts seem to fail. I might be wrong, but for valid snake case it might be worth removing the .
and the ,
in the results. Basically, in my use case I want to turn a bunch of words into valid identifier names in python -- so for ex. a_b_c = 2
would work out in my use case, but with special chars it would fail. Is it possible to just have a _
in the returned string?
Side note: also 2this
is not a valid identifier in python, but I understand that's not a goal of this library for obvious reasons of course.
Hey didn't see this until now!
I'll ask around if there are good ways to publish multiple versions of the library with different features activated in the underlying Rust library
Awesome, no worries and thanks. Also, just wanted to add I appreciate the great work you are putting into this and with integrating with some cool Rust libraries.