#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
  Author:  HaiFeng --<galaxy>
  Purpose: 
  Created: 2016/8/2
"""


class switch(object):
	def __init__(self, value):
		self.value = value
		self.fall = False
	def __iter__(self):
		"""Return the match method once, then stop"""
		yield self.match
		raise StopIteration
	def match(self, *args):
		"""Indicate whether or not to enter a case suite"""
		if self.fall or not args:
			return True
		elif self.value in args: # changed for v1.5, see below
			self.fall = True
			return True
		else:
			return False
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
  Author:  HaiFeng --<galaxy>
  Purpose: 
  Created: 2016/8/2
"""


class switch(object):
	def __init__(self, value):
		self.value = value
		self.fall = False
	def __iter__(self):
		"""Return the match method once, then stop"""
		yield self.match
		raise StopIteration
	def match(self, *args):
		"""Indicate whether or not to enter a case suite"""
		if self.fall or not args:
			return True
		elif self.value in args: # changed for v1.5, see below
			self.fall = True
			return True
		else:
			return False
#!/usr/bin/env python # -*- coding: utf-8 -*- Author:  HaiFeng --<galaxy>   Purpose:    Created: 2016/8/2 Return the match method once, then stop Indicate whether or not to enter a case suite # changed for v1.5, see below