This PR adds support for dictionaries and indexing operations to ThinkPy, enhancing its ability to teach data structure concepts and bringing it closer to Python's feature set.
Changes Made
Added dictionary literal syntax and AST nodes
Implemented indexing for lists and dictionaries
Added support for nested data structures
Enhanced error handling for invalid operations
Removed legacy tuple-based AST approach
Updated documentation
Example Usage
objective "Demonstrate new features"
task "Dictionary Operations" {
step "Create and access dictionary" {
user = {
"name": "Alice",
"scores": [85, 92, 78]
}
print(user["name"]) # Access dict value
print(user["scores"][0]) # Nested access
}
}
Testing Done
Integration tests for nested structures
Error handling tests for invalid operations
Manual testing with complex data structures
Need these Documentation Updates
Add dictionary and indexing sections to language reference
Update quick start guide with new examples
Add error handling documentation
Breaking Changes
None. All existing ThinkPy code will continue to work as before.
Description
This PR adds support for dictionaries and indexing operations to ThinkPy, enhancing its ability to teach data structure concepts and bringing it closer to Python's feature set.
Changes Made
Example Usage
Testing Done
Need these Documentation Updates
Breaking Changes
None. All existing ThinkPy code will continue to work as before.
Related Issues
Closes #29
Checklist