Easy "here documents" ??

2004-12-18 Thread Jim Hill
I've done some Googling around on this and it seems like creating a here document is a bit tricky with Python. Trivial via triple-quoted strings if there's no need for variable interpolation but requiring a long, long formatted arglist via (%s,%s,%s,ad infinitum) if there is. So my question is:

Re: Easy "here documents" ??

2004-12-19 Thread Jim Hill
Nick Craig-Wood wrote: >Jim Hill <[EMAIL PROTECTED]> wrote: >> Is there a way to produce a very long multiline string of output with >> variables' values inserted without having to resort to this wacky >> """v = %s"""%(var

Re: Easy "here documents" ??

2004-12-19 Thread Jim Hill
Fredrik Lundh wrote: >Scott David Daniels wrote: > >> And if you enjoy building insecure stuff, try: >> >> def fix(text, globals_=None, locals=None, quote='"'): >> d = (globals_ or locals or globals()).copy() >> source = text.split(quote) >> source[1::2] = (str(eval(expr

Re: Easy "here documents" ??

2004-12-19 Thread Jim Hill
Keith Dart wrote: >Jim Hill wrote: >> Is there a way to produce a very long multiline string of output with >> variables' values inserted without having to resort to this wacky > >I was thinking about this. But I can't think of any reason why you would >want

Re: Easy "here documents" ??

2004-12-19 Thread Jim Hill
John Roth wrote: [Here docs] >I'm not sure why you'd want to do this, though. >It seems like it would be mostly useful in a style >of programming that's quite foreign to the way >Python wants to be programmed. I'm going to try some of the suggestions that others have floated but I think you've re

Re: Easy "here documents" ??

2004-12-22 Thread Jim Hill
Fredrik Lundh wrote: >Jim Hill wrote: > >> I'm trying to write a script that writes a script for a rather specialized >> task. I know that seems weird, but the original version was written in >> Korn shell and most of my team are familiar with the way it does things &

Re: Python books?

2007-03-14 Thread Jim Hill
wesley chun wrote: >my book, Core Python Programming, is revised to 2.5, but focuses on >teaching you the core part of the language, features, objects, memory >management, development, good practices, some advanced topic coverage, >and presents lots of exercises. however, it is not an exhaustive

Embedding, "import site", PYTHONHOME, and an old, old issue

2007-02-09 Thread Jim Hill
Well, I've found about a hundred thousand web pages where people have had the same problem I have but nary a page with a solution that works for me. I want to do a simple embed, so I've followed the example in the Extending and Embedding documentation: In the .c file, #include int routine() {

Re: Embedding, "import site", PYTHONHOME, and an old, old issue

2007-02-09 Thread Jim Hill
Jim Hill (that'd be me) wrote: I forgot one more key thing: the compiled code is being run via mpirun (LAM/MPI). Might that have something to do with my pain and heartache? Jim (original post reproduced below in shocking breach of etiquette on the off chance someone's interested in

Re: Embedding, "import site", PYTHONHOME, and an old, old issue

2007-02-12 Thread Jim Hill
Gabriel Genellina wrote: >En Sat, 10 Feb 2007 03:57:05 -0300, Jim Hill <[EMAIL PROTECTED]> escribió: > >> int routine() { >> Py_Initialize(); >> ... >> } > >(Why routine() and not main()? Unfortunately you can't repeteadly >initialize/fi

Re: "Python" is not a good name, should rename to "Athon"

2007-12-03 Thread Jim Hill
Michael Terry wrote: > >Folks admire Newton for some of his breathtaking insights, not because >of his methods. The scientific method is a tool. As was Newton, according to many of his contemporaries. > The results are far more important than the tool. Yep. Jim -- "I loathe people who say, '