Skip to content
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

dynamic key names possible in root? #1

Closed
lithiumlab opened this issue Nov 22, 2016 · 3 comments
Closed

dynamic key names possible in root? #1

lithiumlab opened this issue Nov 22, 2016 · 3 comments
Assignees
Labels

Comments

@lithiumlab
Copy link

lithiumlab commented Nov 22, 2016

Is is possible to use dynamic keys?

		val = '12345'
		root.['test_'+val] = 'HELLO WORLD'
		print root.test_12345

@seperman
Copy link
Owner

@lithiumlab This is a bug. It should accept root['test_'+val] = 'HELLO WORLD' (without the dot).
I will look into it asap.

@seperman seperman added the bug label Dec 26, 2016
@seperman seperman self-assigned this Dec 26, 2016
@seperman
Copy link
Owner

The root of this issue is in DotObject which I just fixed there.
seperman/dotobject#2

@seperman
Copy link
Owner

I just published 0.2.7 and this issue is fixed.

Now you can: root['test_'+val] = 'HELLO WORLD'

and even if you do

root['blah'] = 'foo'
root['blah.ding'] = 'foo too'

later you can access it as

root.blah
root.blah.ding

seperman pushed a commit that referenced this issue Nov 6, 2022
Merging sperman's branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants