Re: Show current ip on Linux

2005-06-13 Thread James Tanis
hroot and i can kill those processes ) # ( * klieber claps for zhen oh go die ) # - #o \___ # v__v o \ O ) # (OO) ||w | # (__) || || \/\ # # -- # http://mail.pyth

Re: Tiff Image Reader/writer

2005-06-13 Thread James Carroll
What sort of things do you want to do with the TIFFs? How heavy-weight or light-weight are you interested in? For heavy-weight there are: - wxPython will do a bunch of tiff reading, and some image processing http://www.wxpython.org - GDAL >(quoting Khalid Zuberi:) >GDAL supports GeoTIFF and inc

Re: Tiff Image Reader/writer

2005-06-14 Thread James Carroll
Hmm... that's unfortunate. What platform are you on? If Windows, then I believe that PIL is statically linked against LibTIFF and that particular libtiff wasn't compiled with certain options (CCITT formats or something.) (in 1999 that was true, I found a post from Fred here: http://mail.python.o

Re: collect data using threads

2005-06-14 Thread James Tanis
.. # # # Jeremy Jones # I may be wrong here, but shouldn't you just use a stack, or in other words, use the list as a stack and just pop the data off the top. I believe there is a method pop() already supplied for you. Since you wouldn't require an self.data = [] this should allow you to safely remove the data you've already seen without accidentally removing data that may have been added in the mean time. --- James Tanis [EMAIL PROTECTED] http://pycoder.org -- http://mail.python.org/mailman/listinfo/python-list

Re: collect data using threads

2005-06-14 Thread James Tanis
Previously, on Jun 14, Peter Hansen said: # James Tanis wrote: # > I may be wrong here, but shouldn't you just use a stack, or in other # > words, use the list as a stack and just pop the data off the top. I # > believe there is a method pop() already supplied for you. # #

Re: dynamic

2005-06-15 Thread James Carroll
Returning instances of some other class is not so horrible. They're called FactoryMethods usually. An example is when you have a polymorphic tree of image file reader objects, and you open an image file, it might return a JpegReader which ISA ImageReader or a TIFFReader which also ISA ImageReader

Re: Tiff Image Reader/writer

2005-06-15 Thread James Carroll
What do you mean by decode the pixels? If there's some image processing that needs to be done, or if you want to view, brighten, or print or something, then there are ways of doing it that will be as fast as can be. If stepping through the pixels to do your own math is what you want, then maybe

Re: dynamic

2005-06-16 Thread James Carroll
Oh, I see. Yeah, having the code look like you're instantiating one class, but really getting a different one is really horrible. Sorry I didn't catch on to the subtlety. I'm always complaining about code that looks like it does one thing, but really does another. -Jim On 15 Jun 2005 22:24:28

Re: Tiff Image Reader/writer

2005-06-16 Thread James Carroll
I did a test with wxPython 2.6.1 on Windows. I created a G4 TIFF image that was 4400 x 3599 big, and the following code took under a half second. import wx import time def readImage(filename): img = wx.Image(filename) w = img.GetWidth() h = img.GetHeight() value = img.GetGreen(w

Re: Python Pop Quiz

2007-06-02 Thread James Stroud
[EMAIL PROTECTED] wrote: > Essay: "C++ is better than C", agree or disagree? (four word maximum) disagree: too many pluses. -- http://mail.python.org/mailman/listinfo/python-list

Determinant of Large Matrix

2007-06-06 Thread James Stroud
rix? Is there a python package that could help me? Many thanks for any answers. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Determinant of Large Matrix

2007-06-06 Thread James Stroud
, 12048175104.23, 12048175103.81, 12048175103.98, 12048175103.9]) How could this be? This holds for 10 trials or 10 trials. Below is the output from the above runs. Is this a problem with the rng? All of these matrices look different. I'm certain this can't happen by ch

Re: Determinant of Large Matrix

2007-06-06 Thread James Stroud
Steven D'Aprano wrote: [Valuable Response] Thank you Steven for your helpful comments. Please see my reply to Bjoern Schliessmann where I have restated my problem. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Determinant of Large Matrix

2007-06-06 Thread James Stroud
James Stroud wrote: [pointless stuff] OK. Nevermind. I'm rebinding encodings and so taking a sample from the sample and thus getting the sample back. Terribly sorry. James -- http://mail.python.org/mailman/listinfo/python-list

