473,397 Members | 1,960 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,397 software developers and data experts.

Re: How to write verbose scripts


Steven D'Aprano <stev...bersource.com.auwrote:
>Is there a better way of doing this than the way I am going about it?
Not sure if its "better", but I would keep the messages in a table or dict and
have different tables or dicts for different levels of verbosity, and write a
displayer that knows about the verbosity - This approach has the advantage that
you can write in English and have different verbosities in different languages
too, if the displayer knows about the language.

Verbosity level and language can be display class attributes, and then you can
simply write something like:

display.display("squawk")

and get one of:

squawk
squawk, squawk, squawk
squawk - help the bastards are trying to nail me to my perch!

or the equivalent in Icelandic or Norwegian.

It works, but its a PITA to implement because you have to formally construct the
stuff, and keep them all in sync, across languages and levels of verbosity.

This of course will only work for static messages - If you compute what you
display, I guess you need to either keep the computation in the displayer, or
pass it in, or something - gets messy.

Keeps the code clear though, as it splits what you display away from the
decision of saying something.

I try to avoid it if I can.

- Hendrik

Sep 3 '08 #1
0 755

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: el_roachmeister | last post by:
I wonder do most php coders use ftp or ssh (terminal login) to write php scripts? I use ssh because my host offers it, but I notice most hosts that charge less than $10/month don't offer ssh. Are...
1
by: Phil Powell | last post by:
I have CF MX 6.1 with JRun running in the background. I want to be able to write JSP scripts as well as ColdFusion, however, I don't know how to do this (I can write JSP, but how to do it within...
9
by: Chad Smith | last post by:
Hello, I'm relatively new to the database world so please forgive me in advance for my ignorance. I have recently been tasked at my job with finding a tool that will perform the following tasks:...
0
by: bootleggersplayr | last post by:
anyone who can write some scripts for me for this online game would be an lifesaver pm me!
3
by: mast2as | last post by:
In the same vein as the topic that I started on exception handling ;-) .... If I have read (not all of them though) the documents that you guys pointed me to, the try/throw/catch mechanism should...
2
by: realxpdc | last post by:
someone can help me how to write autohide scripts in javascripts
2
by: raghunadhs | last post by:
Hi All, i have some simple scripts( which may have some insert statements, update statements etc). these scripts were written in Sql server 2000. now i want to use the same scripts in Access. (since...
11
by: Steven D'Aprano | last post by:
I find myself writing command line tools in Python where I wish to include "verbose" output to stdout. I start with a helper function: def print_(obj, level=0): if _verbosity >= level:...
0
by: =?ISO-8859-1?Q?BJ=F6rn_Lindqvist?= | last post by:
2008/9/3 Hendrik van Rooyen <mail@microcorp.co.za>: One big downside with that approach is that it becomes much harder to grep for the log message. Usually when I go through logs, I don't care...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.