Fokko commented on code in PR #5287:
URL: https://github.com/apache/iceberg/pull/5287#discussion_r922890388


##########
python/pyiceberg/catalog/base.py:
##########
@@ -57,7 +59,8 @@ def create_table(
         identifier: str | Identifier,
         schema: Schema,
         location: str | None = None,
-        partition_spec: PartitionSpec | None = None,
+        partition_spec: PartitionSpec = UNPARTITIONED_PARTITION_SPEC,
+        sort_order: SortOrder = UNSORTED_SORT_ORDER,
         properties: Properties | None = None,

Review Comment:
   I would like that, but that's actually a code smell in Python (or a quirk in 
the language). The default `{}` will be a reference to a single object, if you 
mutate that one, the next time the default value is being assigned, it will 
give the reference to the same object. More info here: 
https://florimond.dev/en/posts/2018/08/python-mutable-defaults-are-the-source-of-all-evil/
 So the recommended way is just to set it to null, and then do `properties or 
{}` in the code. This `{}` will then always initialize an empty dict.



-- 
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