Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Selon STINNER Victor <[EMAIL PROTECTED]>: > IMHO, the best solution is to create such class: > > class Filename: > def __init__(self, orig): > self.as_bytes = orig > self.as_str = myformat(orig) > def __str__(self): > return self.as_str > def __bytes__(self): > return self.as_bytes
I agree that logically it's the right solution. It's also the most invasive. If that class is made a subclass of str, however, existing code shouldn't break more than it currently does. _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3187> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com