question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Treat None values as unexisting keys for default_box

See original GitHub issue

Hi,

thanks a lot for your project, it’s currently helping me a lot 😃 one feature i missed is the ability to treat None values as if there was no key defined.

like in this example.

b=Box({'brol': None}, default_box=True)
b.brol.truc

gives

Traceback (most recent call last): File “<stdin>”, line 1, in <module> AttributeError: ‘NoneType’ object has no attribute ‘truc’

but this works as exepected

b=Box({}, default_box=True)
b.brol.truc

many many thanks 👍

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cdgriffithcommented, Dec 25, 2019

Added in 4.0

1reaction
haruntuncaycommented, Oct 15, 2019

Hello @cdgriffith, if you are open to contributions, can I submit a PR for this issue ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proper way to remove keys in dictionary with None values in ...
Iterating over dict is always unsafe if you are going to be mutating the dictionary in the process. Iterating over dict.keys() and dict.items() ......
Read more >
Setting keys to None · Issue #190 · redis/redis-py - GitHub
Redis treats everything as a string. It has no concept of Null values. Even when fetching a key that doesn't exist, a sane...
Read more >
Python | Check for None values in given dictionary
In this, we check for all the values using all function extracted using values function. The not operator is used to inverse the...
Read more >
Java Map Introduction
A map stores key/value pairs, where each key has an associated value. Given a particular key, ... If the key is not present...
Read more >
Null in Python: Understanding Python's NoneType Object
Python uses the keyword None to define null objects and variables. ... Here, None is the default value for the key parameter as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found