Re: “On Your Desktop”: the celebr ity posting editorial blog

2007-06-07 Thread James Stroud
Steve Holden wrote: > The first post comes from Ian Bicking: > > http://onyourdesktop.blogspot.com/ > "Linux was a remote possibility: just why is it so bad as a laptop OS?" I'm a diehard os x man myself, but I spent about 1.5 days setting up ubuntu feisty on an Acer Travel Mate TM2480-2779 ($4

Re: Tkinter custom drawing

2007-06-07 Thread James Stroud
se draw methods, but such thing doesn't exist (as far as I could > search in this community's posts). > > Anyone have a clue ? > > Thanks, > Xavier Berard > Are you sure you are spelling it right? The C is not capitalized: from Tkinter import Invisiblecanvas etc. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter custom drawing

2007-06-08 Thread James Stroud
Xavier Bérard wrote: >>from Tkinter import Invisiblecanvas > > > ? > > The whole web never mentions this Invisiblecanvas. > Do you have anything alike to share ? ;) > > Xavier > I figured that if you were sincere, you'd call me on this one. -- http://mail.python.org/mailman/listinfo/python-

Re: Tkinter custom drawing

2007-06-08 Thread James Stroud
.update_idletasks() def test(): tk = Tk() b = Button(tk, text='Button') b.pack() c = Button(tk, text='Another Button') c.pack() x = Label(tk, text='Drag Me', relief=RIDGE, border=1) register(x) x.pack() tk.geometry('200x200') tk.mainloop() if __name__ == "__main__": test() James -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-09 Thread James Stroud
as described in the tail recursion Wikipedia entry? Under what circumstances can one count on the python interpreter recognizing the possibility for optimized tail recursion? James = Disclaimer: Mention of more than one programming language in post does not imply author's desire

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-09 Thread James Stroud
Kay Schluehr wrote: > On Jun 9, 12:16 pm, James Stroud <[EMAIL PROTECTED]> wrote: >> Terry Reedy wrote: >>> In Python, you have a choice of recursion (normal or tail) >> Please explain this. I remember reading on this newsgroup that an >> advantage of rub

Seattle Python Interest Group meeting 7 PM Thursday

2007-06-09 Thread James Thiele
Seattle Python Interest Group meeting 7 PM Thursday 14 June 2007. See http://www,seapig.org for location and directions. -- http://mail.python.org/mailman/listinfo/python-list

Re: Seattle Python Interest Group meeting 7 PM Thursday

2007-06-09 Thread James Thiele
On Jun 9, 8:35 pm, James Thiele <[EMAIL PROTECTED]> wrote: > Seattle Python Interest Group meeting 7 PM Thursday 14 June 2007. > > Seehttp://www,seapig.orgfor location and directions. Ooops! http://www.seapig.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Link Dictionary

2007-06-11 Thread James Stroud
27;5', 'E5': '0', 'I5': '1', 'C9': '0', 'G9': '0', > 'G8': '0', 'A1': '0', 'A3': '3', 'A2': '0', 'A5': '2', 'A4': '0', > 'A7': '6', 'A6': '0', 'C3': '1', 'C2': '0', 'C1': '0', 'E6': '0', > 'C7': '4', 'C6': '6', 'C5': '0', 'C4': '8', 'I9': '0', 'D8': '0', > 'I8': '0', 'E4': '0', 'D9': '0', 'H8': '0', 'F6': '8', 'A9': '0', > 'G4': '6', 'A8': '0', 'E7': '0', 'E3': '0', 'F1': '0', 'F2': '0', > 'F3': '6', 'F4': '7', 'F5': '0', 'E2': '0', 'F7': '2', 'F8': '0', > 'D2': '0', 'H1': '8', 'H6': '3', 'H2': '0', 'H4': '2', 'D3': '8', > 'B4': '3', 'B5': '0', 'B6': '5', 'B7': '0', 'E9': '8', 'B1': '9', > 'B2': '0', 'B3': '0', 'D6': '2', 'D7': '9', 'D4': '1', 'D5': '0', > 'B8': '0', 'B9': '1', 'D1': '0'} > > Now I want to create a dict which would have both the keys and values > to be of the corresponding values of dict2. > > Something like this: > > Eg. The first key in dict1 i.e. B8 as 0 (0 is the value of B8 in > dict2) mapped as set(['0','0','0',...]). > > Can anyone help me out with this. > - > Anush > new_dict = {} for akey, aset in dict1.items(): new_dict[akey] = sum(int(dict2[k]) for k in aset) James -- http://mail.python.org/mailman/listinfo/python-list

