Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/17160
  
    **without `__contains__`, `__nonzero__` and `__bool__`**
    
    ```python
    class Column(object): pass
    
    >>> 1 in Column()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: argument of type 'Column' is not iterable
    >>> bool(Column())
    True
    ```
    
    **without `__nonzero__` and `__bool__`**
    
    ```python
    class Column(object):
        def __contains__(self, item):
            print "I am contains"
            return Column()
    
    >>> 1 in Column()
    I am contains
    True
    >>> bool(Column())
    True
    ```
    
    
    **without `__contains__`**
    
    ```python
    class Column(object):
        def __nonzero__(self):
            print "I am nonzero"
            return Column()
    
    >>> 1 in Column()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: argument of type 'Column' is not iterable
    >>> bool(Column())
    I am nonzero
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: __nonzero__ should return bool or int, returned Column
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to