New python user (2.7.5).
Trying to implement a simple exception. Exception-derived classes are taking string input arguments and splitting them into individual characters.
I've looked around for about 90 minutes in the tutorial and on stackoverflow and haven't found an answer.
# Meaningless base class.
class base:
def __init__(self):
self.base = 1
# Somewhat useful test of string storage.
class test(base):
def __init__(self, arg):
self.args = arg
This yields:
>>> a = test('test')
>>> a.args
'test'
But when I try:
# No qualitative difference between this and the above definition,
# except for 'Exception'.
class test(Exception):
def __init__(self, arg):
self.args = arg
I get:
>>> a = test('test')
>>> a.args
('t', 'e', 's', 't')
The only change is in class inheritance.
I would like to have my strings in one piece in my exception class so I can actually print and read them. What is happening?