Re: ['a', 'b'][True] results 'b' But how?

2007-07-05 Thread Robert Bauck Hamar
kath wrote: > Hi, > > Can any one please tell me how is the following code is working? > ['a','b'] is a list of string Yes. > and [True] is list of boolean value. No. It's the subscription operator applied to the list of strings. a = ['a', 'b'] a[True] may be clearer. > How is it making effe

Re: Newbie question: how to get started?

2007-06-17 Thread Robert Bauck Hamar
ed wrote: > I should also mention that I know C/C++, Perl, Javascript, the basics > of mySQL, and HTML/CSS. If anyone has tried to enter python from these > angles, I'd be grateful to hear from you. What's C/C++? Well, I knew C, C++, Perl, Java, SQL, and HTML before learning Python. And some mo

Re: Re printing on same line.

2007-06-15 Thread Robert Bauck Hamar
Jerry Hill wrote: > On 6/15/07, HMS Surprise <[EMAIL PROTECTED]> wrote: >> I want to print a count down timer on the same line. I tried >> >> print '\r', timeLeft, >> >> which just appends to the same line. > > Sounds to me like whatever you're printing to doesn't do what you > expect when it

Re: Is there any way to catch expections when call python method in C++

2007-06-13 Thread Robert Bauck Hamar
Allen wrote: > I use try catch, but cannot catch the execeptions of execution python > method. > > PYCALL_API void PyCall(const char * pszModule, const char * pszFunc, > void * pArg) > { > if (pszModule == NULL || pszFunc == NULL) > { > return; > } > > Py_Initialize(); > > PyObject * pModule =

Re: stdout/err and C extentions

2007-06-12 Thread Robert Bauck Hamar
hg wrote: > Robert Bauck Hamar wrote: > >> hg wrote: >> >>> Hi, >>> >>> I have the following >>> >>> * C extention - redir.c >>> >>> >>> #include "Python.h" >

Re: stdout/err and C extentions

2007-06-12 Thread Robert Bauck Hamar
ntion!\n" goes > to the console. > > Any clue ? There is no portable way to change the location of stdout during execution of a program. If you want to print with whatever is sys.stdout from an extension module, you should call sys.stdout's write method dynamically from C. -- Robert Bauck Hamar -- http://mail.python.org/mailman/listinfo/python-list

Re: newb: Join two string variables

2006-12-05 Thread Robert Bauck Hamar
. (rest of message deleted, because I don't comment on it.) -- Robert Bauck Hamar Der er to regler for suksess: 1. Fortell aldri alt du vet. - Roger H. Lincoln -- http://mail.python.org/mailman/listinfo/python-list