Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1388#discussion_r17025427
  
    --- Diff: python/pyspark/mllib/regression.py ---
    @@ -66,6 +66,9 @@ def weights(self):
         def intercept(self):
             return self._intercept
     
    +    def __str__(self):
    --- End diff --
    
    it's better to use __repr__() here, so you can better string representation 
when it's inside REPR or in another object(such as tuple). Also, The default 
__str__() will call __repr__()
    
    ```
    >>> class C(object):
    ...    def __str__(self):
    ...        return 'str'
    ...    def __repr__(self):
    ...        return 'repr'
    ...
    >>> print c
    str
    >>> c = C()
    >>> c
    repr
    >>> (c, c)
    (repr, repr)
    >>> print tuple((c, c))
    (repr, repr)
    ```


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to