Pushing for Pythoncard 1.0

2011-05-02 Thread John Henry
Attempt to push Pythoncard to a 1.0 status is now underway. A temporary website has been created at: http://code.google.com/p/pythoncard-1-0/ The official website continues to be http://pythoncard.sourceforge.net/ Pythoncard is such a wonderful package that it would be a shame to allow developm

Invoking Python from Python

2005-11-08 Thread John Henry
Hi all, I have a need to create a Python script on the fly from another Python program and then execute the script so created. Do I need to invoke Python through os.spawnl or is there a better way? Thanks, -- John -- http://mail.python.org/mailman/listinfo/python-list

Cut and paste an EPS file

2005-12-02 Thread John Henry
I am looking for a Python tookit that will enable me to cut section of a picture out from an EPS file and create another EPS file. I am using a proprietary package for doing certain engineering calculations. It creates single page x-y line plots that has too much blank spaces around the plotted a

Re: Cut and paste an EPS file

2005-12-02 Thread John Henry
Thanks for the reply. Yes, that would have been too easy :=) If I change the bbox, I would cut out the lower 1/3 of the plot. I only want to apply it to the top 2/3 of the page. Regards, -- JH -- http://mail.python.org/mailman/listinfo/python-list

testing array of logicals

2006-07-12 Thread John Henry
Hi list, Is there a more elagant way of doing this? # logflags is an array of logicals test=True for x in logflags: test = test and x print test -- Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: testing array of logicals

2006-07-13 Thread John Henry
Simon Brunning wrote: > On 12 Jul 2006 11:14:43 -0700, John Henry <[EMAIL PROTECTED]> wrote: > > Is there a more elagant way of doing this? > > > > # logflags is an array of logicals > > test=True > > for x in logflags: > >test = test and x >

Better utilization of duo-core?

