473,385 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Deferred text formatting

bartonc
6,596 Expert 4TB
Did you know that it's perfectly legal to defer text formatting until you have the value(s) available? Watch this:
Expand|Select|Wrap|Line Numbers
  1. s = "%d apples plus %d apples equals %d apples."
  2.  
  3. yours = 3
  4. mine = 4
  5.  
  6. print s %(yours, mine, (yours + mine))
I had labored under the assumption that the format character required something to fill it at the time of assignment.
Oct 22 '07 #1
1 1230
bartonc
6,596 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. s = "%d apples plus %d apples equals %d apples."
  2.  
  3. yours = 3
  4. mine = 4
  5.  
  6. print s %(yours, mine, (yours + mine))
Of course, if this is done to far away (in lines of code) from the assignment, it's a bit tricky distinguishing this from a modulo (%) operation.
Oct 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: SK | last post by:
Is there a way to store HTML into a MySQL TEXT column, yet be able to search over textual content only? For example, if I store the following HTML snippet: <p>A very <em>small</em>...
1
by: Anthony Martin | last post by:
I've been reading the Java Language Specification, and in Chapter 16 there's an interesting topic called Definite Assignment. http://tinyurl.com/3fqk8 I'm wondering about the idea of "Deferred...
3
by: Bryan | last post by:
i was intrigued with a recently posted cookbook recipe which implements deferred results with decorators: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355651 the problem i see with...
8
by: Frank van Vugt | last post by:
Hi, If during a transaction a number of deferred triggers are fired, what will be their execution order upon the commit? Will they be executed in order of firing or alfabetically or...
7
by: news | last post by:
Recently our mail from our e-commerce site has been rejected by AOL due to an IP block because someone was using our PHP scripts to send spam. Well, I got that fixed. But our legitimate...
3
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to...
0
by: Jean-Paul Calderone | last post by:
On Mon, 5 May 2008 19:10:39 +0200, Terry Jones <terry@jon.eswrote: You can do this (if you replace `pass´ with `None´, anyway) or you can pass `consumeErrors=True´ to the `DeferredList´...
4
by: raylopez99 | last post by:
I'm reading a book that talks about how some operations, like LINQ queries, are "deferred execution" while other queries are "immediate execution". What is the difference? RL
0
by: dlouche | last post by:
I have a method that contains the linq query: var query = from c in db.Categories join pc in db.ProductsToCategories on c.ID equals pc.CategoryID where...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.