jorisvandenbossche commented on code in PR #40818:
URL: https://github.com/apache/arrow/pull/40818#discussion_r1555441823


##########
python/pyarrow/types.pxi:
##########
@@ -3504,6 +3504,14 @@ def field(name, type, bint nullable=True, metadata=None):
     >>> pa.struct([field])
     StructType(struct<key: int32>)
     """
+    if hasattr(name, "__arrow_c_schema__"):
+        if not (type is None and metadata is None):
+            raise ValueError(

Review Comment:
   Yeah, it's true that TypeError might be a better fit given that the passed 
value is a different type than the expected one, but in general in other 
similar cases in pyarrow (eg the `table(..)` or `array(..)` constructors) when 
we have such parameters that can not be specified in certain circumstances, it 
seems we are currently always using ValueError for that.
   
   (in this case it's also raising just when it has _some value_ (that is not 
non-None), i.e. it's not checking for a specific type)



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

Reply via email to