Skip to content

Remove pathtools.create_directory() again #43

@ehrenfeu

Description

@ehrenfeu

The function doesn't add any value compared to a simple os.makedirs() call, as nothing is done except checking for existence of the target directory (no logging, no else-clause, ...). The situation when the target exists is gracefully handled by os.makedirs() already.

So actually this only adds complexity to the library and makes the code harder to read for people not familiar with it (requiring them to look up the API docs or similar).

def create_directory(new_path):
"""create a new directory if it does not already exist
Parameters
----------
new_path : str
Path to the new directory
"""
if not os.path.exists(new_path):
os.makedirs(new_path)

Metadata

Metadata

Labels

questionFurther information is requested

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions