Re: print "%s"

2008-08-17 Thread Rob Weir
On 18 Aug 2008, Beema Shafreen wrote: > Hi ALL, > > In my script i have to print a series of string , so > > print "%s\t%s\t%s\t%s\t%s\t%s\t" %("a","v","t","R","s","f") print "\t".join(("a","v","t","R","s","f")) + "\t" Note the double brackets. -- -rob -- http://mail.python.org/mailman/listinf

Re: print "%s"

2008-08-17 Thread Cameron Simpson
On 18Aug2008 11:58, Beema Shafreen <[EMAIL PROTECTED]> wrote: | In my script i have to print a series of string , so | | print "%s\t%s\t%s\t%s\t%s\t%s\t" %("a","v","t","R","s","f") | | I need to know instead of typing so many %s can i write %6s in python, as | we do in C progm. I hate to tell y

print "%s"

2008-08-17 Thread Beema Shafreen
Hi ALL, In my script i have to print a series of string , so print "%s\t%s\t%s\t%s\t%s\t%s\t" %("a","v","t","R","s","f") I need to know instead of typing so many %s can i write %6s in python, as we do in C progm. What are the other options . -- Beema Shafreen -- http://mail.python.org/mail

Re: How to delete a line with re?

2008-08-17 Thread Peter Otten
Peng Yu wrote: > I want to delete the line with abc in the following program. But the > following program does not do what I want. Can somebody let me know > how to do it? > file="""abcd > efg > hijk > lmn > """ > > regex = re.compile("^abcd$", re.MULTILINE) > print regex.sub('', file), What /

Re: mmap and ctypes

2008-08-17 Thread M�ta-MCI (MVP)
Hi! See here: http://www.ponx.org/download/CD/COMdll/autoitmmap.dll @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Don�t find HTMLgen

2008-08-17 Thread Tim Roberts
[EMAIL PROTECTED] wrote: > >On 15 ago, 00:10, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> En Thu, 14 Aug 2008 17:10:26 -0300, <[EMAIL PROTECTED]>   >> escribi : >> >> > I am looking for HTMLgen module but not to find this, the link >> > referenced inwww.python.orgit does not exist. >> >> > I

Re: export sites/pages to PDF

2008-08-17 Thread Tim Roberts
jvdb <[EMAIL PROTECTED]> wrote: > >My employer is asking for a solution that outputs the content of urls >to pdf. It must be the content as seen within the browser. >Can someone help me on this? It must be able to export several kind of >pages with all kind of content (javascript, etc.) There are

Re: Python does not get environment variable when using cron.

2008-08-17 Thread Cameron Simpson
On 17Aug2008 21:25, John Nagle <[EMAIL PROTECTED]> wrote: > Stephen Cattaneo wrote: >> I am attempting to execute an automated test (written in Python) via >> cron. I have to check the HOSTNAME variable as part of the test, oddly >> under cron the HOSTNAME environment variable is not in the os.env

Re: Python does not get environment variable when using cron.

2008-08-17 Thread John Nagle
Stephen Cattaneo wrote: Hello all, I am attempting to execute an automated test (written in Python) via cron. I have to check the HOSTNAME variable as part of the test, oddly under cron the HOSTNAME environment variable is not in the os.environ dictionary. I know that cron runs in a subshell t

How to delete a line with re?

2008-08-17 Thread Peng Yu
Hi, I want to delete the line with abc in the following program. But the following program does not do what I want. Can somebody let me know how to do it? Thanks, Peng #!/usr/bin/python import re file="""abcd efg hijk lmn """ regex = re.compile("^abcd$", re.MULTILINE) print file, print "$" p

Re: How to access an Array and a struct within a struct wrapped by Swig ?

2008-08-17 Thread emmanuel . rivoire
Anish Chapagain, I already know how to use structure, as my example shown it. I had trouble only with the nested structures, and it was coz of missing typedef (ie: Swig need C struct declaration, not C++). And I still cannot find how to get my arrays... :-S -- http://mail.python.org/mailman/listin

Re: Good python equivalent to C goto

2008-08-17 Thread Matthew Fitzgibbons
as mentioned 'in complex code the goto statement is still the easiest to code and understand'. The examples are very small and do not require that at all. I agree it's ugly. Just to show a way to do it. A very few functions where I use goto in C or C# are a few hundred lines of code, difficult t

Re: like a "for loop" for a string

2008-08-17 Thread Mensanator
On Aug 17, 6:03�pm, B <[EMAIL PROTECTED]> wrote: > Alexnb wrote: > > Uhm, "string" and "non-string" are just that, words within the string. Here > > shall I dumb it down for you? > > > string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes > > text6 �no text7 yes text8" > > > It d

Re: Python does not get environment variable when using cron.

2008-08-17 Thread Asun Friere
On Aug 18, 11:15 am, "Stephen Cattaneo" <[EMAIL PROTECTED]> wrote: > Hello all, > > I am attempting to execute an automated test (written in Python) via > cron. I have to check the HOSTNAME variable as part of the test, oddly > under cron the HOSTNAME environment variable is not in the os.environ

Re: The Importance of Terminology's Quality

2008-08-17 Thread John W Kennedy
Martin Gregorie wrote: On Sat, 16 Aug 2008 21:46:18 -0400, John W Kennedy wrote: Martijn Lievaart wrote: On Thu, 14 Aug 2008 18:33:30 -0400, John W Kennedy wrote: Actually, I was thinking of the 1401. But both the 1620 and the 1401 (without the optional Advanced Programming Feature) share th

Re: Python does not get environment variable when using cron.

2008-08-17 Thread John Machin
On Aug 18, 11:38 am, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > I'm not sure about the environment variable, but os.uname() should > give you what you need otherwise. As documented, it should but may not ... consider using socket.gethost* -- http://mail.python.org/mailman/listinfo/python-list

Re: Python does not get environment variable when using cron.

2008-08-17 Thread Eric Wertman
I'm not sure about the environment variable, but os.uname() should give you what you need otherwise. -- http://mail.python.org/mailman/listinfo/python-list

Python does not get environment variable when using cron.

2008-08-17 Thread Stephen Cattaneo
Hello all, I am attempting to execute an automated test (written in Python) via cron. I have to check the HOSTNAME variable as part of the test, oddly under cron the HOSTNAME environment variable is not in the os.environ dictionary. I know that cron runs in a subshell that does not have all of t

Re: how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
I use the exec function. my code's levels are less than 3. BTW,Linus Torvalds is NOT always right. 2008/8/18 Roel Schroeven <[EMAIL PROTECTED]> > Nick Dumas schreef: > >> A good quote I read (I can't remember who it was from, though) is "If >> you need more than three levels of indentation, then

Re: how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
Yes, I can solve the problem by recursive function. I guess Function Call consume more resources than nested For. So I use the nested For by using exec function. 2008/8/18 Paul Boddie <[EMAIL PROTECTED]> > On 17 Aug, 19:36, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > and functions will solve

Re: how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
I found that the recursive function run very slowly 2008/8/18 Paul Boddie <[EMAIL PROTECTED]> > On 17 Aug, 17:17, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > required reading: > > > >"The Effects of Moore's Law and Slacking on Large Computations" > >http://arxiv.org/abs/astro-ph/9912

Re: how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
Of course We needn't 100 levels,but I use the exec function can concise the code. See the attachment. 2008/8/17 Fredrik Lundh <[EMAIL PROTECTED]> > Nick Dumas wrote: > > A good quote I read (I can't remember who it was from, though) is "If >> you need more than three levels of indentation, then s

Re: Missing exceptions in PEP 3107

2008-08-17 Thread Carl Banks
On Aug 17, 7:25 pm, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > If it bothers you that much, go file a bug report.  Someone might even > > change it.  But it's nothing but needless pedantry. > > Has my "de" domain inspired you to rant about "pedantry"? Actually, no. Ca

Re: like a "for loop" for a string

2008-08-17 Thread Wojtek Walczak
On Sun, 17 Aug 2008 12:07:45 -0700 (PDT), [EMAIL PROTECTED] wrote: > I'm waiting for a str.xsplit still :-) > If I write and submit a C implementation of xsplit how many chances do > I have to see it included into Python? :-) Got no idea, but it might be a nice try. It should be a quite good memo