2006-07-13 Thread John Henry
Hi list, I have a Python ap that starts another non-Pythoon ap for number crunching. My new notebook comes with a duo-core CPU. I tried manually running 2 copies of my ap at the same time) and it appears to run the whole job faster (or at least the CPU loading level as show by the task manager a

Re: testing array of logicals

2006-07-13 Thread John Henry
Simon Forman wrote: > > > > False not in logflags > > > > Or, if your values aren't already bools > > False not in (bool(n) for n in logflags) > > > > Peace, > ~Simon Very intriguing use of "not in"... Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Cyclic class definations

2006-07-18 Thread John Henry
Hi list, I am trying to understand better Python packaging. This might be a messed up class hierachy but how would I break this cyclic relatioship? In file A: from B import B_Class Class_A_Main(): def def SomeMethod(self): res=B_Class(self) Class_A_SubClass(Class_A_Main):

Re: Cyclic class definations

2006-07-18 Thread John Henry
I think I got the answer by playing around a bit. It appears you *don't* need to forward declare things. For example, the following code works: class a: def run(self): new_a=a_sub() new_a.print_it() class a_sub(a): def print_it(self): print "Hi" b=a().run()

Re: Cyclic class definations

2006-07-18 Thread John Henry
s, if they make your code hard to understand so > try to not introduce them if possible. > > Hope this helps, > Nick V. > > > John Henry wrote: > > Hi list, > > > > I am trying to understand better Python packaging. This might be a > > messed up class hier

Can thread start other threads?

2006-07-18 Thread John Henry
Can Python thread start threads? It appears not. When I do that, the sub-threads gets to certain point and just sit there. If I run the code serially and not run the sub-thread code as threads, everything is fine. I throught the problem is when you run multiple processes of Pythons... -- http

Re: Can thread start other threads?

2006-07-18 Thread John Henry
Thanks for the confirmation. I will see if I can reduce the code down to something managable and post the failing code. Diez B. Roggisch wrote: > John Henry schrieb: > > Can Python thread start threads? It appears not. When I do that, the > > sub-threads gets to certain poi

Re: Threads vs Processes

2006-07-26 Thread John Henry
Chance Ginger wrote: > On Wed, 26 Jul 2006 10:54:48 -0700, Carl J. Van Arsdall wrote: > > > Alright, based a on discussion on this mailing list, I've started to > > wonder, why use threads vs processes. So, If I have a system that has a > > large area of shared memory, which would be better? I'v

Re: Threads vs Processes

2006-07-26 Thread John Henry
> > Carl, > OS writers provide much more tools for debugging, tracing, changing > the priority of, sand-boxing processes than threads (in general) It > *should* be easier to get a process based solution up and running > andhave it be more robust, when compared to a threaded solution. > > - Paddy

Re: Threads vs Processes

2006-07-27 Thread John Henry
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > John Henry wrote: > > > Granted. Threaded program forces you to think and design your > > > application much more carefully (to avoid race conditions, dead-locks, > > > ...) but there is nothing in

Re: Threads vs Processes

2006-07-27 Thread John Henry
Nick Craig-Wood wrote: > > Here is test prog... > Here's a more real-life like program done in both single threaded mode and multi-threaded mode. You'll need PythonCard to try this. Just to make the point, you will notice that the core code is identical between the two (method on_menuFileStart

Pywin32 Excel question

2006-08-04 Thread John Henry
I posted the following message to the Pywin32 list but if anybody here can help, it would be appreciated very much. Hi list, I have a need to copy 3 rows of data from the top of my Excel spreadsheet to another location. I would have throught that this should be very

Re: Pywin32 Excel question

2006-08-05 Thread John Henry
e entire workbook and you end up with a new workbook. But you have to do xlSheet.Paste(). Go figure! [EMAIL PROTECTED] wrote: > John Henry wrote: > > I posted the following message to the Pywin32 list but if anybody here > > can help, it would be appreciated very much. > >

What's the cleanest way to compare 2 dictionary?

2006-08-09 Thread John Henry
Hi list, I am sure there are many ways of doing comparision but I like to see what you would do if you have 2 dictionary sets (containing lots of data - like 2 keys and each key contains a dozen or so of records) and you want to build a list of differences about these two sets. I like to end

Re: What's the cleanest way to compare 2 dictionary?

2006-08-09 Thread John Henry
Paddy wrote: > John Henry wrote: > > Hi list, > > > > I am sure there are many ways of doing comparision but I like to see > > what you would do if you have 2 dictionary sets (containing lots of > > data - like 2 keys and each key contains a dozen or so of rec

Re: What's the cleanest way to compare 2 dictionary?

2006-08-09 Thread John Henry
John Henry wrote: > Paddy wrote: > > John Henry wrote: > > > Hi list, > > > > > > I am sure there are many ways of doing comparision but I like to see > > > what you would do if you have 2 dictionary sets (containing lots of > > > data -

Re: What's the cleanest way to compare 2 dictionary?

2006-08-10 Thread John Henry
, and if I wish to know if the records are the same, I would have to do record by record comparsion. However, since there are only a handful of records per key, this wouldn't be so bad. Maybe I just overload the compare operator or something. John Machin wrote: > John Henry wrote: > &g

Re: using python to edit a word file?

2006-08-10 Thread John Henry
John Salerno wrote: > I figured my first step is to install the win32 extension, which I did, > but I can't seem to find any documentation for it. A couple of the links > on Mark Hammond's site don't seem to work. > > Anyway, all I need to do is search in the Word document for certain > strings and

Re: What's the cleanest way to compare 2 dictionary?

2006-08-11 Thread John Henry
John Machin wrote: > John Henry wrote: > > John, > > > > Yes, there are several scenerios. > > > > a) Comparing keys only. > > > > That's been answered (although I haven't gotten it to work under 2.3 > > yet) > > (1) What

Re: What's the cleanest way to compare 2 dictionary?

2006-08-11 Thread John Henry
Thank you. That works. Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, John Henry > wrote: > > > When I do it under 2.3, I get: > > > > common_eq = set(k for k in _common if a[k] == b[k]) > >^ &

Re: Easy to use distributed system?

2006-08-14 Thread John Henry
I've been using Pyro and it does what I needs it to do for me. I don't know if it's as fancy as other packages but the price is right. Jim Jones wrote: > I am looking for a system in Python that will easily allow me to distribute > processes across multiple systems?So, if I have a function 'f

Re: inheritance?

2006-08-15 Thread John Henry
Is this what you're looking for? class baseClass: def __init__(self): def fromfile(self, fileObj, byteOrder=None): def getVR(self): def getGroup(self): def getElement(self): def getSize(self): def getData(self): class implicitClass(baseClass): def __init__(self): bas

Re: inheritance?

2006-08-16 Thread John Henry
As others pointed out already, this kind of "if then else" determination of type is best avoided. If it looks like a duck, quakes like a duck, must be a duck. KraftDiner wrote: > Steven D'Aprano wrote: > > On Tue, 15 Aug 2006 19:35:11 -0700, KraftDiner wrote: > > > > > I have two classes: > > > >

Re: inheritance?

2006-08-16 Thread John Henry
> Here I tried this example and maybe this will explain the difficulties > I'm having. > 1) at the time the baseClass is constructed shouldn't the constructor > of the appropriate > type be called. Not automatically. > 2) getName is doing nothing... > > class baseClass: > def __init__(sel

Re: inheritance?

2006-08-16 Thread John Henry
Oops! Forgot to remove fromfile from baseClass. Wouldn't matter though. John Henry wrote: > > Here I tried this example and maybe this will explain the difficulties > > I'm having. > > 1) at the time the baseClass is constructed shouldn't the constructor &

Re: Find out the name of a variable passed as an argument

2006-10-04 Thread John Henry
Algol, anyone? Andreas Huesgen wrote: > Hello everybody, > > is there a way to receive the name of an object passed to a function > from within the function. > > something like > > def foo(param): > print theNameOfTheVariablePassedToParam > > var1 = "hello" > var2 = "world" > > >>> foo(var

Re: Need array help

2006-10-06 Thread John Henry
Others posted answer to your question. If you are serious about programming in Python, I highly recommend that you don't try to think in terms of "I did this in Visual Basic, how do I do this in Python". You'll end up with Python code that are nothing but a VB look alike. As recommended by oth

Re: Converting existing module/objects to threads

2006-10-18 Thread John Henry
Making your code run in thread mode isn't the hard part. Just add this: import threading class subcontrollerThread(threading.Thread, subcontroller): def __init__(self,id,configurationFile): threading.Thread.__init__(self) subcontroller.__init__(self,id,co

Re: python GUIs comparison (want)

2006-10-23 Thread John Henry
[EMAIL PROTECTED] wrote: > Now i began to learn GUI programming. There are so many > choices of GUI in the python world, wxPython, pyGTK, PyQT, > Tkinter, .etc, it's difficult for a novice to decide, however. > Can you draw a comparison among them on easy coding, pythonish design, > beautiful and

Dealing with multiple sets

2006-10-25 Thread John Henry
Hi list, If I have a bunch of sets: a = set((1, 2, 3)) b = set((2, 3)) c = set((1, 3)) What's the cleanest way to say: 1) Give me a list of the items that are in all of the sets? (3 in the above example) 2) Give me a list of the items that are not in all of the sets? (1,2 in the above exam

Re: Dealing with multiple sets

2006-10-25 Thread John Henry
Oops. Forgot to mention, I am still using 2.3. John Henry wrote: > Hi list, > > If I have a bunch of sets: > > a = set((1, 2, 3)) > b = set((2, 3)) > c = set((1, 3)) > > > What's the cleanest way to say: > > 1) Give me a list of the items that

Re: Dealing with multiple sets

2006-10-25 Thread John Henry
Aye! I did a: a and b and c Bonk! Thanks, Tim Peters wrote: > [John Henry] > > If I have a bunch of sets: > > > > a = set((1, 2, 3)) > > b = set((2, 3)) > > c = set((1, 3)) > > > > > > What's the cleanest way to say: > > >

Re: Dealing with multiple sets

2006-10-26 Thread John Henry
Oh, great. Learn something new everyday. For this, what I did was to build up a string, and then use eval on the string. Very ugly. Now I can simply do a reduce. Thanks, Brian Beck wrote: > John Henry wrote: > > What's the cleanest way to say: > > > > 1) Give m

Re: ANN: Leo 4.4.2.1 final released

2006-10-29 Thread John Henry
I downloaded the Windows exe, ran it and a small blank message window poped up and that was it. I am still running 2.3. Edward K. Ream wrote: > Leo 4.4.2.1 final is now available at: > http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 > > Leo 4.4.2.1 final fixes a recent

Re: scared about refrences...

2006-10-30 Thread John Henry
I am no Python guru - just an ordinary user. There is nothing "scary" about this. There are (many) situations where this is actually *desirable* but of course there are (many) situations where this is an unwelcomed side-effect. In situations where I don't want this to happen, I simply pass down

Re: ANN: Leo 4.4.2.1 final released

2006-10-31 Thread John Henry
Yes, it's Python 2.3, running under Windows XP. I managed to get it working using the ZIP file. Thanks, Edward K. Ream wrote: > >I downloaded the Windows exe, ran it and a small blank message window poped > >up and that was it. > > I am still running 2.3. > > I assume you mean Python 2.3, not Le

Re: ANN: Leo 4.4.2.1 final released

2006-10-31 Thread John Henry
Yes, it's Python 2.3, running under Windows XP. I managed to get it working using the ZIP file. Thanks, Edward K. Ream wrote: > >I downloaded the Windows exe, ran it and a small blank message window poped > >up and that was it. > > I am still running 2.3. > > I assume you mean Python 2.3, not Le

Re: python GUIs comparison (want)

2006-11-06 Thread John Henry
Yes, from a easy of use standpoint, I agree that PythonCard is very high on the list. Unfortunately there isn't more "activities" as one would like to see. On the other hand, that's typical of open-source projects. We can always roll up our sleeves and do it ourselves. At least the multicolumn

Re: adding python scripting to my application

2006-11-06 Thread John Henry
Take a look at: http://www.swig.org/ Julian wrote: > Hi, first of all, I have to say I am new to Python. I have been working > with a finite element analysis program written in c++. now, I am trying > to 'rebuild' this code (possibly a full re-write) with scripting > capability. I did some readin

Re: auto indent

2006-11-06 Thread John Henry
M.N.Smadi wrote: > Hi there; > > i have a script that is not indented properly. Is there a way that i can > have it auto indented. > > thanks > moe smadi It depends what exactly you mean. I use Textpad and they have an "indent selected block" feature. -- http://mail.python.org/mailman/listinfo

Re: shutil: permission denied errors on windows

2006-11-06 Thread John Henry
I use the copy function a lot and never have problem. I suggest that you write a no brainer standalone test code and if it still fails there, then you have a problem with your installation. Antoine De Groote wrote: > Google tells quite some things about it, but none of them are satisfactory. > >

Re: wing ide vs. komodo?

2006-11-06 Thread John Henry
"cool" is in the eyes of the beholder. While I agree that this can be useful in some situations, I find it very annoying when all I want (and need) to do is a simple dumber search and yet it tells me tons of useless searches that I don't care for. The inability to debug multi-threaded application

Re: shutil: permission denied errors on windows

2006-11-07 Thread John Henry
ther. It seems now > to be only the case for folders. A very simple > > shutil.copy('a', 'b') > > already fails with the error message. > > I reinstalled Python, but that didn't change anything... > > Regards, > antoine > > John Henry wrot

Re: Pyro stability

2006-11-07 Thread John Henry
Being a non-professional programmer, I've managed to use Pyro to do what I need to do with very minimal fuss. In fact, I don't even understand a lot of what's under the cover. All I did was to mimic what one of the sample program is doing and adapted it to my need. So far I am very happy with Py

Re: How to choose the right GUI toolkit ?

2006-11-08 Thread John Henry
John Salerno wrote: > Dan Lenski wrote: > > > So, is there another toolkit I should be looking at? > > I highly recommend wxPython. It's very mature, full-featured, and > portable, and fairly easy to learn as well. I can't really compare it to > other toolkits (not having used any of them, except

decorators

2006-11-08 Thread John Henry
I must be very thick. I keep reading about what decorators are and I still don't have a good feel about it. See, for example: http://alex.dojotoolkit.org/?p=564 What exactly do I use decorators for? -- http://mail.python.org/mailman/listinfo/python-list

decorators

2006-11-08 Thread John Henry
I must be very thick. I keep reading about what decorators are and I still don't have a good feel about it. See, for example: http://alex.dojotoolkit.org/?p=564 and: http://soiland.no/software/decorator What exactly do I use decorators for? -- http://mail.python.org/mailman/listinfo/python-

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread John Henry
Dan Lenski wrote: > > John H.: thanks for pointing out pythoncard. This looks like it might > be an excellent substitute for LabView-like GUIs, which all my > coworkers like. I personally refuse to read or write LabView code, on > the grounds that its syntax causes severe brain damage and is > c

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread John Henry
Steve Holden wrote: > > > You may find that it starts out fine, but becomes less satisfactory as > the sophistication of your interfaces increases. Then the problem will > be that migration to another platform demands a substantial rewrite of > your application (I have done this for a fairly sma

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread John Henry
Bill Maxwell wrote: > On 8 Nov 2006 11:49:07 -0800, "John Henry" <[EMAIL PROTECTED]> > wrote: > > > > >John Salerno wrote: > >> Dan Lenski wrote: > >> > >> > So, is there another toolkit I should be looking at? > >

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread John Henry
Upon closer look, the walkthrough did say: *** from PythonCard import model Change that so it says: from PythonCard import dialog, model Save the code. *** So, it works. John Henry wrote: > Bill Maxwell wrote: > > On 8 Nov 2006 11:49

Re: how is python not the same as java?

2006-11-09 Thread John Henry
gavino wrote: > both are interpreted oo langauges.. I remember the days when I got all excited about Java (many many moons ago when Java first came out). I brought a whole truckload of books on it, even spent 5 days attending a seminar on the subject. To my great disappointment, I never g

Re: How to choose the right GUI toolkit ?

2006-11-11 Thread John Henry
try: canvas.setFillColor('gray') except: pass and then ran it. Works! So, yes, you can do Notebook in Python. I believe what they are saying is that Notebook isn't supported fully (yet) in the resourceeditor. Bill Maxwell wrote: > On 9 Nov 2006

Re: How to choose the right GUI toolkit ?

2006-11-12 Thread John Henry
Nice example. Jussi Salmela wrote: > John Henry wrote: > > BTW: I did a search and found the testnotebook example from: > > > > http://prdownloads.sourceforge.net/pythoncard/testNotebook.zip?download > > > > and tried it out. There is one error in the widget

Re: Yield

2006-11-15 Thread John Henry
Thank you. This is very clear. I can see that this is useful in lots of situations. Fredrik Lundh wrote: > Mateuszk87 wrote: > > > may someone explain "yield" function, please. how does it actually work > > and when do you use it? > > it returns a value from a function without actually terminati

Re: About alternatives to Matlab

2006-11-16 Thread John Henry
Bill Gates will have you jailed! :-) On a more serious note, is there any alternative to Simulink though? sturlamolden wrote: >and is infinitely > more expensive. > > Does anyone wonder why I am not paying for Matlab maintenance anymore? > > Sorry Mathworks, I have used your product for years, bu

How fuzzy is get_close_matches() in difflib?

2006-11-16 Thread John Henry
I am just wondering what's with get_close_matches() in difflib. What's the magic? How fuzzy do I need to get in order to get a match? -- http://mail.python.org/mailman/listinfo/python-list

Re: How fuzzy is get_close_matches() in difflib?

2006-11-16 Thread John Henry
I did try them and I am impressed. It helped me found a lot of useful info. I just want to get a feel as to what constitutes a "match". Steven D'Aprano wrote: > On Thu, 16 Nov 2006 16:40:49 -0800, John Henry wrote: > > > I am just wondering what's with get_clo

Re: How fuzzy is get_close_matches() in difflib?

2006-11-16 Thread John Henry
for. I don't understand why "HIDESCT1" would not hit "HIDEDCT1" as a first choice. Steven D'Aprano wrote: > On Thu, 16 Nov 2006 20:19:50 -0800, John Henry wrote: > > > I did try them and I am impressed. It helped me found a lot of useful > > info.

Concatenating strings

2006-06-30 Thread John Henry
Sorry if this is a dumb question. I have a list of strings (some 10,000+) and I need to concatenate them together into one very long string. The obvious method would be, for example: alist=["ab","cd","ef",.,"zzz"] blist = "" for x in alist: blist += x But is there a cleaner and faster wa

Concatenating strings

2006-06-30 Thread John Henry
Sorry if this is a dumb question. I have a list of strings (some 10,000+) and I need to concatenate them together into one very long string. The obvious method would be, for example: alist=["ab","cd","ef",.,"zzz"] blist = "" for x in alist: blist += x But is there a cleaner and faster wa

Re: Building Python Based Web Application

2006-09-08 Thread John Henry
Hi folks. I am interested on this topic as well. If my application is not database related, what would be a good choice? I have clients that wish to use my Python applications but I am not willing to give them the code. So, I am thinking about setting it up as a web based application and let th

Re: Building Python Based Web Application

2006-09-09 Thread John Henry
Adam Jones wrote: > John Henry wrote: > > Hi folks. > > > > I am interested on this topic as well. > > > > If my application is not database related, what would be a good choice? > > > > I have clients that wish to use my Python applications but I am

Re: Help me use my Dual Core CPU!

2006-09-12 Thread John Henry
I don't know what CPython is but I have developed a Python application under Windows that utilize the Dure Core CPU when it's present. I don't know that I can say for sure that "threads won't help". Have you done some testing before using other approaches to see if it indeed won't help? Simon W

When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread John Henry
Hi list, Just to make sure I understand this. Since there is no "pointer" type in Python, I like to know how I do that. For instance, if I do: ...some_huge_list is a huge list... some_huge_list[0]=1 aref = some_huge_list aref[0]=0 print some_huge_list[0] we know that the answere

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread John Henry
print i and you get 1 printed. So, if I understand you correctly, I must make the reference to a more elaborate representation. Like: i=[1,] j=i j[0]=2 print i in order to get 2 printed. Correct? Steve Holden wrote: > John Henry wrote: > > Hi list, > > >

Re: When is it a pointer (aka reference) - when is it a copy?

2006-09-13 Thread John Henry
Thanks for the reply, Grant. I am not doing things like that - I am just trying to clear up in my mind the Python concepts. I understand it now. Grant Edwards wrote: > On 2006-09-13, John Henry <[EMAIL PROTECTED]> wrote: > > Thanks for the reply, both to Laszlo and Steve.

Re: windev vs python SOS

2006-09-27 Thread John Henry
I don't know what windev is but presonally, I found Python to be incredibly productive. BTW: I recommend that you look into PythonCard. It sits on top of wxpython and I found it to be a very productive GUI tool. stéphane bard wrote: > hello, my boss ask me to prefer windev to python. > I have to

Re: windev vs python SOS

2006-09-29 Thread John Henry
Why are they all look so gloomy? I don't see a single smile on their faces. :=) [EMAIL PROTECTED] wrote: > Hi, > > Bruno Desthuilliers a écrit : > > I've never met a programmer that "loved" Windev. > > I have met some here (I'm the guy with a mustache-just kidding but > actually I was there). >

Re: How fuzzy is get_close_matches() in difflib?

2006-11-17 Thread John Henry
;HIDE*DS*T1", I thought you have to remove 2 characters *SC* from the source. Then I realize that it's not true. If you remove the "C" from the source, and the "D" from the *DS* of the destination, it's a match (!) So, yes, they have the same distance! Antoo

Re: How fuzzy is get_close_matches() in difflib?

2006-11-17 Thread John Henry
Learn something new everyday. I always wondered how spell checkers are done. Thanks. John Machin wrote: > John Henry wrote: > > I am just wondering what's with get_close_matches() in difflib. What's > > the magic? How fuzzy do I need to get in order to get a match?

Re: How fuzzy is get_close_matches() in difflib?

2006-11-17 Thread John Henry
Steven D'Aprano wrote: > > >>> s = difflib.SequenceMatcher(None, "HIDEDCT1", "HIDESCT1") > >>> t = difflib.SequenceMatcher(None, "HIDEDST1", "HIDESCT1") > >>> > >>> for block in s.get_matching_blocks(): > ... print "a[%d] and b[%d] match for %d elements" % block > ... > a[0] and b[0] match f

Re: remove a list from a list

2006-11-17 Thread John Henry
from sets import Set as set # Python 2.3 b = list( set([i.upper() for i in b) - set([i.upper() for i in a] ) ) Rares Vernica wrote: > Yeah, I ended up doing a similar kind of loop. That is pretty messy. > > Is there any other way? > > Thanks, > Ray > > Tim Chase wrote: > >> That is a nice solu

Re: remove a list from a list

2006-11-17 Thread John Henry
Scratch that. b becomes all upper... John Henry wrote: > from sets import Set as set # Python 2.3 > > b = list( set([i.upper() for i in b) - set([i.upper() for i in a] ) ) > > > Rares Vernica wrote: > > Yeah, I ended up doing a similar kind of loop. That is pretty mes

Re: remove a list from a list

2006-11-17 Thread John Henry
The curve ball is the case insensitivity otherwise it's a straightforward set operation. I wonder if it's possible to sub-class set and make the item comparision case insensitive. Anybody knows how to do that? Tim Chase wrote: > > Yeah, I ended up doing a similar kind of loop. That is pretty m

Re: remove a list from a list

2006-11-17 Thread John Henry
= ["c", "a", "A", "D", "b"] b_dict = Convert2Dict(b) b = [b_dict.get(x) for x in list( set([x.upper() for x in b]) - set([x.upper() for x in a]) ) ] John Henry wrote: > Scratch that. b becomes all upper... > > John Henry wrote: > > fro

Re: About alternatives to Matlab

2006-11-17 Thread John Henry
Thanks for pointing that out. I wasn't aware of this. Will take a look. Sébastien Boisgérault wrote: > On Nov 16, 10:46 pm, "John Henry" <[EMAIL PROTECTED]> wrote: > > Bill Gates will have you jailed! :-) > > > > On a more serious note, is there any a

Re: Why isn't SPLIT splitting my strings

2006-11-19 Thread John Henry
Meaning: import re newString= re.split('[; ()\[\]", result) Nick Vatamaniuc wrote: > The regular string split does not take a _class_ of characters as the > separator, it only takes one separator. Your example suggests that you > expect that _any_ of the characters "; ()[]" could be a separato

Re: Why isn't SPLIT splitting my strings

2006-11-19 Thread John Henry
Oops! newString= re.split("[; ()\[\]", result) John Henry wrote: > Meaning: > > import re > > newString= re.split('[; ()\[\]", result) > > > > Nick Vatamaniuc wrote: > > The regular string split does not take a _class_ of characters as the >

Re: Why isn't SPLIT splitting my strings

2006-11-19 Thread John Henry
Fredrik Lundh wrote: > John Henry wrote: > > > Oops! > > for cases like this, writing > > "[" + re.escape(charset) + "]" > So, like this? newString= re.split("[" + re.escape("; ()[]") + "]", result) &

Looking for a graph (as in network, nodes) package

2006-11-19 Thread John Henry
I am looking for a ready made simple graph package. I found an extensive one in the piana package but when I try to use just the graph portion, it fails to load because of the line: class Graph(object): ... It seems that their Graph is subclassed from "object" but I couldn't find a "object" cl

case insensitive dictionary

2006-11-25 Thread John Henry
I believe the standard dictionary should be amened to allow the use of case insensitive keys - as an option. I found some work done by others to do that at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/283455 but the problem with that approach is that they lowercase the keys immediate

Re: case insensitive dictionary

2006-11-26 Thread John Henry
I don't think that's sufficient. See how many methods the author of http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/283455 had to redefine. Rob Williscroft wrote: > John Henry wrote in news:1164494606.514366.124810 > @l39g2000cwd.googlegroups.com in comp.lang.python: >

Re: case insensitive dictionary

2006-11-27 Thread John Henry
I believe that if you redefine the value, the key should not change. So, yes, I would expect that they value of the key to remain as they were. J. Clifford Dyer wrote: > John Henry wrote: > >print pets.keys() > > > > should print: > > > > "Cat", &

Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
If I have a list of say, 10 elements and I need to slice it into irregular size list, I would have to create a bunch of temporary variables and then regroup them afterwords, like: # Just for illustration. Alist can be any existing 10 element list a_list=("",)*10 (a,b,c1,c2,c3,d1,d2,d3,d4,d5)=a_lis

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
Well, pardoon me. Next. Thomas Ploch wrote: > John Henry schrieb: > > If I have a list of say, 10 elements and I need to slice it into > > irregular size list, I would have to create a bunch of temporary > > variables and then regroup them afterwords, like: > > > &g

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
[EMAIL PROTECTED] wrote: > John Henry wrote: > > Can I say something to the effect of: > > > > (a,b,c[0:2],d[0:5])=a_list# Obviously this won't work > > Your best bet is probably: > > x = [...some list...] > a,b,c,d = x[:1],x[1:2],x[2:5],x[5:] >

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
Paul McGuire wrote: > "Paul McGuire" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > "John Henry" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > snip > > G... that's what I get for no

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
John Henry wrote: > Paul McGuire wrote: > > "Paul McGuire" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > "John Henry" <[EMAIL PROTECTED]> wrote in message > > > news:[EMAIL PROTECTED] > > snip &g

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
John Henry wrote: > > Further, if splitUp is a sub-class of string, then I can do: > > alist, blist, clist, dlist = "ABCDEFGHIJ".slice((1,1,3,None)) > > Now, can I override the slice operator? Maybe like: alist, blist, clist, dlist = newStr("ABCDEFGHIJ&quo

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
Thomas Ploch wrote: > > I had a little bit of fun while writing this: > > itemList = (a,b,c1,c2,c3,d1,d2,d3,d4,d5) and > itemList2 = (a1,a2,a3,b,c,d1,d2,d3,d4,d5) the next time. > Huh? What's a,b,d5? > def getSlices(aCount, bCount, cCount, dCount, items): > a,b,c,d = (items[0:aCount],

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
Thomas Ploch wrote: > > John Henry schrieb: > > > Thomas Ploch wrote: > > > > >> >> I had a little bit of fun while writing this: > >> >> > >> >> itemList = (a,b,c1,c2,c3,d1,d2,d3,d4,d5) and > >> >> itemList2

Re: Is there an easier way to express this list slicing?

2006-11-30 Thread John Henry
Paul McGuire wrote: > "John Henry" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > John Henry wrote: > > > >> > >> Further, if splitUp is a sub-class of string, then I can do: > >> > >> alist,

Re: Is python memory shared between theads?

2006-12-01 Thread John Henry
Wesley Henwood wrote: > So I declare a variable named A in thread1, in script1.py. I assign > the value of 2.5 to A. I then run script2.py in thread2. Script2.py > assigns the value of 5.5 to a variable named A. Now, when thread1 > resums execution, I see that A = 5.5, rather than 2.5 as I exp

  1   2   >