core.utils.classes

View Source
class GeneratorToIterator():
	"""
		Make an iterator of a generator-function
	"""

	def __init__(self, generator, **kwargs):
		"""
			Args:
				generator (generator function): The generator function to iterate along
				**kwargs: Arguments to pass to the generator function 
		"""
		self.generator = generator
		self.kwargs = kwargs
		
	def __iter__(self):
		return self.generator(**self.kwargs)
#   class GeneratorToIterator:
View Source
class GeneratorToIterator():
	"""
		Make an iterator of a generator-function
	"""

	def __init__(self, generator, **kwargs):
		"""
			Args:
				generator (generator function): The generator function to iterate along
				**kwargs: Arguments to pass to the generator function 
		"""
		self.generator = generator
		self.kwargs = kwargs
		
	def __iter__(self):
		return self.generator(**self.kwargs)

Make an iterator of a generator-function

#   GeneratorToIterator(generator, **kwargs)
View Source
	def __init__(self, generator, **kwargs):
		"""
			Args:
				generator (generator function): The generator function to iterate along
				**kwargs: Arguments to pass to the generator function 
		"""
		self.generator = generator
		self.kwargs = kwargs
Args
  • generator (generator function): The generator function to iterate along
  • **kwargs: Arguments to pass to the generator function