On 06/15/2013 06:23 AM, Dotan Cohen wrote:
On Fri, Jun 14, 2013 at 7:01 PM, Jim Mooney <cybervigila...@gmail.com> wrote:
On 14 June 2013 08:23, Dotan Cohen <dotanco...@gmail.com> wrote:

What are these two string-formatting styles called?
'%.3f' % x
'{0:.3f}'.format(x)


The first one is a string Expression, using % as the overloaded operator
The second one is a string method, with .format() as the method for a string
object


Thank you. So would it be clear if I were to say "I prefer
printf-style formatting over the format method."?


I'd be careful there, since method is an English word as well as a Python one. So I'd make it clear i was referrring to a method of a class, by naming the class.

Something like:

the format() method of the str class.



--
DaveA
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to