question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allowed characters in keys

See original GitHub issue

Would you please explain the rationale behind allowing only string.ascii_letters + string.digits + "_" in keys? I would like to use greek letters and end up with silent errors like:

>>> a = Box()
>>> a.σeq = 1
>>> a.µeq = 2
>>> a
<Box: {'σeq': 2}>

Is there anything wrong with adding more utf-8 characters to allowed?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cdgriffithcommented, Mar 15, 2022

Box 6 has been released with this added, thanks for opening the issue!

1reaction
cdgriffithcommented, Jan 12, 2022

While testing this found out something “fun”.

>>> a = Box()
>>> a.σeq = 1
>>> a.µeq = 2
>>> a
Box({'σeq': 1, 'μeq': 2})
>>> a == Box({'σeq': 1, 'µeq': 2})
False

Python uses NFKC normalization on variables and attributes behind the scenes. AKA

µ = 1
>>> print(dir()[-1])
μ
>>> ord(dir()[-1])
956
>>> ord('µ')
181

So that’s something to be very wary of, implementation discussed https://www.python.org/dev/peps/pep-3131/#implementation

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the valid characters/values allowed as "keys" in ...
Properties are identified using key values. A property key value is either an ECMAScript String value or a Symbol value. All String and...
Read more >
Special Characters — Alt Keyboard Sequences - Oratory
Press the Alt key, and hold it down. While the Alt key is pressed, type the sequence of numbers (on the numeric keypad)...
Read more >
Alt Codes – How to Type Special Characters and Keyboard ...
In Windows, you can type any character you want by holding down the ALT key, typing a sequence of numbers, then releasing the...
Read more >
Creating object key names - Amazon Simple Storage Service
Safe characters ; Alphanumeric characters. 0-9. a-z. A-Z ; Special characters. Exclamation point ( ! ) Hyphen ( - ). Underscore ( _...
Read more >
Valid Characters in Key path - Google Groups
Hello All, I've tried to find out what characters are not valid in the secret/key path. I've not been able to find any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found