Message71615
| Author |
pitrou |
| Recipients |
HWJ, amaury.forgeotdarc, benjamin.peterson, pitrou, vstinner |
| Date |
2008年08月21日.08:51:11 |
| SpamBayes Score |
0.00010355513 |
| Marked as misclassified |
No |
| Message-id |
<1219308697.48ad2c99d63b0@imp.free.fr> |
| In-reply-to |
<1219306842.92.0.394002937162.issue3187@psf.upfronthosting.co.za> |
| Content |
Selon STINNER Victor <report@bugs.python.org>:
> 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. |
|