Eric V. Smith wrote: > Doesn't this violate Guido's "don't have a parameter that is always a > constant that changes how a function operates" principle (or whatever > its formal name is)?
It's not inconceivable that a function might want to accept formatting parameters and pass them on to another function which used format(). If there were separate functions for the different formats, this would be awkward. Guido's principle applies when the parameter in question alters the meaning so radically that it seems inconceivable to want to vary it from one call to another. I don't think that quite applies here, although that's obviously a matter of opinion. I wouldn't object to having separate functions available as an alternative for the cases where you don't need the flexibility, which would be most of the time. > Or maybe a format() member of int and float, which take > different parameters. That would make it awkward to take a number which might be an int or float and format it as a float -- you'd have to be careful to cast it to float first. I don't see it as a matter of formatting different types of object, but of having one type of object (a number) and formatting it in different ways. You could even consider 'd' to be a special case of 'f' with 0 decimal places (although it isn't quite). -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a morning person.) | [EMAIL PROTECTED] +--------------------------------------+ _______________________________________________ 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