Ron Adam wrote: > What about mismatched specifiers? It's not clear exactly what you mean by a "mismatched" specifier.
Some types may recognise when they're being passed a format spec that belongs to another type, and try to convert themselves to that type (e.g. applying 'f' to an int or 'd' to a float). If the type doesn't recognise the format at all, and doesn't have a fallback type to delegate to (as will probably be the case with str) then you will get an exception. > I think the opinion so far is to let the objects __format__ method > determine this, but we need to figure this out what the built in types > will do. My suggestions would be: int - understands all the 'integer' formats (d, x, o, etc.) - recognises the 'float' formats ('f', 'e', etc.) and delegates to float - delegates anything it doesn't recognise to str float - understands all the 'float' formats - recognises the 'integer' formats and delegates to int - delegates anything it doesn't recognise to str str - recognises the 'string' formats (only one?) - raises an exception for anything it doesn't understand I've forgotten where 'r' was supposed to fit into this scheme. Can anyone remind me? -- Greg _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com