diff options
author | Bruno ReniƩ <brutasse@gmail.com> | 2014-08-29 10:14:54 +0200 |
---|---|---|
committer | Bruno ReniƩ <brutasse@gmail.com> | 2014-08-29 10:14:54 +0200 |
commit | 57e2842f54d863e3890ca75d7271356e549a5c09 (patch) | |
tree | 229531d90bffa7d96926374fb55b2dbc70e96deb | |
parent | abd71214e08597da46818c6c66ff3f56176f9bba (diff) | |
download | kafka-python-57e2842f54d863e3890ca75d7271356e549a5c09.tar.gz |
Use built-in next()
-rw-r--r-- | kafka/partitioner.py | 2 | ||||
-rw-r--r-- | kafka/producer.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/kafka/partitioner.py b/kafka/partitioner.py index 5287cef..695dd6f 100644 --- a/kafka/partitioner.py +++ b/kafka/partitioner.py @@ -43,7 +43,7 @@ class RoundRobinPartitioner(Partitioner): if self.partitions != partitions: self._set_partitions(partitions) - return self.iterpart.next() + return next(self.iterpart) class HashedPartitioner(Partitioner): diff --git a/kafka/producer.py b/kafka/producer.py index e1f4a22..fb83da6 100644 --- a/kafka/producer.py +++ b/kafka/producer.py @@ -258,9 +258,9 @@ class SimpleProducer(Producer): if self.random_start: num_partitions = len(self.client.topic_partitions[topic]) for _ in xrange(random.randint(0, num_partitions-1)): - self.partition_cycles[topic].next() + next(self.partition_cycles[topic]) - return self.partition_cycles[topic].next() + return next(self.partition_cycles[topic]) def send_messages(self, topic, *msg): partition = self._next_partition(topic) |