danielcweeks commented on code in PR #4767:
URL: https://github.com/apache/iceberg/pull/4767#discussion_r872864103


##########
python/src/iceberg/types.py:
##########
@@ -148,56 +159,28 @@ def __new__(
         cls._instances[key] = cls._instances.get(key) or object.__new__(cls)
         return cls._instances[key]
 
-    def __init__(
-        self,
-        field_id: int,
-        name: str,
-        field_type: IcebergType,
-        is_optional: bool = True,
-        doc: Optional[str] = None,
-    ):
-        if not self._initialized:
-            docString = "" if doc is None else f", doc={repr(doc)}"
-            super().__init__(
-                (
-                    f"{field_id}: {name}: {'optional' if is_optional else 
'required'} {field_type}" ""
-                    if doc is None
-                    else f" ({doc})"
-                ),
-                f"NestedField(field_id={field_id}, name={repr(name)}, 
field_type={repr(field_type)}, is_optional={is_optional}"
-                f"{docString})",
-            )
-            self._is_optional = is_optional
-            self._id = field_id
-            self._name = name
-            self._type = field_type
-            self._doc = doc
-
-    @property
-    def is_optional(self) -> bool:
-        return self._is_optional
-
     @property
     def is_required(self) -> bool:
-        return not self._is_optional
-
-    @property
-    def field_id(self) -> int:
-        return self._id
-
-    @property
-    def name(self) -> str:
-        return self._name
-
-    @property
-    def doc(self) -> Optional[str]:
-        return self._doc
-
+        return not self.is_optional
+
+    def __post_init__(self):

Review Comment:
   This may be beyond the scope of this PR (since the existing behavior is the 
same), but is there a way to lazily create the type string?  It's probably not 
very concerning from a performance standpoint in most cases, but it's also not 
typically used.  Just wondering if using data class makes that easier.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to