Skip to content

Instantly share code, notes, and snippets.

@HunterKohler
Created April 22, 2021 16:09
Show Gist options
  • Save HunterKohler/0dcb13899c96b3670ccaab930b6ba6d6 to your computer and use it in GitHub Desktop.
Save HunterKohler/0dcb13899c96b3670ccaab930b6ba6d6 to your computer and use it in GitHub Desktop.
from typing import Union, Any
class namespace:
def __init__(self, *args: Union[tuple[str, Any], dict[str, Any]], **kwargs):
for arg in args:
if type(arg) == dict:
self.__dict__.update(arg)
elif type(arg) == tuple and len(tuple) == 2:
self.__dict__.update(arg)
else:
raise TypeError("Invalid arg type: " + type(arg))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment