This repository was archived by the owner on Dec 2, 2021. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork2.2k
This repository was archived by the owner on Dec 2, 2021. It is now read-only.
FrozenJSON #20
Open
Description
example 19-5 FrozenJSON
def __init__(self, mapping): self.__data = dict(mapping) ➊ def __getattr__(self, name): ➋ if hasattr(self.__data, name): return getattr(self.__data, name) ➌ else: return FrozenJSON.build(self.__data[name]) ➍
self.__data is a dict ,function hasattr(object, name) the first parameter is object,so hasattr(self.__data, name) always return False,so step ➌ never return . am i right?
Metadata
Metadata
Assignees
Labels
No labels