Skip to content

[ 2374927 ] Interface description of 'jsonLoads' #385

@HolQue

Description

@HolQue

The interface description of 'jsonLoads' defines the optional parameter 'referenceDir':

def jsonLoads(self, sJsonpContent : str, referenceDir : str = ''):
* ``referenceDir``
  / *Condition*: optional / *Type*: str /

But the default value that is required for optional parameters, is missing in docstring.

Is there a certain reason to use an empty string as default value? Usually None is used to indicate that an optional parameter is not used and should not have any effect.

Intuitively, within a test I used the usual None. But calling the method with referenceDir=None causes:

stat: path should be string, bytes, os.PathLike or integer, not NoneType

I would prefer:

def jsonLoads(self, sJsonpContent : str, referenceDir : str = None):
* ``referenceDir``
  / *Condition*: optional / *Type*: str / *Default*: None /

Metadata

Metadata

Assignees

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions