[Tutor] Print text position problems when using triple quotes

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Feb 24 20:34:34 CET 2005



> > > > I'm writing a simple game (run in command line) in which narrative
> > > > text is printed in response to a user's decisions. The problem I'm
> > > > running into is that triple quotes used in an indented block
> > > > preserves the indentation when it prints.

[text cut]

> > > Why not just take them out of the block, and either make them global
> > > to the module or create a string module?

[text cut]

> Excellent.

Side note: one other nice thing about Bill's solution is that it becomes
easier to just pass that 'string module' off to someone else for
maintenence.  Your game can be easily translated to other languages!
(GNU gettext, for example, is a system for internationalizing programs,
and it keeps a program's messages in language-specific message files.)
This approach is also the heart of things like "template" languages.



More information about the Tutor mailing list