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:
Todd Gamblin 2017-04-26 11:06:34 -07:00 committed by GitHub
parent c616e4a619
commit b3ba9bdb37

View File

@ -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