pabloem commented on a change in pull request #12074:
URL: https://github.com/apache/beam/pull/12074#discussion_r447317739



##########
File path: sdks/python/apache_beam/transforms/combiners.py
##########
@@ -62,26 +62,28 @@
 TimestampType = Union[int, float, Timestamp, Duration]
 
 
+class CombinerWithoutDefaults(ptransform.PTransform):
+  def __init__(self, has_defaults=True):
+    self.has_defaults = has_defaults
+
+  def with_defaults(self, has_defaults=True):
+    self.has_defaults = has_defaults
+    return self

Review comment:
       In the spirit of not modifying self, and instead creating a new 
instance, you can return the subclass:
   
   ```suggestion
     def with_defaults(self, has_defaults=True):
         new = copy.copy(self)
         new.has_defaults = has_defaults
         return new
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to