Re: online tutorials?

2008-08-17 Thread David Cournapeau
On Sun, Aug 17, 2008 at 5:53 PM, Gits <[EMAIL PROTECTED]> wrote: > I want to learn how to program in python and would like to know if you > guys know of any free online tutorials. Or is it too complicated to > learn from a site or books? Hi, I learned using dive into python, available online, an

Re: Missing exceptions in PEP 3107

2008-08-17 Thread Christoph Zwerschke
Carl Banks wrote: If it bothers you that much, go file a bug report. Someone might even change it. But it's nothing but needless pedantry. Has my "de" domain inspired you to rant about "pedantry"? No, it does not bother me that much. I just thought the PEP could be clearer here and explicit

Re: online tutorials?

2008-08-17 Thread Paul Boddie
On 18 Aug, 00:53, Gits <[EMAIL PROTECTED]> wrote: > I want to learn how to program in python and would like to know if you > guys know of any free online tutorials. Or is it too complicated to > learn from a site or books? Start here, perhaps: http://wiki.python.org/moin/BeginnersGuide As for w

Re: like a "for loop" for a string

2008-08-17 Thread B
Alexnb wrote: Uhm, "string" and "non-string" are just that, words within the string. Here shall I dumb it down for you? string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes text6 no text7 yes text8" It doesn't matter what is in the string, I want to be able to know exactl

online tutorials?

2008-08-17 Thread Gits
I want to learn how to program in python and would like to know if you guys know of any free online tutorials. Or is it too complicated to learn from a site or books? -- http://mail.python.org/mailman/listinfo/python-list

Re: like a "for loop" for a string

2008-08-17 Thread bearophileHUGS
MRAB: > If it was introduced into Python v3.x then wouldn't it have to be > called str.split in order to be consistent with xrange -> range? :-) xsplit may be a name fit for Python 2.6/2.7. Regarding Python 3.0 you may be right, but then when you want the list of parts you have to do: list(somest

Re: command line tool for process communication

2008-08-17 Thread Fredrik Lundh
aditya shukla wrote: I have a program which is run through command line .I am trying to create another command line tools which controls this program. So for example in my new program when i give newprog -a then it should invoke the existing tool and perform one of its operation.eg

command line tool for process communication

2008-08-17 Thread aditya shukla
Hello guys, I have a program which is run through command line .I am trying to create another command line tools which controls this program. So for example in my new program when i give newprog -a then it should invoke the existing tool and perform one of its operation.eg existtprog -s How coul

Re: like a "for loop" for a string

2008-08-17 Thread MRAB
On Aug 17, 8:40 pm, [EMAIL PROTECTED] wrote: > Eric Wertman: > > > So what exactly does that do?  Returns a generator, instead of a list? > > Allows you to iterate on the parts in a lazy way, without creating the > whole list of the pieces. > The arguments are the same of str.split(). > If it was i

Re: Time-dependent method

2008-08-17 Thread Fredrik Lundh
hypermonkey2 wrote: I was wondering if it is possible to call a method such that if it takes more than say 1 minute to complete, it will give up and do something else instead. as mentioned in the recent "Create a process with a 'time to live'" thread: http://code.activestate.com/recipes/30

Time-dependent method

2008-08-17 Thread hypermonkey2
Hi all! I was wondering if it is possible to call a method such that if it takes more than say 1 minute to complete, it will give up and do something else instead. Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list

Re: list/tuple/dict question

2008-08-17 Thread Fredrik Lundh
bruce wrote: so, this still doesn't get me an array called 'cat', or 'dog' sure does, in the stuff dictionary: >>> stuff = {} >>> foo = [] >>> foo.append('cat') >>> foo.append('dog') >>> stuff[foo[1]] = [] >>> stuff {'dog': []} (note that Python indexing starts with zero, so foo[1] refers to

RE: list/tuple/dict question

2008-08-17 Thread bruce
Hi Fredrik... so, this still doesn't get me an array called 'cat', or 'dog' or do i somehow use stuff to add/extract the vals...??? thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Fredrik Lundh Sent: Sunday, August 17, 2008 2:27 PM To: python-list@

