472,993 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 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 1221
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.