If I am creating an exception class, along with a stack

class CustomError(Exception):
	def __init__(self):
		print "Stack Created"

How can I make it so that if


the stack contents will be


, not



Recommended Answers

All 2 Replies

I don't understand completely what you're trying to do so this might not be helpful at all, but I feel bad cuz no one's tried to give you an answer.

you would need to make another class to save the attribute 'contents'

class container(object):

class CustomError(Exception):
	def __init__(self):
                self.historical = container()
		print "Stack Created"

*untested code

As someone mentioned in another thread (Computer Science): It is important to get clarification when the spec is ambiguous. The OP (original poster) has not asked a specific question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.