| 1128 | |
| 1129 | # class with __format__ that forwards to string, for some format_spec's |
| 1130 | class G: |
| 1131 | def __init__(self, x): |
| 1132 | self.x = x |
| 1133 | def __str__(self): |
| 1134 | return "string is " + self.x |
| 1135 | def __format__(self, format_spec): |
| 1136 | if format_spec == 'd': |
| 1137 | return 'G(' + self.x + ')' |
| 1138 | return object.__format__(self, format_spec) |
| 1139 | |
| 1140 | class I(datetime.date): |
| 1141 | def __format__(self, format_spec): |