Re: Good python equivalent to C goto

2008-08-17 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: The goto code is the simpler way to do it. We are not talking about simple if-else, but let say 20 if-else. Many nested if-else are more difficult to understand and do not fit better the semantics. let's see... $ cd ~/svn/python25 $ grep goto */*.c | wc 210770

Re: list/tuple/dict question

2008-08-17 Thread Fredrik Lundh
bruce wrote: a dict doesn't seem to work, as it is essentially a series of key/values, which isn't exactly what i want... so what do you think a variable namespace is? as usual, Python works best if you use it to write Python program, and in Python, the right way to store a collection of nam

Re: Good python equivalent to C goto

2008-08-17 Thread info
On Aug 17, 9:23 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Aug 17, 8:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: > >> Kurien Mathew wrote: > >>> Hello, > >>> Any suggestions on a good python equivalent for the following C code: > >>> while (loopCo

list/tuple/dict question

2008-08-17 Thread bruce
hi guys/gals... got a basic question that i can't get my hands around. i'm trying to programatically create/use a list/tuple (or whatever the right phrase in pyton is!!) basically, something like: foo = [] foo.append('cat') foo.append('dog') foo[1] = [] (and in this case, i really want to h

Re: like a "for loop" for a string

2008-08-17 Thread Vlastimil Brom
Ok, after sending my post, I see, that the code got a bit screewed up, but morover, there should probably be a word boundary in the closing part of the regexp. A next attempt + added stripping the "yes" delimiter and the whitespace...: >>> import re >>> input_text = """yes text1 yes text2 yes text

Re: Missing exceptions in PEP 3107

2008-08-17 Thread Carl Banks
On Aug 17, 9:34 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Carl Banks schrieb: > > > You are free to use it for other things.  For example, the following > > usage is obvious and sensible (insofar as listing exceptions is > > sensible): > > > def f(x : int) -> int, raises(TypeError) > > >

Re: Python process communication

2008-08-17 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I'd like to write a script that will connect to another already running process, pipe some data to it's input and receive data from it's output. I can create another process using subprocess module, but how do I connect to already running process? Maybe there is a bett

Re: python-mode errors

2008-08-17 Thread Fredrik Lundh
Rustom Mody wrote: When I start python mode I get the error: idle error: # -Wrong number of arguments : # 2" The Python mode version is 4.78 Is this a known problem? there are plenty of google hits for that message, and they all seem to agree that the problem is caused by using ELC files g

Re: like a "for loop" for a string

2008-08-17 Thread mblume
Am Sun, 17 Aug 2008 13:12:36 -0700 schrieb Alexnb: > Uhm, "string" and "non-string" are just that, words within the string. > Here shall I dumb it down for you? > Please, bear with us. You are deep into the problem, we are not. It doesn't help to be rude. If you can explain your problem well, you

Re: like a "for loop" for a string

2008-08-17 Thread Vlastimil Brom
2008/8/17 Alexnb <[EMAIL PROTECTED]> > > Uhm, "string" and "non-string" are just that, words within the string. Here > shall I dumb it down for you? > > > string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes > text6 no text7 yes text8" > > It doesn't matter what is in the stri

Re: like a "for loop" for a string

2008-08-17 Thread Fredrik Lundh
Alexnb wrote: Uhm, "string" and "non-string" are just that, words within the string. From what I can tell, this is the first time you use the word "word" in your posts. > Here shall I dumb it down for you? No, you should do what you should have done from the very beginning: explain what y

Re: like a "for loop" for a string

2008-08-17 Thread Grzegorz Staniak
On 2008-08-17, Alexnb <[EMAIL PROTECTED]> wroted: > string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes > text6 no text7 yes text8" > > It doesn't matter what is in the string, I want to be able to know exactly > how many "yes"'s there are. - cut here - >>> import r

Re: like a "for loop" for a string

2008-08-17 Thread Paul Boddie
On 17 Aug, 20:22, Alexnb <[EMAIL PROTECTED]> wrote: > But I am wondering is there a way to something like this: > > funString = "string string string non-string non-string string" > and > for "string" in funString: > print something > > I know you can't do that; but, is there a way do do some

Re: dynamic attribute syntax

2008-08-17 Thread castironpi
On Aug 17, 3:05 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > castironpi wrote: > > 'obj.prop' has an easy access, but > > > att= 'prop' > > getattr( obj, att ) > > > is much clumsier, while no less useful, maybe more. > > maybe more?  ok, you *are* utterly and completely unable to post > anything

Re: like a "for loop" for a string

2008-08-17 Thread Alexnb
Uhm, "string" and "non-string" are just that, words within the string. Here shall I dumb it down for you? string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes text6 no text7 yes text8" It doesn't matter what is in the string, I want to be able to know exactly how many "yes"

Re: dynamic attribute syntax

2008-08-17 Thread Fredrik Lundh
castironpi wrote: 'obj.prop' has an easy access, but att= 'prop' getattr( obj, att ) is much clumsier, while no less useful, maybe more. maybe more? ok, you *are* utterly and completely unable to post anything that makes any sense at all to anyone that uses Python. plonkeliplonk. -- htt

Re: dynamic attribute syntax

2008-08-17 Thread castironpi
On Aug 17, 2:46 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 17 Aug, 21:29, castironpi <[EMAIL PROTECTED]> wrote: > > > > > What are the changes, pros and cons, involved in something like: > > > obj:att for a dynamic access, and obj.att for static? > > A previous proposal and discussion can be f

Re: like a "for loop" for a string

2008-08-17 Thread Vlastimil Brom
2008/8/17 Alexnb <[EMAIL PROTECTED]> > > Basically I want the code to be able to pick out how many strings there are > and then do something with each, or the number. When I say string I mean > how > many "strings" are in the string "string string string non-string string" > > Does that help? > >

Re: Good python equivalent to C goto

2008-08-17 Thread Paul Hankin
On Aug 16, 11:20 pm, Kurien Mathew <[EMAIL PROTECTED]> wrote: > Hello, > > Any suggestions on a good python equivalent for the following C code: > > while (loopCondition) > { >         if (condition1) >                 goto next; >         if (condition2) >                 goto next; >         if (

Re: like a "for loop" for a string

2008-08-17 Thread Grzegorz Staniak
On 2008-08-17, Alexnb <[EMAIL PROTECTED]> wroted: > Basically I want the code to be able to pick out how many strings What do you mean by "string"? foo = "abc abc cde abc ijk abc cde abc" "foo" is one "string". If you want substrings, specify what kind of substrings you mean. All occurences

Re: like a "for loop" for a string

2008-08-17 Thread Fredrik Lundh
Alexnb wrote: Basically I want the code to be able to pick out how many strings there are and then do something with each, or the number. When I say string I mean how many "strings" are in the string "string string string non-string string" > Does that help? not really, since you haven't def

Re: dynamic attribute syntax

2008-08-17 Thread Paul Boddie
On 17 Aug, 21:29, castironpi <[EMAIL PROTECTED]> wrote: > > What are the changes, pros and cons, involved in something like: > > obj:att for a dynamic access, and obj.att for static? A previous proposal and discussion can be found here: http://www.python.org/dev/peps/pep-0363/ Paul -- http://mai

Re: like a "for loop" for a string

2008-08-17 Thread bearophileHUGS
Eric Wertman: > So what exactly does that do? Returns a generator, instead of a list? Allows you to iterate on the parts in a lazy way, without creating the whole list of the pieces. The arguments are the same of str.split(). Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: like a "for loop" for a string

2008-08-17 Thread Alexnb
Basically I want the code to be able to pick out how many strings there are and then do something with each, or the number. When I say string I mean how many "strings" are in the string "string string string non-string string" Does that help? Fredrik Lundh wrote: > > Alexnb wrote: > >> Ya jus

Re: like a "for loop" for a string

2008-08-17 Thread Fredrik Lundh
Alexnb wrote: Ya just an example, to print the numbers 1-5 Sorry, I still don't have the slightest idea what you expect the code to do. But I am wondering is there a way to something like this: funString = "string string string non-string non-string string" and for "string" in funString:

dynamic attribute syntax

2008-08-17 Thread castironpi
Hi all, Thinking of a syntax for 'getattr' and 'setattr' dynamic access. 'obj.prop' has an easy access, but att= 'prop' getattr( obj, att ) is much clumsier, while no less useful, maybe more. What are the changes, pros and cons, involved in something like: obj:att for a dynamic access, and obj

Re: Good python equivalent to C goto

2008-08-17 Thread Matthew Fitzgibbons
[EMAIL PROTECTED] wrote: On Aug 17, 8:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: Kurien Mathew wrote: Hello, Any suggestions on a good python equivalent for the following C code: while (loopCondition) { if (condition1) goto next; if (condition2) goto next;

Re: how many nested for can we utilize?

2008-08-17 Thread Roel Schroeven
Nick Dumas schreef: A good quote I read (I can't remember who it was from, though) is "If you need more than three levels of indentation, then something is seriously wrong with your code." Possibly Guido himself? Linus Torvalds in the Linux kernel coding style document: "[...] The answer to th

Re: like a "for loop" for a string

2008-08-17 Thread Eric Wertman
So what exactly does that do? Returns a generator, instead of a list? > I'm waiting for a str.xsplit still :-) > If I write and submit a C implementation of xsplit how many chances do > I have to see it included into Python? :-) > > Bye, > bearophile > -- > http://mail.python.org/mailman/listinf

Re: like a "for loop" for a string

2008-08-17 Thread bearophileHUGS
Wojtek Walczak: > >>> somestr = "string1 string2 string3" > >>> for i in somestr.split(): > > ...print i > ... > string1 > string2 > string3 I'm waiting for a str.xsplit still :-) If I write and submit a C implementation of xsplit how many chances do I have to see it included into Python? :-)

Re: Vmware api

2008-08-17 Thread Eric Wertman
I would also be interested in anything anyone can offer. I spend some time looking around, and took a fair stab at using the wsdl2py that comes with The ZSI package. Ultimately I couldn't get anything to work, and reverted to using perl (yuk). I'm interested mostly in interrogating the ESX serve

Re: how to call API Functions in python

2008-08-17 Thread raashid bhatt
On Aug 17, 11:27 am, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > On Sun, 17 Aug 2008 11:22:52 -0700 (PDT), raashid bhatt wrote: > >> > how to call API Functions in python > > >> The same way as you'd call any other function, of course.  What API are > >> you referring to? > > i am talking about WIN

Re: how to call API Functions in python

2008-08-17 Thread Fredrik Lundh
raashid bhatt wrote: The same way as you'd call any other function, of course. What API are you referring to? i am talking about WINAPI use pywin32 or ctypes: http://wiki.python.org/moin/PyWin32 http://docs.python.org/lib/module-ctypes.html for some kinds of Windows programming, I

Re: like a "for loop" for a string

2008-08-17 Thread Wojtek Walczak
On Sun, 17 Aug 2008 11:22:37 -0700 (PDT), Alexnb wrote: > funString = "string string string non-string non-string string" > and > for "string" in funString: > print something > > I know you can't do that; but, is there a way do do something similar that > gets the same result? What's "that"

Re: like a "for loop" for a string

2008-08-17 Thread Alexnb
Ya just an example, to print the numbers 1-5 Fredrik Lundh wrote: > > Alexnb wrote: > >> But I am wondering is there a way to something like this: >> >> funString = "string string string non-string non-string string" >> and >> for "string" in funString: >> print something >> >> I know

Re: how many nested for can we utilize?

2008-08-17 Thread Paul Boddie
On 17 Aug, 19:36, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > and functions will solve the 40-billion year computation problem exactly > how? I was thinking more about the need to nest "for" statements to a depth of 20 levels, which I imagine only arises on a "just in case" basis for the inquirer

Re: like a "for loop" for a string

2008-08-17 Thread Colin J. Williams
Alexnb wrote: Okay, so lets say you have a list: funList = [1,2,3,4,5] and you do: for x in funList: print x this will print 1-5 But I am wondering is there a way to something like this: funString = "string string string non-string non-string string" and for "string" in funString:

Re: how to call API Functions in python

2008-08-17 Thread Wojtek Walczak
On Sun, 17 Aug 2008 11:22:52 -0700 (PDT), raashid bhatt wrote: >> > how to call API Functions in python >> >> The same way as you'd call any other function, of course. �What API are >> you referring to? > i am talking about WINAPI I am not a Windows guy, but maybe ctypes module will be helpful fo

Re: like a "for loop" for a string

2008-08-17 Thread Fredrik Lundh
Alexnb wrote: But I am wondering is there a way to something like this: funString = "string string string non-string non-string string" and for "string" in funString: print something I know you can't do that; but, is there a way do do something similar that gets the same result? you se

Re: how to call API Functions in python

2008-08-17 Thread raashid bhatt
On Aug 17, 11:08 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > raashid bhatt wrote: > > how to call API Functions in python > > The same way as you'd call any other function, of course.  What API are > you referring to? > > i am talking about WINAPI -- http://mail.python.org/mailman/listinfo/pyt

like a "for loop" for a string

2008-08-17 Thread Alexnb
Okay, so lets say you have a list: funList = [1,2,3,4,5] and you do: for x in funList: print x this will print 1-5 But I am wondering is there a way to something like this: funString = "string string string non-string non-string string" and for "string" in funString: print somethi

Re: Good python equivalent to C goto

2008-08-17 Thread info
On Aug 17, 8:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote: > Kurien Mathew wrote: > > Hello, > > > Any suggestions on a good python equivalent for the following C code: > > > while (loopCondition) > > { > >     if (condition1) > >         goto next; > >     if (condition2) > >         goto

Re: Good python equivalent to C goto

2008-08-17 Thread Matthew Fitzgibbons
Kurien Mathew wrote: Hello, Any suggestions on a good python equivalent for the following C code: while (loopCondition) { if (condition1) goto next; if (condition2) goto next; if (condition3) goto next; stmt1; stmt2; next: stmt3; stmt4; }

Re: how to call API Functions in python

2008-08-17 Thread Fredrik Lundh
raashid bhatt wrote: how to call API Functions in python The same way as you'd call any other function, of course. What API are you referring to? -- http://mail.python.org/mailman/listinfo/python-list

how to call API Functions in python

2008-08-17 Thread raashid bhatt
how to call API Functions in python -- http://mail.python.org/mailman/listinfo/python-list

Re: Vmware api

2008-08-17 Thread Rajanikanth Jammalamadaka
Hi! Luke, You can use the vmrun command for interacting with VMware Workstation/Fusion. You can do something like import os os.system('vmrun start .vmxFile') os.system('vmrun stop .vmxFile') If you can be more specific about your needs, I may be able to help you further. Thanks, Raj On Sun, A

Re: how many nested for can we utilize?

2008-08-17 Thread Fredrik Lundh
Paul Boddie wrote: required reading: "The Effects of Moore's Law and Slacking on Large Computations" http://arxiv.org/abs/astro-ph/9912202 Or maybe this...? http://docs.python.org/tut/node6.html#SECTION00660 and functions will solve the 40-billion year computation pro

Re: how many nested for can we utilize?

2008-08-17 Thread Wojtek Walczak
On Sun, 17 Aug 2008 17:17:06 +0200, Fredrik Lundh wrote: >>> it'll take approx 40 billion years to run the program. >> >> I guess that's exactly why the OP asks the question. He just wants >> to start as soon as possible ;-) > > required reading: > >"The Effects of Moore's Law and Slacking on

Re: urllib getting SSL certificate info

2008-08-17 Thread John Nagle
Fredrik Lundh wrote: Ghirai wrote: Using urllib, is there any way i could access some info about the SSL certificate (when opening a https url)? I'm really interested in the fingerprint. I haven't been able to find anything so far. you can get some info via (undocumented?) attributes on th

python-mode errors

2008-08-17 Thread Rustom Mody
When I start python mode I get the error: idle error: # -Wrong number of arguments : # 2" The Python mode version is 4.78 Is this a known problem? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: how many nested for can we utilize?

2008-08-17 Thread Paul Boddie
On 17 Aug, 17:17, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > required reading: > >"The Effects of Moore's Law and Slacking on Large Computations" >http://arxiv.org/abs/astro-ph/9912202 Or maybe this...? http://docs.python.org/tut/node6.html#SECTION00660 And this: http:

Re: how many nested for can we utilize?

2008-08-17 Thread Fredrik Lundh
Wojtek Walczak wrote: it'll take approx 40 billion years to run the program. I guess that's exactly why the OP asks the question. He just wants to start as soon as possible ;-) required reading: "The Effects of Moore's Law and Slacking on Large Computations" http://arxiv.org/abs/astro-p

Boost reference container problem( std::vector)

2008-08-17 Thread Utku Altinkaya
Hello, I am wrapping the reference container vector as document suggests. typedef std::vector EntityContainer; class_("Entity", init()); class_("EntityContainer") .def(vector_indexing_suite() ) ; When I try to iterate in python all I get is the following error: TypeError: No to_python

Re: how many nested for can we utilize?

2008-08-17 Thread Wojtek Walczak
On Sun, 17 Aug 2008 16:39:26 +0200, Fredrik Lundh wrote: >> A good quote I read (I can't remember who it was from, though) is "If >> you need more than three levels of indentation, then something is >> seriously wrong with your code." Possibly Guido himself? Anyway. If >> you've got 100 levels of

Re: how many nested for can we utilize?

2008-08-17 Thread Fredrik Lundh
Nick Dumas wrote: A good quote I read (I can't remember who it was from, though) is "If you need more than three levels of indentation, then something is seriously wrong with your code." Possibly Guido himself? Anyway. If you've got 100 levels of for, you're probably making things way harder tha

Re: how many nested for can we utilize?

2008-08-17 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 A good quote I read (I can't remember who it was from, though) is "If you need more than three levels of indentation, then something is seriously wrong with your code." Possibly Guido himself? Anyway. If you've got 100 levels of for, you're probably ma

Windows / Tkinter - problem with grid - not able to place widgets at desired places

2008-08-17 Thread dudeja . rajat
Hi, I'm learning Python and Tkinter. I've started programming in Eclipse with PyDev. I'm intending to create a GUI. I'm not able to understand the Grid manager perhaps because there is quite a less documentation available for it on the net. My desired GUI is attached in the mail. Although I've tr

Re: Good python equivalent to C goto

2008-08-17 Thread Grant Edwards
On 2008-08-16, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sat, 16 Aug 2008 23:20:52 +0200, Kurien Mathew <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Hello, >> >> Any suggestions on a good python equivalent for the following C code: >> >> while (loopCondition) >>

Re: Missing exceptions in PEP 3107

2008-08-17 Thread Christoph Zwerschke
Terry Reedy wrote: > I would agree... but... > The problem is that code that uses a function hardly cares whether an > exception that replaces the normal return is raised explicitly, by a > syntax operation (and these are not yet completely documented, though > perhaps they should be), or by a fun

Python process communication

2008-08-17 Thread projects . gg . aaron
Hi, I'd like to write a script that will connect to another already running process, pipe some data to it's input and receive data from it's output. I can create another process using subprocess module, but how do I connect to already running process? Maybe there is a better solution for process

Vmware api

2008-08-17 Thread Luke Hamilton
Hi List, Has anyone here played around with getting python to talk to the vmware api's. I have had a quick look at vmware's api and there is no out of the box python packages, but I believe that there might be some third party wrappers around? If anyone has any info that would be great. Thanks

Re: Missing exceptions in PEP 3107

2008-08-17 Thread Christoph Zwerschke
Carl Banks schrieb: You are free to use it for other things. For example, the following usage is obvious and sensible (insofar as listing exceptions is sensible): def f(x : int) -> int, raises(TypeError) Think of the return value annotation as more of a function outcome annotation. That's fi

Re: adding properties dynamically (how to?)

2008-08-17 Thread Bruno Desthuilliers
André a écrit : I didn't want to hijack the original thread but I have basically the same request... On Aug 17, 7:09 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: akonsu a écrit :> hello, [SNIP] Wrong solution to your problem, I'd say. Let's start again: """ > i need to add propertie

  1   2   >