TaskCoach: first SyncML release candidate

2008-08-17 Thread Jerome Laheurte
This is a preliminary release for testing purposes. It features synchronization of tasks and notes with a Funambol server, so indirectly with any application supporting SyncML, either natively or through a plugin (Outlook, most recent cell phones, iPods, etc). As the package name hints, this

[ANN] Release 0.70.3 of Task Coach

2008-08-17 Thread Frank Niessink
Hi, I'm happy to announce release 0.70.3 of Task Coach. This release fixes a few bugs introduced in the previous release. Bugs fixed: * wxPython 2.8.8.1 generates images in a new, backwards incompatible way, even when told not to do that. This bug affects users that have an older version of

Re: Good python equivalent to C goto

2008-08-17 Thread Carl Banks
On Aug 17, 12:35 am, Michael Torrie [EMAIL PROTECTED] wrote: However it's not necessary in python to do any of this, since you can define nested functions that have access to the parent scope.  Anytime you need to clean up, just call the nested cleanup function and then return. That is

Re: how to add property dynamically?

2008-08-17 Thread Larry Bates
akonsu wrote: hello, i need to add properties to instances dynamically during run time. this is because their names are determined by the database contents. so far i found a way to add methods on demand: class A(object) : def __getattr__(self, name) : if name == 'test' :

Re: Missing exceptions in PEP 3107

2008-08-17 Thread Carl Banks
On Aug 15, 3:42 pm, Christoph Zwerschke [EMAIL PROTECTED] wrote: Carl Banks wrote:   IOW, there is currently no recommended way to do *anything* with   annotations(**).  That is entirely left up to users and third-party   packages, and the PEP goes out of its way to disclaim all authority on  

Re: Large production environments using ZODB/ZOE?

2008-08-17 Thread Dieter Maurer
Phillip B Oldham [EMAIL PROTECTED] writes on Thu, 7 Aug 2008 09:26:04 -0700 (PDT): I've been reading a lot recently on ZODB/ZOE, but I've not seen any reference to its use in large-scale production envrironments. Are there any real-world examples of ZODB/ZOE in use for a large system? By

Re: Good python equivalent to C goto

2008-08-17 Thread info
as an oldtimer, I know that in complex code the goto statement is still the easiest to code and understand. I propose this solution using exception. The string exception is deprecated but is simpler for this example. # DeprecationWarning: raising a string exception is deprecated def

Re: Good python equivalent to C goto

2008-08-17 Thread Marc 'BlackJack' Rintsch
On Sat, 16 Aug 2008 23:20:52 +0200, Kurien Mathew wrote: 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

how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
when I use 20 for ,SystemError: too many statically nested blocks When I use 100 for ,IndentationError: too many levels of indentation How to handle these errors? -- http://mail.python.org/mailman/listinfo/python-list

Plot pkg - Multiple Y axes?

2008-08-17 Thread Office Expander
Hello, You can make Multiple Y Axes plots in Excel using Multy_Y or EZplot. There is a demo version at www.OfficeExpander.com Cheers! __ Hello, I'm searching for a plotting package that will allow multiple y axes of different scales. For example I'd like

Re: how many nested for can we utilize?

2008-08-17 Thread Fredrik Lundh
Patrol Sun wrote: when I use 20 for ,SystemError: too many statically nested blocks When I use 100 for ,IndentationError: too many levels of indentation How to handle these errors? so why exactly are you trying to nest 20 or 100 for-in loops? /F --

Re: The Importance of Terminology's Quality

2008-08-17 Thread Martijn Lievaart
On Sat, 16 Aug 2008 21:46:18 -0400, John W Kennedy wrote: The 1401 was a decent enough processor for many industrial tasks -- at that time -- but for general programming it was sheer horror. But the easiest machine language /ever/. True, very true. M4 --

Re: The Importance of Terminology's Quality

2008-08-17 Thread Martin Gregorie
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 the basic omission of

Re: QT, ctypes dll and SEG Faults

2008-08-17 Thread Matthieu Brucher
Hi, If the crash occurs in __init__, why do you give us more code ? The crash can occur because you pass a char* to your library. This char* is not managed by your library but by Python. This means that when the constructor is finished, the string is freed and the char* is not valid anymore.

Re: QT, ctypes dll and SEG Faults

2008-08-17 Thread Wojtek Walczak
On Sat, 16 Aug 2008 21:17:25 -0700 (PDT), sapsi wrote: Below is a small class using ctypes and libspectre to read a postscript file. My program is a PyQT 4.4 application �and when the user clicks on a entry in a QTableWidget, i run PostScriptImage(

Re: how to add property dynamically?

2008-08-17 Thread Bruno Desthuilliers
akonsu a écrit : hello, i need to add properties to instances dynamically during run time. this is because their names are determined by the database contents. so far i found a way to add methods on demand: class A(object) : def __getattr__(self, name) : if name == 'test' :

adding properties dynamically (how to?)

2008-08-17 Thread André
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 properties to instances

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 properties to

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

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

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

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

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) { if

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

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

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 than

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 for,

Boost reference container problem( std::vectorAClass*)

2008-08-17 Thread Utku Altinkaya
Hello, I am wrapping the reference container vector as document suggests. typedef std::vectorCUEEntity* EntityContainer; class_CUEEntity(Entity, initCUEEntity*()); class_EntityContainer(EntityContainer) .def(vector_indexing_suiteEntityContainer, true() ) ; When I try to iterate in

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

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:

python-mode errors

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

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

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 Large

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

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,

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: 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? /F -- http://mail.python.org/mailman/listinfo/python-list

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: 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 next;     if

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 something

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? /F i am talking about WINAPI --

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 seem

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 for you.

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 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. In

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 you can't do that;

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? Do you

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,

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 WINAPI I am not

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

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? :-) Bye,

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 --

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 that

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;

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

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. /F 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: 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 just an

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: 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 --

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 defined

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 of abc,

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 (condition3)

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? Not quite

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 found here:

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. --

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's

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 that makes any

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 something similar

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 re foo = yes

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 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 string, I want to be

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 are

Re: python-mode errors

2008-08-17 Thread Fredrik Lundh
Rustom Mody wrote: When I start python mode I get the error: idle error: #buffer easygui.py -Wrong number of arguments : #subr set-match-data 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

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

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) Think of the

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 text3 no text4

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

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 (loopCondition) {     if

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

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 2107

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:

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 the dog entry).

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: 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:

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

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

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

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:

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 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 exactly how

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

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 explicitly

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, and it

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 memory

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. Carl Banks

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

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/9912202 Or maybe

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 the

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

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

  1   2   >