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

    https://github.com/apache/spark/pull/363#discussion_r11560776
  
    --- Diff: python/pyspark/rdd.py ---
    @@ -1387,6 +1387,95 @@ def _jrdd(self):
         def _is_pipelinable(self):
             return not (self.is_cached or self.is_checkpointed)
     
    +class Row(dict):
    +    """
    +    An extended L{dict} that takes a L{dict} in its constructor, and 
exposes those items as fields.
    +
    +    >>> r = Row({"hello" : "world", "foo" : "bar"})
    +    >>> r.hello
    +    'world'
    +    >>> r.foo
    +    'bar'
    +    """
    +
    +    def __init__(self, d):
    +        d.update(self.__dict__)
    +        self.__dict__ = d
    +        dict.__init__(self, d)
    --- End diff --
    
    In Python the first constructor (__init__) that's invoked is the that of 
the subclass, and it needs to explicitly call the parent constructor if it 
wants to use it. So in this case, I need to explicitly call on the dict type's 
__init__ to run through that constructor


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

Reply via email to