GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Home

Home

Jump to bottom
Chris Griffith edited this page Apr 9, 2020 · 6 revisions

Box Logo

Box is designed to be an easy drop in transparently replacements for dictionaries that adds dot notation access and a load of other features!

my_box = Box(funny_movie='Hudson Hawk', best_movie='Kung Fu Panda')

my_box.funny_movie
# 'Hudson Hawk'

By default, aka when conversion_box is set to True, it will also tweak keys that have spaces or bad characters to be dot accessible.

my_box["good tv series"] = "I Dream of Jeannie"
my_box["amazing tv series"] = "Avatar: The Last Airbender"

my_box.good_tv_series
# 'I Dream of Jeannie'

It's also super easy to convert boxes to and from markup languages such as json and yaml (see all the converters here)

my_box.to_json(filename="films.json")

new_box = Box.from_json(filename="films.json")
new_box.keys()
# dict_keys(['funny_movie', 'weird_movie', 'best_movie', 
#             'good tv series', 'amazing tv series'])

Any sub dictionaries or ones set after initiation will be automatically converted to a Box object. You can always run .to_dict() on it to return the object and all sub objects back into a regular dictionary.

big_box = Box({"boxes": {"the": {"whole": {"way": {"down": "yup"}}}}})

big_box.boxes.the.whole.way.down
#  'yup'

Next - Check out the Quick Start

These documents are for Box 5.0+

  1. Home
  2. Installation
  3. Quick Start
    • Limitations
    • How Box Works
  4. Types of Boxes
    • Conversion Box
    • Default Box
    • Box Dots
    • Camel Killer Box
    • Frozen Box
  5. Converters
    • dict
    • json
    • yaml
    • msgpack
    • csv
  6. Operations
    • Merge Update
    • Addition and Union
    • Subtraction
  7. BoxLists
  8. Shorthand Boxes
  9. ConfigBox
  10. Subclassing Box
  11. Comments
  12. Major Version Breaking Changes
  13. History
  14. License

Major Version Breaking Changes and Features

Clone this wiki locally

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.