Re: userinteraction for a webspider

2007-06-11 Thread James Stroud
t; I had the idea of the script relaying the page to localhost but i > thought there might be an easier way... > > Thanks for your help > > Chris There are sweatshops in developing countries that provide this service. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Link Dictionary

2007-06-11 Thread James Stroud
anush shetty wrote: > On Jun 12, 2:10 am, James Stroud <[EMAIL PROTECTED]> wrote: > >>anush shetty wrote: >> >>>Hi, >>>I have two dictionaries >> >>> dict1={'B8': set(['I8', 'H8', 'B2', 'B7

Re: Properties for modules?

2007-06-11 Thread James Stroud
duleFoo.py def get_setting(self, name): return do_whatever(name) def set_setting(self, name, arg): return do_whatever_else(name, arg) class Foo(object): someSetting = property(set_setting, get_setting) foo = Foo() # program.py from moduleFoo import foo foo.someSetting = some_value

Re: Properties for modules?

2007-06-11 Thread James Stroud
James Stroud wrote: > # moduleFoo.py > > def get_setting(self, name): > return do_whatever(name) > > def set_setting(self, name, arg): > return do_whatever_else(name, arg) > > class Foo(object): > someSetting = property(set_setting, get_setting) >

Re: A gotcha: Python pain point?

2007-06-11 Thread James Stroud
atable if perhaps every i used in the loop shouldn't > be a different i. It had me fooled, anyways. > > Rgds, > Bjorn > If this isn't classified as a bug, then someone has some serious explaining to do. Why would it be desirable for a generator to behave differently in two

Re: Python Help!!!

2007-06-11 Thread James Stroud
o, your subject line should be more specific with respect to your actual question. James -- http://mail.python.org/mailman/listinfo/python-list

one-time initialization of class members

2007-06-13 Thread James Turk
Hi, I have a situation where I have some class members that should only be done once. Essentially my problem looks like this: class Base(object): dataset = None def __init__(self, param): if type(self).dataset is None: # code to load dataset based on param, expensive

Re: one-time initialization of class members

2007-06-13 Thread James Turk
On Jun 13, 6:54 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > James Turk wrote: > > Hi, > > > I have a situation where I have some class members that should only be > > done once. Essentially my problem looks like this: > > > class Base(object): > &

Re: one-time initialization of class members

2007-06-13 Thread James Turk
On Jun 13, 8:00 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > James Turk wrote: > > Hi, > > > I have a situation where I have some class members that should only be > > done once. Essentially my problem looks like this: > > > class Base(object): > >

Re: one-time initialization of class members

2007-06-13 Thread James Turk
On Jun 13, 9:03 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 13 Jun 2007 23:55:02 +, James Turk wrote: > > On Jun 13, 6:54 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > >> James Turk wrote: > >> > Hi, > > >> > I have a

Re: one-time initialization of class members

2007-06-14 Thread James Turk
On Jun 13, 11:42 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > James Turk wrote: > > It actually occured to me that I could use a @classmethod to do the > > loading and take that out of the BaseClass constructor. What I have > > makes more sense and eliminates

Portable general timestamp format, not 2038-limited

2007-06-22 Thread James Harris
unter could tick about 5 hours into the next day if not caught. Any thoughts on a better way to do this? (Please reply-all. Thanks). -- James -- http://mail.python.org/mailman/listinfo/python-list

Re: newb: Scope Question

2007-06-22 Thread James Stroud
7;' > for r in res['key']: > ids = str(r['id']).join(',') > > print("ids: %s" %(ids)) > 1. You do not need to "initialize" ids. 2. It looks as if res['key'] is

Re: Adding method to a class on the fly

2007-06-22 Thread James Stroud
7stud wrote: > On Jun 22, 3:23 pm, askel <[EMAIL PROTECTED]> wrote: > >>sorry, of course last line should be: >>Dummy().method2('Hello, world!') > > > ..which doesn't meet the op's requirements. > Which were contradictory. -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding method to a class on the fly

2007-06-22 Thread James Stroud
gt; Dummy.real_static() aaa bbb Again, this will do what you want, but if it doesn't do *exactly* what you want, you need to study and modify the code. Also, creating static methods from unbound methods requires trickery. If this is what you want, you should be very clear about it. > and see "it's me" printed. > > Can that be done? Yes. Anything is possible with python. That's why I use it. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Portable general timestamp format, not 2038-limited

2007-06-23 Thread James Harris
On 22 Jun, 23:49, Roger Miller <[EMAIL PROTECTED]> wrote: ... > My rule of thumb in situations like this is "When in doubt store it as > text". The one format I am pretty sure we will still be able to deal > with in 2039. Interesting. I hadn't thought about using text. It would add to the storage

Re: Python changing keywords name

2007-06-23 Thread James Stroud
. >>> splodnik 'This is a splodnik statement.' This is a splodnik statement. You will also want to change every instance of the word "print" in every .py file to "splodnik" in the pythonsource before building, so that you won't break your s

Re: Accessing variable from a function within a function

2007-06-24 Thread James Stroud
else: print a1,a,b1,b,c,d,q,r t = b1 b = t - q * b a = t - q * a c,d,a1,b1 = d,r,a,b return euclid(c,d) return euclid(c,d) James -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing variable from a function within a function

2007-06-24 Thread James Stroud
James Stroud wrote: > Nathan Harmston wrote: > def exteuclid(m,n): > x = 0,1,1,0,m,n > def euclid(c,d,x=x): >a,a1,b,b1,c,d = x >q = c /d >r = c % d >if r == 0: >print a,b >return d >else: >

Re: Portable general timestamp format, not 2038-limited

2007-06-25 Thread James Harris
On 25 Jun, 02:14, [EMAIL PROTECTED] (Robert Maas, see http://tinyurl.com/uh3t) wrote: > > From: James Harris <[EMAIL PROTECTED]> > > I have a requirement to store timestamps in a database. ... > > 1) subsecond resolution - milliseconds or, preferably, more detailed >

Re: Internals and complexity of types, containers and algorithms

2007-06-25 Thread James Stroud
tionary to represent a chess board: board = ((c,r) for r in xrange(1, 9) for c in 'abcdefgh') starting = 'RNBQKBNR' + 'P' * 8 + ' ' * 32 + 'p' * 8 + 'rnbqkbnr' position = dict(zip(board, starting)) Of course we see here the chief problem

logging anomaly

2007-06-26 Thread Jesse James
I have some fairly simply code in a turbogears controller that uploads files. In this code, I inserted a 'start uploading' and a 'done uploading' log record like this: logger.info('- start uploading file: '+Filename) # copy file to specified location. while 1:

Re: Voluntary Abstract Base Classes

2007-06-29 Thread James Stroud
e-like is more formalized and transparent than the attribute checking done in is_slice_like and is far more flexible than explicit type checking. The concept seems to be borrowed from Java interfaces. But I'm ready to be corrected on my interpretation. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Portable general timestamp format, not 2038-limited

2007-07-04 Thread James Harris
On 1 Jul, 15:11, "Peter J. Holzer" <[EMAIL PROTECTED]> wrote: ... > Stick to unix timestamps but store them as a double precision floating > point number. The 53 bit mantissa gives you currently a resolution of > about 200 ns, slowly deteriorating (you will hit ms resolution in about > 280,000 year

Re: Portable general timestamp format, not 2038-limited

2007-07-04 Thread James Harris
On 3 Jul, 06:12, Scott David Daniels <[EMAIL PROTECTED]> wrote: ... > Inspired format: > Days since a some standard date (the TAI date may be a good such > date) expressed as fixed point 64-bit (32-bit day part, 32-bit > day-fraction part) or floating point (using Intel's double-precision, > f

Re: Portable general timestamp format, not 2038-limited

2007-07-04 Thread James Harris
On 4 Jul, 22:18, "Peter J. Holzer" <[EMAIL PROTECTED]> wrote: ... > But it really doesn't matter much. If you ignore leap seconds, using > days instead of seconds is just a constant factor (in fact, the unix > timestamp ignores leap seconds, too, so it's always a constant factor). > You can't repre

Re: Portable general timestamp format, not 2038-limited

2007-07-05 Thread James Harris
On 5 Jul, 02:53, greg <[EMAIL PROTECTED]> wrote: > James Harris wrote: > > With that the time would range to +/- 9000 > > quintillion years (18 digits) > > Use the Big Bang as the epoch, and you won't have > to worry about negative timestamps. Good idea if

Re: Portable general timestamp format, not 2038-limited

2007-07-05 Thread James Harris
On 5 Jul, 08:46, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 04 Jul 2007 22:12:46 -0400, Roy Smith <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > > Astronomers use Julian Date (http://en.wikipedia.org/wiki/Julian_date) for > > calculations like this. It's a widel

Debugger

2007-07-05 Thread James Matthews
Can anyone please tell me of a good debugger that can debug threads. My issue is that i have a program that is crashing only under certain threads but others are fine. And when i do it without threads it runs fine! -- http://www.goldwatches.com/watches.asp?Brand=14 http://www.jewelerslounge.com -

Changing the user-agent in urllib

2007-07-08 Thread James Matthews
Is there anyway of changing the user-agent in urllib without sub classing it? -- http://www.goldwatches.com/watches.asp?Brand=14 http://www.jewelerslounge.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Pydev 1.3.7 Released

2007-07-09 Thread James Matthews
I just downlaoded the old one! On 7/9/07, Fabio Zadrozny <[EMAIL PROTECTED]> wrote: Hi All, Pydev and Pydev Extensions 1.3.7 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com

Re: Choosing Tkinter over wxPython...

2007-07-09 Thread James Matthews
Sorry i am a wxpython person! TKinter wouldn't work for me so i moved to wxPython. However try pyQT or pyGTK both seem to be good toolkits and have large user bases On 7/9/07, Kevin Walzer <[EMAIL PROTECTED]> wrote: I've spent some time playing with both, and while wxPython is nice, Tkinter jus

Re: Where does str class represent its data?

2007-07-11 Thread James Stroud
tring py> class MyClass(UserString): ... def __init__(self, astr): ... self.data = self.clean(astr) ... def clean(self, astr): ... return astr.replace('m', 'f') ... py> MyClass('mail') 'fail' py> type(_) This class is much slower than st

Re: Where does str class represent its data?

2007-07-12 Thread James Stroud
[EMAIL PROTECTED] wrote: > On Jul 11, 9:49 pm, James Stroud <[EMAIL PROTECTED]> wrote: >>The "flat is better than nested" philosophy suggests that clean should >>be module level and you should initialize a MyString like such: >> >> m = MyString(clea

Re: Where does str class represent its data?

2007-07-12 Thread James Stroud
es or its subclasses make no sense because str is immutable. You may or may not want a history (I just made up this use case), but hopefully you see the utility in using regular classes for complex behavior instead of forcing an immutable built in type to do magic. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Pass by reference or by value?

2007-07-13 Thread James Stroud
ish to work with "copies", in that when I pass in an > integer variable into a function, I want the function to be modifying > a COPY, not the reference. Is this possible? > > Thanks. > Not only is this possible, that is actually what happens with ints! -- James Stro

Re: Pass by reference or by value?

2007-07-13 Thread James Stroud
ue) ... def __init__(self, v): ... self.value = v ... py> c = C(4) py> c 4 py> def doit(v): ... v.value = v.value * 2 ... py> doit(c) py> c 8 James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.co

Re: Pass by reference or by value?

2007-07-13 Thread James Stroud
Erik Max Francis wrote: > James Stroud wrote: > >> Robert Dailey wrote: >> >>> I noticed in Python all function parameters seem to be passed by >>> reference. This means that when I modify the value of a variable of a >>> function, the value of

Re: interactive graphical script builder

2007-07-13 Thread James Stroud
this type of thing for working with molecular models. I'm not sure how the code is liscensed. -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Can a low-level programmer learn OOP?

2007-07-14 Thread James Stroud
k behavior. If you just want to enter some values and set some flags and then hit "go", you could always program the GUI in HTML and have a cgi script process the result. This has a lot of benefits that are frequently overlooked but tend to be less fun than using a bona-fi

Re: Python and Tkinter Primer/Tutorial?

2007-07-16 Thread James Stroud
W. Watson wrote: > Thanks for the tips to the posters above. Wow, the Grayson book is $98 > on Amazon. I think I'll see if I can get a library loan! Its an ebook for $25.00: http://www.manning.com/grayson/ James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box

Re: Break up list into groups

2007-07-16 Thread James Stroud
roupby): py> from itertools import groupby py> alist = [0xF0, 1, 2, 3, 0xF0, 4, 5, 6, ... 0xF1, 7, 8, 0xF2, 9, 10, 11, 12, 13, ... 0xF0, 14, 0xF1, 15] py> def doit(alist): ... i = (list(g) for k,g in groupby(alist, lambda x: 0xf0&x)) ... return [k for k in [j + i

Re: Break up list into groups

2007-07-16 Thread James Stroud
James Stroud wrote: > Here's how I *would* do it: > > py> def doit(alist): > ... ary = [] > ... for i in alist: > ... if 0xf0 & i: > ... ary.append([i]) > ... else: > ... ary[-1].append(i) > ... return [x for x in ary if x] &

Re: Break up list into groups

2007-07-16 Thread James Stroud
fastest python way as it bypasses a lot of lookup, etc. Here's the output from the script below (doit2 => groupby way): doit 11.96 usec/pass doit2 87.14 usec/pass James # timer script from itertools import groupby from timeit import Timer alist = [0xF0, 1, 2, 3, 0xF0, 4, 5, 6,

Re: How to organize control access to source code ?

2007-07-17 Thread James Stroud
t their implementation. PHBs can then use threats of shooting, stabbing, slips-of-paper-strongly-worded-with-copies-to-upper-management, pointing-and-laughing, or sometimes even plain-ole permissions settings to make sure no one else peeks at anyone else's code. Catbert will mediate negotiations with the union. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Design question regarding exceptions.

2007-07-17 Thread James Stroud
Arcadio > I don't think its wise to mask or otherwise waste cpu cycles catching and re-throwing lower level exceptions. If you anticipate problems with certain inputs, test for those possibilities and raise custom exceptions at module level. At package level, you can import a modul

Re: wxPython and threads

2007-07-18 Thread James Matthews
Sounds like a race condition. is List Ctrl waiting for the gui to return? Maybe make the processing more then one thread! On 7/17/07, Stef Mientki <[EMAIL PROTECTED]> wrote: Benjamin wrote: > I'm writing a search engine in Python with wxPython as the GUI. I have > the actual searching preformed

Re: Property Descriptor - Public Getter, Private Setter

2007-07-18 Thread James Stroud
s property is read-only for users of the API. Have a Nice Day. """ def __init__(self): self._value = None def get_value(self): return self._value value = property(get_value) James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los A

Re: Exiting from python shell

2007-07-18 Thread James Stroud
ts and would likely result in the reversal of the Second Law of Thermodynamics, wherein your refrigerator would end up heating its contents and milk would spontaneously spoil, among other anomalies. For these reasons, you might propose a "quit" keyword. James -- James Stroud UCLA-DOE Ins

Re: Exiting from python shell

2007-07-18 Thread James Matthews
try raise SystemExit On 7/18/07, Mark Elston <[EMAIL PROTECTED]> wrote: * James Stroud wrote (on 7/18/2007 4:27 PM): > Tobiah wrote: >> For years now, I've been exiting the shell by typing 'exit\n', >> being chid by the shell, and then typing ^D. I can'

Re: Copy List

2007-07-19 Thread James Matthews
A slice still has some references to the old objects a deep copy is a totally new object! On 19 Jul 2007 17:04:00 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: On Thu, 19 Jul 2007 09:21:54 -0700, Falcolas wrote: > On Jul 18, 6:56 am, "Rustom Mody" <[EMAIL PROTECTED]> wrote: >> This

Re: Posted messages not appearing in this group

2007-07-19 Thread James Matthews
I am also having some issues. There is a post on the list that appeared 7 times because of this issue i think. On 7/19/07, David H Wild <[EMAIL PROTECTED]> wrote: In article <[EMAIL PROTECTED]>, Adrian Petrescu <[EMAIL PROTECTED]> wrote: > Maybe it has shown up and Google simply isn't showin

Re: wxPython, searching, and threads

2007-07-19 Thread James Matthews
I have seen this thread for a while and i do not see it on the wxpython list so i am posting it there now and will post a reply if i still see this later! James On 7/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: On Jul 18, 3:15 pm, Benjamin <[EMAIL PROTECTED]> wrote: &

Re: class C: vs class C(object):

2007-07-19 Thread James Stroud
lue) ... >>> broke = Old() >>> broke.value 'broke' >>> broke.value = 'still broke' >>> broke.value 'still broke' >>> >>> works = New() >>> works.value 'works' >>> works.v

Re: Trying to choose between python and java

2007-07-20 Thread James Matthews
You can always use jython. ;) On 7/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: On Sun, 15 Jul 2007 at 22:28:08 -0700, Alex Martelli wrote: > James T. Dennis <[EMAIL PROTECTED]> wrote: >... > > You can start writing all your code now as: print() --- calling

Python Flagged as a Virus by AVG

2007-07-20 Thread James Matthews
I was reading a Microsoft news group and came across this post Got this during a scan of my computer: infected: object C:\hp\bin\python-2.2.3.exe:\comparisons.html result: trojan horse PHP/MPack.B status: infected embedded object inefected: object C:\hp\bin\python-2.2.3.exe What can/should

Re: Do other Python GUI toolkits require this?

2007-04-18 Thread James Stroud
have to interact with the Objective C runtime to manage memory. This is not required, thankfully, with any other GUI tookits I've seen. I think the main difference is that PyObjC is not a GUI toolkit per se, but is simply a means to make the Objective C runtime (and hence Cocoa) availa

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread James Stroud
[EMAIL PROTECTED] wrote: > On Apr 20, 4:37 pm, John Machin <[EMAIL PROTECTED]> wrote: > >>One inessential but very useful thing about tuples when you have a lot >>of them is that they are allocated the minimum possible amount of >>memory. OTOH lists are created with some slack so that appending et

Re: lambda generator - curious behavior in 2.5

2007-04-21 Thread James Stroud
opIteration > >>> Seems like a bug: py> def doit(): ((yield 1), (yield 2), (yield 3)) ... py> x = doit() py> x.next() 1 py> x.next() 2 py> x.next() 3 py> x.next() Traceback (most recent call last): File "", line 1, in James -- http://mail.python.org/mailman/listinfo/python-list

Re: TK-grid problem, please help

2007-04-21 Thread James Stroud
0) frame2.pack() button2=Button(frame2, text='exit', command=root.quit) button2.pack() frame3=Frame(root, width=150, height=300) # adding an attribute here frame3.rows = [] frame3.pack() root.mainloop() #END# Notice also the necessity for the "e.delete(0, END)" line to get the desired text in the entries. Also demonstrated is how to handle poor input. *Note* Remember to always call the user "Fool" when he does something stupid. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Widget to read in user input box in blog

2007-04-23 Thread James Stroud
LED textout.pack(expand=NO, fill=BOTH) textin.bind('', dobind(textin, textout)) tk.mainloop() if __name__ == "__main__": main() Etc. includes copy and paste events with mouse. James -- http://mail.python.org/mailman/listinfo/python-list

Re: *** Watch BOMBSHELL video of Senator John Kerry admitting 911 was in INSIDE JOB ???

2007-04-24 Thread James Stroud
Andy wrote: > On 23 Apr 2007 21:12:45 -0700, [EMAIL PROTECTED] wrote: > >> http://www.911blogger.com/node/8053 >> >> Senator John Kerry was questioned concerning 9/11 during an appearance >> at Book People in Austin, Texas. Members of Austin 9/11 Truth Now >> asked Kerry about the officially unexp

Python Screen Scraper

2007-04-24 Thread James Stroud
dvice. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Do other Python GUI toolkits require this?

2007-04-24 Thread James Stroud
Bruno Desthuilliers wrote: > Kevin Walzer a écrit : > (snip) > >> Thanks to all for an illuminating thread on the mathematical >> implications of "learning curve" and other aspects. This thread has >> wandered pretty far from my original question (above) > > > Noticed this too ?-) I would ha

Re: gotcha or bug? random state reset on irrelevant import

2007-04-24 Thread James Stroud
Alan Isaac wrote: > Running test.py will print False. > Is this expected/desirable? > Thanks, > Alan Isaac > > > %%% test.py %%% > from random import seed, getstate > seed(217) > x = getstate() > from test2 import Trivial > y = getstate() > print x == y > > > % test2.py %%

Re: Python Screen Scraper

2007-04-24 Thread James Stroud
James Stroud wrote: > Hello, > > Does anyone know of an example, however modest, of a screenscraper > authored in python? I am using Firefox. > > Basically, I am answering problems via my browser and being scored for > each problem. I have a tendency to go past

Re: TK-grid problem, please help

2007-04-24 Thread James Stroud
en updated. It is probably the most relevant book for making a complete transition from novice python programmer to expert python programmer. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Controlling gnuplot via subprocess.Popen

2007-04-25 Thread James Stroud
;python %s" % thing_im_working_on will yield lucrative results that far exceed anything you can create in a reasonable amount of time. For example, "python gnuplot" first hit is: http://gnuplot-py.sourceforge.net/ And speaking from experience, it works beautifully. James -- http://mail.python.org/mailman/listinfo/python-list

Re: My python annoyances so far

2007-04-25 Thread James Stroud
Thing.doit(object()) Param is "param". py> def doit(athing, param): ... print 'Param is "%s".' % param ... py> class Thing(object): ... doit = doit ... py> t = Thing() py> t.doit(4) Param is "4". If your latter misunderstanding is about the lack of

Re: Where did my post go?

2007-04-25 Thread James Stroud
[EMAIL PROTECTED] wrote: > I posted to this newsgroup earlier about my annoyances with python and > now I can't find the post. What did you do with it? > I guess it depends on your server. Here at UCLA, we still see it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Video: Professor of Physics, Phd at Cal Tech says: 911 Inside Job

2007-04-26 Thread James Stroud
ow about it? Check out this video: http://video.google.com/videoplay?docid=4026073566596731782 One hour of your life--its worth that to consider alternate hypotheses. You may have to wade through some preliminary melodrama, but watch it for the whole hour. You'll be happy you did.

Re: My python annoyances so far

2007-04-26 Thread James Stroud
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > >> Hi all. I'm learning python these days. I'm going to use this thread >> to post, from time to time, my annoyances with python. I hope someone >> will clarify things to me where I have misunderstood them. >> >> Annoyances: >> 2. There are modules,

Re: How to find complementary colour for pixel

2007-04-26 Thread James Stroud
Johny wrote: > I use PIL to write some text to a picture.The text must be seen wery > clearly. > I write the text to different pictures but to the same position. As > pictures maybe different, colour, in the position where I write the > text, is also different. > Is there a way how to set the f

Re: Problem with Matplotlib and the Tk-Backend

2007-04-26 Thread James Stroud
t; self.canvas._tkcanvas.pack(side=TOP, fill=X, expand=1) > > > master is a parameter passed to my method, which actually is set to > Tk() > > What did I get wrong? What is the problem? Thanks in advance... > > Thorsten > Just prior to "self.toolbar = ...", try : master.winfo_toplevel().update_idletasks() James -- http://mail.python.org/mailman/listinfo/python-list

Re: Command-line option equiv of PYTHONPATH

2007-04-26 Thread James Stroud
. > > Is there any equivalent command-line option to the python binary or a > command-line version of PYTHONPATH? > > Regards > Rajesh > Why not just modify sys.path within the actual script? James -- http://mail.python.org/mailman/listinfo/python-list

Re: how to create/ref globals in an alternate namespace?

2007-04-27 Thread James Stroud
Steven W. Orr wrote: > I have two seperate modules doing factory stuff which each have the > similar function2: > > In the ds101 module, def DS101CLASS(mname,data): > cname = mname+'DS101' > msg_class = globals()[cname] > msg = msg_class(data) > return msg > > and in the fdu modu

Re: how to create/ref globals in an alternate namespace?

2007-04-27 Thread James Stroud
Steven W. Orr wrote: > On Friday, Apr 27th 2007 at 14:07 -0700, quoth James Stroud: > > =>Steven W. Orr wrote: > =>> I have two seperate modules doing factory stuff which each have the > =>> similar function2: > =>> > =>> In the ds101 module, def

<    10   11   12   13   14   15   16   17   18   19   >