Author sjt
Recipients barry, r.david.murray, serhiy.storchaka, sjt
Date 2013-09-03.07:37:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1378193873.32.0.512757291377.issue18891@psf.upfronthosting.co.za>
In-reply-to
Content
I'm thinking this may be overengineering, but I may as well post it and find out for sure. :-)  Is it worth encapsulating MIME types?  They're "really" pairs as far as mail handling applications are concerned, but they have a string representation.  So

MacPorts 16:29$ python3.3
Python 3.3.2 (default, May 21 2013, 11:48:51) 
>>> from collections import namedtuple
>>> class MIMEType(namedtuple('MIMETYPE', 'type subtype')):
...  def __str__(self):
...   return "{0}/{1}".format(self.type, self.subtype)
... 
>>> mt = MIMEType('text', 'plain')
>>> str(mt)
'text/plain'
>>> t, s = mt
>>> print('type =', t, 'subtype =', s)
type = text subtype = plain
>>> 

Obviously there needs to be a constructor that handles the 'type/sub' represention.
History
Date User Action Args
2013-09-03 07:37:53sjtsetrecipients: + sjt, barry, r.david.murray, serhiy.storchaka
2013-09-03 07:37:53sjtsetmessageid: <1378193873.32.0.512757291377.issue18891@psf.upfronthosting.co.za>
2013-09-03 07:37:53sjtlinkissue18891 messages
2013-09-03 07:37:52sjtcreate