Add __format__ support to version for fancy formatting. (#3996)
- add Version.__format__ to support new-style formatting. - Python3 doesn't handle this well -- it delegates to object.__format__(), which raises an error for fancy format strings. - not sure why it doesn't call str(self).__format__ instead, but that's hwo things are.
This commit is contained in:
parent
c616e4a619
commit
b3ba9bdb37
@ -226,6 +226,9 @@ def __repr__(self):
|
||||
def __str__(self):
|
||||
return self.string
|
||||
|
||||
def __format__(self, format_spec):
|
||||
return self.string.format(format_spec)
|
||||
|
||||
@property
|
||||
def concrete(self):
|
||||
return self
|
||||
|
Loading…
Reference in New Issue
Block a user