[Python-Dev] transitioning from % to {} formatting (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Thu Oct 1 23:15:14 CEST 2009
- Previous message: [Python-Dev] transitioning from % to {} formatting
- Next message: [Python-Dev] transitioning from % to {} formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Glenn Linderman wrote:
1) Both the format message and all the parameters are supplied in a single API call. This is really a foolish API, because
def API( fmt, p1, p2, p3 ): str = fmt % (p1, p2, p3) could have just as easily been documented originally as def API( str ): where the user is welcome to supply a string such as API( fmt % (p1, p2, p3 )) and if done this way, the conversion to .format is obvious... and all under the users control.
The lazy APIs actually make a lot of sense, particularly when there is a chance that the function being called may be able to avoid the formatting call altogether.
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message: [Python-Dev] transitioning from % to {} formatting
- Next message: [Python-Dev] transitioning from % to {} formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]