Experience the convenience of advanced dot notation access with Box, transforming your Python dictionaries into easily navigable objects. With customizable options and enhanced performance through Cython optimizations, Box simplifies data handling while ensuring safety and speed. Perfect for developers looking to streamline their coding workflow.
Box is a powerful Python library that enhances dictionary usage with advanced dot notation access, making it easier and more intuitive to work with data structures. By allowing users to access dictionary keys as attributes, Box not only simplifies code but also improves readability.
Key Features:
- Dot Notation Access: Easily retrieve values using dot notation, e.g.,
movie_box.Robin_Hood_Men_in_Tights.imdb_stars
returns6.7
. - Automatic Key Conversion: Box intelligently converts any sub-dictionaries or lists inserted into it, enabling seamless access to nested data.
- Extensive Customization: Tailor your Box experience with a variety of Box types and converters that match your specific needs.
- Helper Functions: Convert your Box object back to standard Python dictionaries or serialize them into formats like JSON, YAML, TOML, or msgpack.
Quick Start Example:
from box import Box
movie_box = Box({ "Robin Hood: Men in Tights": { "imdb stars": 6.7, "length": 104 } })
result = movie_box.Robin_Hood_Men_in_Tights.imdb_stars
# Output: 6.7
Performance Optimizations:
Box has implemented Cython optimizations, enhancing speed by up to 10x when loading large datasets, making it an efficient choice for developers.
Comprehensive Documentation:
Explore the extensive Box GitHub wiki for detailed guidance, including installation instructions, examples, and types of boxes available.
Community Contributions:
Join a vibrant community of contributors who continuously enhance Box. Special thanks to the Python Software Foundation for their support and to PythonBytes for featuring Box on their podcast.
Box transforms how you interact with dictionaries by bringing simplicity and power to your code. Discover the advantages of using Box in your Python projects today!