-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-translate keys invalid for property access? #2
Comments
Can you give an example? I don't think I follow. |
@dsc bunched["3"] = "foo";
bunched.3 # is not valid syntax.
bunched["foo'quotes'bar"] = "hua"
bunched.foo'quotes'bar # does not work either.
bunched["lol2345"] = "rickrolled."
bunched.lol2345 # works. Maybe replace all wrong characters with Regex for the former could be (generating only one import re
unallowed_in_variable_name = re.compile('[\W]+')
var_name = unallowed_in_variable_name.sub('_', name)
# {'foo-2.4;"':'foo'} becomes bunched.foo_2_4_ |
I think it's most pythonesque to |
It is not documented what happens if Bunch() is expanded using dictionary notation with an element, which key is invalid for property access?
The text was updated successfully, but these errors were encountered: