Incremental Progress Report object/closure?

2006-09-01 Thread Terrence Brannon
'lo all, I'm looking for something that gives feedback to the screen every X iterations, reporting Time elapsed: 0:00:00 X,XXX,XXX records done. speed /second. [Action Label] Such a thingy is useful when one is cranking away at million record flat files and one wants to provide feedback t

push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Terrence Brannon
Hello, The most common way of dynamically producing HTML is via template engines like genshi, cheetah, makotemplates, etc. These engines are 'inline' --- they intersperse programming constructs with the HTML document itself. An opposite approach to this form of dynamic HTML production is called

Re: push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Terrence Brannon
Tino Wildenhain wrote: An opposite approach to this form of dynamic HTML production is called push-style templating, as coined by Terence Parr: Hm. "$attr.title$ $if(attr.active)$ $attr.submenu:menuItem()$ $endif$" This looks ugly to me. It looks ugly to me too. Why not just using wel

Re: push-style templating - an xml-like way to process xhtml

2008-11-02 Thread Terrence Brannon
Tino Wildenhain wrote: Terrence Brannon wrote: Tino Wildenhain wrote: An opposite approach to this form of dynamic HTML production is called push-style templating, as coined by Terence Parr: Hm. "$attr.title$ $if(attr.active)$ $attr.submenu:menuItem()$ $endif$" This loo

Re: is this a good way to do imports ?

2008-11-05 Thread Terrence Brannon
On Nov 5, 2:14 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > Now I want to be able to use functions of file2 in file1, > and vice-versa. It sounds like __all__ in __init__.py would work: http://www.python.org/doc/2.5.2/tut/node8.html#SECTION00840 If not, then pkgutil might of use

Re: push-style templating - an xml-like way to process xhtml

2008-11-05 Thread Terrence Brannon
On Nov 5, 6:03 am, lkcl <[EMAIL PROTECTED]> wrote: > > * pyjamas (http://pyjs.org) - this is treating the web page and the wow. I had never heard of it, but it is _damned_ impressive. THANK YOU. I'm joining the club for my next webdev project! rock on. -- http://mail.python.org/mailman/listinfo/

Re: push-style templating - an xml-like way to process xhtml

2008-11-07 Thread Terrence Brannon
On Nov 2, 6:19 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Learning the handful of constructs is the same as learning a handful of > API calls. The same goes for idiosyncrasies of e.g. inserting > sub-templates or dealing with repeating content. I'm not sure I agree with you. 1 - the c

2d graphics - drawing a vescica piscis in Python

2008-06-17 Thread Terrence Brannon
Hello, I have written a program to draw a vescica piscis from turtle import * def main(): setup(width=400, height=400) r = 50 color("black") circle(r) color("white") forward(r) color("black") circle(r) x = raw_input('please enter a string:') if __name__ == '

Re: 2d graphics - drawing a vescica piscis in Python

2008-06-18 Thread Terrence Brannon
On Jun 17, 3:45 pm, Terrence Brannon <[EMAIL PROTECTED]> wrote: > Hello, I have written a program to draw a vescica piscis en.wikipedia.org/wiki/Vesica_piscis> actually, I mis-spelled the term. It should be vesica piscis or vesica pisces. I put a "c" after the "s&

re.compile versus r''

2008-08-28 Thread Terrence Brannon
Hello, I'm using a tool (PLY) which apparently expects the tokens to be created using r'' But because one token is a rather complex regular expression, I want to create the regular expression programmatically. How can I generate a string and then create something of the same type that the r'' fun

Re: re.compile versus r''

2008-08-28 Thread Terrence Brannon
Oh my god, how embarrassing. the r'' notation is to create raw string I thought it was some form of blessing a string into a regular expression class. -- http://mail.python.org/mailman/listinfo/python-list

how best to use a dictionary in this function?

2008-10-02 Thread Terrence Brannon
Ok, here is some code: def calc_profit(std_clicks, vip_clicks, ad_rate=200, upline_status=None): payout = {} payout_std = std_clicks * rates['std'].per_click payout_vip = vip_clicks * rates['vip'].per_click ... now note that std_clicks and vip_clicks are passed to the function. Now,

code critique requested - just 60 lines

2008-10-02 Thread Terrence Brannon
Hi, I would like some feedback on how you would improve the following program: http://www.bitbucket.org/metaperl/ptc_math/src/21979c65074f/payout.py Basically, using non-strict dictionary keys can lead to bugs, so that worried me. Also, I'm not sure that my code is as crisp and concise as it could

Re: code critique requested - just 60 lines

2008-10-03 Thread Terrence Brannon
On Oct 2, 11:56 am, [EMAIL PROTECTED] wrote: > Terrence Brannon, I suggest you to shorten a lot some of those very > long lines. yes, I wanted to, but was not sure how to continue a line on the next line in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: code critique requested - just 60 lines

2008-10-03 Thread Terrence Brannon
On Oct 2, 11:09 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 02 Oct 2008 07:51:30 -0700, Terrence Brannon wrote: > > > Basically, using non-strict dictionary keys can lead to bugs, so that > > worried me. > > What's a "no