Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

None typage for unset config object lead to unexpected behavior #423

Closed
dmp42 opened this issue Jun 13, 2014 · 2 comments
Closed

None typage for unset config object lead to unexpected behavior #423

dmp42 opened this issue Jun 13, 2014 · 2 comments
Labels
Milestone

Comments

@dmp42
Copy link
Contributor

dmp42 commented Jun 13, 2014

cfg.get('whatever') will return None.

Parts of the code expect an unset value to default to False, and obviously False is not None.

@dmp42 dmp42 added this to the 0.8 milestone Jun 13, 2014
@dmp42 dmp42 added the bug label Jun 13, 2014
@wking
Copy link
Contributor

wking commented Jun 13, 2014

On Fri, Jun 13, 2014 at 10:15:54AM -0700, Mangled Deutz wrote:

Parts of the code expect an unset value to default to False, and
obviously False is not None.

In situations like this, I think it's usually best to use:

if myvar:

or:

if not myvar:

instead of the stricter:

if myvar == True:

or:

if myvar == False:

Obviously, that's if the “unset” None should be defaulting to False,
which is also usually the case for me.

@dmp42
Copy link
Contributor Author

dmp42 commented Aug 1, 2014

I believe this was fixed by #444 with a more logic config evaluation system.

@dmp42 dmp42 closed this as completed Aug 1, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants