Message71615
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. |
|
Date |
User |
Action |
Args |
2008-08-21 08:51:12 | pitrou | set | recipients:
+ pitrou, amaury.forgeotdarc, vstinner, benjamin.peterson, HWJ |
2008-08-21 08:51:11 | pitrou | link | issue3187 messages |
2008-08-21 08:51:11 | pitrou | create | |
|