Re: tkFileDialog question

2005-05-12 Thread James Stroud
n1.bind("", self.button1Click) > self.button1.bind("", self.button1Click) > > > def button1Click(self, event): > filePick = tkFileDialog.askopenfilename() -- 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: tkFileDialog question

2005-05-12 Thread James Stroud
button1 = Button(self.myContainer1) > self.button1.configure(text="...") > self.button1.grid(row=0, column=2) > self.button1.bind("", self.button1Click) > self.button1.bind("", self.button1Click) > &g

Re: thread title's getting shorter...

2005-05-15 Thread James Stroud
ith this level of cleverness. Now, if the LCBE author will go take a crap on some canvas, we can call it art. How clever, indeed! Clever, clever, clever, clever, clever. W. Clever. (And Stupid.) Dear LCBE author, please

Re: speeding up Python script

2005-05-17 Thread James Stroud
; couldn't. As I don't know C, I think that weave and PyInline for > example are out of the solution. > > I'm using Linux. > > Luis -- 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: appending key-value pairs to a dict

2005-05-20 Thread James Stroud
into a dict on each loop. > > Many thanks, > > rbt Simple assignment. adict[filename] = an_sha_hash -- 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: passing arguments

2005-05-20 Thread James Stroud
t(s) to a > python script from the command line? > > Thanks, > > Jeff Elkins -- 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: count files in a directory

2005-05-20 Thread James Stroud
es: > x = x+1 > print "There are", x, "files in this directory." > return x > > rbt def count_em(valid_path): root, dirs, files = os.walk(valid_path) return len(files) -- James Stroud UCLA-DOE Institute for Genomics and Proteomics

Re: count files in a directory

2005-05-20 Thread James Stroud
Come to think of it file_count = len(os.walk(valid_path)[2]) -- 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: count files in a directory

2005-05-20 Thread James Stroud
f for f in os.listdir('.') if os.path.isfile(f)]) On Friday 20 May 2005 08:08 pm, rbt wrote: > James Stroud wrote: > > def count_em(valid_path): > > root, dirs, files = os.walk(valid_path) > > return len(files) > > Here's another Tback: > >>> Tr

Re: Encryption with Python?

2005-05-24 Thread James Stroud
x84m\x12\x98\x98\xca=o\x0b\x8e\x08O\xb7\x0b\x04SC\x9 > >6 > > \ > > >xc7\xab*\x0b\x996\x06\x86\x83(\x8dQ\x9eG\x8f$\xb2x)\xa9fv\x0c1B\x9b\r\xde\ > >x > > f > > > >fc\x08' > > > > and given that > > > > >I rolled my own for rel

Tkinter Text Question

2005-05-24 Thread James Stroud
Hello All, I would like to get the index of the character closest to the pointer in a Text, something like Canvas.find_closest(). I want it to bind to ''. Does anybody know how this might be done? Thank you, James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box

Re: Tkinter Text Question

2005-05-25 Thread James Stroud
dh wrote: > w.index("@x,y" % (event.x, event.y)) -- 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: What are OOP's Jargons and Complexities?

2005-05-27 Thread James Stroud
languages, they would probably just called such thing _pure functions_. The term conveys the meaning, without the “lamba” abstruseness. """ Proposing "jargon" to cure "jargon". Good job! Of course nothing will ever rival "jargonize", the crown jewl of all &qu

Re: a re problem

2005-05-28 Thread James Stroud
;,text) &target > > get error : unsupported operand type(s) for &: 'str' and 'str' > > is it some idea that can modity it and make it work? -- 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: running tkinter

2005-05-31 Thread James Stroud
On Tuesday 31 May 2005 01:44 pm, Jim Anderson wrote: > Are tcl/tk still supposed to be an intergrated part of the > python release? > > Do I have to download, configure, make, install tcl and tk > packages to get tkinter running? I had to do this. Don't forget blt. -- J

Re: Scope

2005-06-03 Thread James Stroud
On Friday 03 June 2005 07:17 pm, Elliot Temple wrote: > Nothing is wrong with it in this case. I just want to know if Python > can do what I said. Read the python-list "working with pointers" thread from Tuesday. Good answers were posted there. James -- James Stroud UCLA-D

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
Hello All, I'm using numpy to calculate determinants of matrices that look like this (13x13): [[ 0. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.] [ 1. 0. 1. 4. 1. 9. 4. 4. 1. 1. 4. 9. 4. 9.] [ 1. 1. 0. 1. 4. 4. 9. 9. 4. 4. 1. 4. 1. 4.] [ 1. 4. 1. 0. 9.

Re: Determinant of Large Matrix

2007-06-06 Thread James Stroud
Hello, Thank you to those who responded for your answers. They were very helpful and I'm confident now that numpy is calculating accurate determinants for these matrices. But I think I need to restate my problem a little as suggested by some becuase I'm still bewildered. First, here is the re

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
Xavier Bérard wrote: > Hello everyone, > > I am wondering if there is a way to use custom drawing in Tkinter. > I've been using it for few months, and all I know about custom drawing > is to draw directly on a Canvas with such methods as "create_line", > "create_rectangle", etc. > > Now, the prob

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
Xavier Bérard wrote: >>>Now, the problem, is that I have already plenty of widgets on my >>>screen. I just want to draw over them, which is a bit difficult in my >>>comprehension of things. >> >>What are you trying to achieve by "drawing over" widgets? > > > > Want I want to do is a sort of GUI

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

2007-06-09 Thread James Stroud
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 ruby (wrt python) is that ruby has tail recursion, implying that python does not. Does python have fully optimized tail recursion as des

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

Re: Link Dictionary

2007-06-11 Thread James Stroud
anush shetty wrote: > Hi, > I have two dictionaries > > dict1={'B8': set(['I8', 'H8', 'B2', 'B7', 'F8', 'C9', 'G8', 'B4', > 'B5', 'B6', 'C8', 'E8', 'D8', 'B3', 'A9', 'A8', 'C7', 'B9', 'A7', > 'B1']), 'B9': set(['I9', 'H9', 'A7', 'F9', 'B3', 'B6', 'G9', 'B4', > 'B5', 'C9', 'B7', 'E9', 'B1', 'B2',

Re: userinteraction for a webspider

2007-06-11 Thread James Stroud
Chris wrote: > hi guys, > > i would like to to write a little spider, where, occasionally, the user > has to interact. For example show a log-in page or something similar > (since everyone has those verification letter/number pics), or send a > message by hand. > > I had the idea of the script

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
Ed Leafe wrote: > I have a simple module that reads in values from disk when > imported, and stores them in attributes, allowing for code like: > > >>> import moduleFoo > >>> print moduleFoo.someSetting > 'the value' > > What I'd like to do is have a more property-like behavior, so th

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
Beorn wrote: > Consider this example: > > >>> def funcs(x): > ... for i in range(5): > ... def g(): return x + i > ... yield g > > I would expect the value of x used in g to be that at the function > declaration time, as if you've pass g a (x=x) argument, especially >

Re: Python Help!!!

2007-06-11 Thread James Stroud
Elfine Peterson Tjio wrote: > I'm trying to make a program that reads Fasta file and print it out. I used > the SeqIO module and the results is: > > 'ATGGTCATSingleAlphabet()' > > For this purpose, should I use SeqIO or Fasta? > > for example: > > from Bio import SeqIO > > or > > from Bi

Re: newb: Scope Question

2007-06-22 Thread James Stroud
johnny wrote: > Scope of ids: > When I print "ids", it's always empty string '', as I have intialized > before. That's not what I want. I want the ids to have > str(r['id']).join(',') > > if res: > ids = '' > for r in res['key']: > ids = str(r['

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
John Henry wrote: > Hi list, > > I have a need to create class methods on the fly. For example, if I > do: > > class Dummy: > def __init__(self): > exec '''def method_dynamic(self):\n\treturn > self.method_static("it's me")''' > return > > def method_static(self, text):

Re: Python changing keywords name

2007-06-23 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hello AGAIN, > > I on working on windows and Python 2.4. Where can I find and CHANGE > python > grammar. ( I just want to change the keywords ) > > PLEASE HELP ME > SOMEBODY!! > > THANKS! >

Re: Accessing variable from a function within a function

2007-06-24 Thread James Stroud
Nathan Harmston wrote: > Hi, > > I m playing around with extended euclids algorithm from Knuth. I m > trying to build a function with a function inside it. > > def exteuclid(m,n): > a,a1,b,b1,c,d = 0,1,1,0,m,n > def euclid(c,d): >q = c /d >r = c % d >if r == 0: >

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: Internals and complexity of types, containers and algorithms

2007-06-25 Thread James Stroud
Harald Luessen wrote: > Hi, I am new to python and I miss some understanding of the internals > of some types and containers. With my C/C++ background I hope to get > some hints to chose the best data structure for my programs. Here are > some questions: This depends on how you define "best". I

Re: Voluntary Abstract Base Classes

2007-06-29 Thread James Stroud
Daniel Nogradi wrote: > Hi list, > > Well, the short question is: what are they? I've read Guido's python > 3000 status report on > http://www.artima.com/weblogs/viewpost.jsp?thread=208549 where he > mentions ABC's but don't quite understand what the whole story is > about. > > Anyone has good us

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
Chris Carlen wrote: > Hi: > > From what I've read of OOP, I don't get it. I have also found some > articles profoundly critical of OOP. I've also found articles critical of Darwinism--but we can chalk that up to religious zealotry can't we? Any gui more complicated than a few entry fields an

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
0 * t.timeit(number=10)/10) print 'doit2' t = Timer('doit2(alist)', 'from __main__ import groupby, doit2, alist, c') print "%.2f usec/pass" % (100 * t.timeit(number=10)/10) -- 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: How to organize control access to source code ?

2007-07-17 Thread James Stroud
[EMAIL PROTECTED] wrote: > On 16 juil, 21:10, Erik Jones <[EMAIL PROTECTED]> wrote: >> On Jul 16, 2007, at 3:46 PM, [EMAIL PROTECTED] wrote: >> >>> Hello, >>> How can we organize development team with code source control policy, >>> that limit access to some portion of code ? >> The specifics large

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: 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: 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: Do other Python GUI toolkits require this?

2007-04-18 Thread James Stroud
Kevin Walzer wrote: > From the introduction to PyObjC, the Python-Objective-C bridge on Mac > OS X: > > "As described in Objective-C for PyObjC users the creation of > Objective-C objects is a two-stage process. To initialize objects, first > call a class method to allocate the memory (typical

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
Boris Borcic wrote: > >>> x = (lambda : ((yield 666),(yield 777),(yield 888)))() > >>> x.next() > 666 > >>> x.next() > 777 > >>> x.next() > 888 > >>> x.next() > (None, None, None) > >>> x = (lambda : ((yield 666),(yield 777),(yield 888)) and None)() > >>> x.next() > 666 > >>> x.next() > 777

Re: TK-grid problem, please help

2007-04-21 Thread James Stroud
Ray wrote: > hi, I have a question about how to use .grid_forget (in python/TK) > > I need to work on grid repeatly. everytime when a button is pressed, > the rows of grid is different. such like, first time, it generate 10 > rows of data. > 2nd time, it maybe only 5 rows. so I need a way to RESE

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

2007-04-23 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hey, > > I am helping to develop a project that displays images based on user > input. One possible way of implementing this is via a widget that > when it is run, would read in the users input from an input text field > (probably from a blog), and replace it with the H

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
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 my peak for training efficiency, so I would like to scrape the res

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
Hertha Steck wrote: > Hello, > > Ray schrieb: > >> Hi, Thanks for the help. >> >> >> I was trying to find a book "Python TK" something on last Friday. >> but didn't find it :-) >> > > There is only one printed book, all the details here: > > http://wiki.python.org/moin/GuiBooks > > HTH > Herth

Re: Controlling gnuplot via subprocess.Popen

2007-04-25 Thread James Stroud
Peter Beattie wrote: > I am trying to plot something in gnuplot 4.2 using co-ordinates a Python > 2.5 program computes. Here's what I'm doing: > > py> from subprocess import * > py> plot = Popen("c:/progs/gp/bin/wgnuplot.exe", stdin=PIPE) > py> plot.stdin.write("plot x*x") > > The first command d

Re: My python annoyances so far

2007-04-25 Thread James Stroud
[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. Please start a new thread for each annoyance. Overuse of a single thread is an annoyance to a great many people. > I hope someone > will clar

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
[EMAIL PROTECTED] wrote: > Video: Professor of Physics, Phd at Cal Tech says: 911 Inside Job > > Cal Tech is the ELITE of ELITE in physics. > > If Feynman were alive, he would point his finger straight at the 911 > criminal operators, the yank bastards themselves ... > > http://www.911blogge

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
thorstenkranz wrote: > Hi everyone, > > I'm new here and I have a question ( I guess as everybody who is new > here ;-) ), > > I'm having some strange problem with Matplotlib, using it in a Tkinter > application. > > I create a Canvas, a figure, subplot and then a toolbar. It works > fine, but

Re: Command-line option equiv of PYTHONPATH

2007-04-26 Thread James Stroud
Rajesh wrote: > Hi, > > The '-I' option adds the path to the list of directories that > contains modules that can be included in a script. I can use it as "#!/ > usr/bin/perl -I" thereby not asking the user of > the script to set the in their environment. > > Is there any equivalent command-line

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

Re: Portable SciPy v0.1 released

2007-04-27 Thread James Stroud
Beliavsky wrote: > On Apr 27, 6:17 pm, Stef Mientki <[EMAIL PROTECTED]> > wrote: > >>Portable SciPy, is an easy installer of SciPy for M$ windows users. > > > If you have an announcement for Windows users, I suggest that you not > needlessly turn them off by abbreviating Microsoft as M$ . You do

Re: editing scripts on a mac

2007-04-27 Thread James Stroud
Thomas Nelson wrote: > On Apr 27, 11:37 am, Tommy Grav <[EMAIL PROTECTED]> wrote: > >>>him> I do not have a text editor, but here are the answers to >>>him> questions 1-5. >> >>>Now, frankly, I don't think this answer is correct, since I know OS >>>X is >>>a UNIX derivative, but I am loathe to i

Re: Memory addressing

2007-04-27 Thread James Stroud
Simon Berube wrote: > On Apr 27, 3:52 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > >>On Fri, 2007-04-27 at 12:41 -0700, Simon Berube wrote: >> >>>Hi, >> >>> I have a rather simple question for which I couldn't find an >>>answer. I noticed how a significant number of objects in Python return >>

Re: how can I put an Exception as the key of a hash table

2007-04-28 Thread James Stroud
[EMAIL PROTECTED] wrote: > I want to keep track of the number of different exception happens in > my python program: > > ErrorHash = {} > > try: > > # come code ... > > except Exception, e: > print e > errcode = e > > if (ErrorHash.has_key(errcode)): >

Re: My Python annoyances

2007-04-28 Thread James Stroud
André wrote: > I'm really annoyed at Python - and not for the reasons already > mentioned on this list. > > Everyone know that programming is supposed to be a dark art, nearly > impossible to learn. Computer code is supposed to be something > impossible to read to the common person and yet reveal

Re: Counting

2007-04-29 Thread James Stroud
Andy wrote: > Hi, the file below will print all the keywords in a file and also the > line # of the keyword. What I couldn't figure out is to count those > keywords per line. For example - "Line #1 has 3 keywords" > > Can I do like - > > total[j] = total[j] + numwords(k) > "Line number %d has %d

Re: Counting

2007-04-29 Thread James Stroud
James Stroud wrote: > Andy wrote: >> Hi, the file below will print all the keywords in a file and also the >> line # of the keyword. What I couldn't figure out is to count those >> keywords per line. For example - "Line #1 has 3 keywords" >> >> Can

Re: Counting

2007-04-29 Thread James Stroud
James Stroud wrote: > James Stroud wrote: >> Andy wrote: >>> Hi, the file below will print all the keywords in a file and also the >>> line # of the keyword. What I couldn't figure out is to count those >>> keywords per line. For example - "

Re: Counting

2007-04-29 Thread James Stroud
[EMAIL PROTECTED] wrote: > That's a short, abridged version of my code :) But, what I want is to > count total# of keywords per line and print 'em. Rather than > printing : > > The word 'and' belongs in line num: 1 > The word 'del' belongs in line num: 1 > The word 'from' belongs in line num: 1 >

Re: fastest way to find the intersection of n lists of sets

2007-04-29 Thread James Stroud
Prateek wrote: > I have 3 variable length lists of sets. I need to find the common > elements in each list (across sets) really really quickly. > > Here is some sample code: > > # Doesn't make sense to union the sets - we're going to do > intersections later anyway > l1 = reduce(operator.add, lis

Re: How do I parse a string to a tuple??

2007-04-30 Thread James Stroud
Soren wrote: > Hi! > > I have a string that contains some text and newline characters. I want > to parse the string so that the string just before a newline character > goes in as an element in the tuple. > > ex: > >--> (text1, text2, text3, text4) > > Is there an easy way to do this? > >

Re: regexp match string with word1 and not word2

2007-04-30 Thread James Stroud
Flyzone wrote: > Hello, > i have again problem with regexp :-P > I need to match all lines that contain one word but not contain > another. > Like to do "grep one | grep -v two:" > The syntax of the string is: > (any printable char)two:(any printable char)one(any printable char) > Example: > Apr 30

Re: regexp match string with word1 and not word2

2007-04-30 Thread James Stroud
Flyzone wrote: > P.S: i can't have more re.search, so [clip] This reminds me of a quote by the Great Researcher Roy Garcia: If it worked the first time, they'd just call it "search". James -- http://mail.python.org/mailman/listinfo/python-list

Re: python TK scrollbar problem

2007-04-30 Thread James Stroud
Ray wrote: > Hi, > > would someone tell me how to make scrollbar work under grid? > I think I'm missing something to connect scrollbar with the grid. > following is some sample code. it shows the scrollbar, but it do not work. > > Thanks a lot for the help! > > Ray > > #code begin >

Re: Master's Thesis Help Needed

2007-04-30 Thread James Stroud
RobJ wrote: > On Apr 30, 12:00 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > >>RobJ <[EMAIL PROTECTED]> wrote: >> >>>http://pyschool.robj.webfactional.com/ >> >>Things start on a pretty bad note when I'm asked to select my OS: >>Ubuntu Linux >>Windows XP >> >>I'm running MacOSX. What now? Why i

Re: Tcl-tk 8.5?

2007-05-02 Thread James Stroud
Méta-MCI wrote: > Hi! > > > See http://wiki.tcl.tk/10630 > > Any plan to integrate Tcl 8.5 in standard Python? > > > > @+ > > MCI > Better would be to outegrate it and instead use another gui kit as the standard. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Slicing Arrays in this way

2007-05-02 Thread James Stroud
Tobiah wrote: > > >>> elegant_solution([1,2,3,4,5,6,7,8,9,10]) > [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]] > > Here's one I use: def elegant_solution(alist): i = iter(alist) return [[j, i.next()] for j in i] py> elegant_solution(range(14)) [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10,

Re: Article on wxPython ToolKit for Mac OS X

2007-05-03 Thread James Stroud
miah_gbg wrote: > Hi there! > > Just wanted to let people know in this group that I have recently > (April 24th) published an introductory article on wxPython and Mac OS > X. It is available here: http://www.macdevcenter.com/ > > Hope someone finds it useful. > > Regards, > > Jeremiah > F

Re: Article on wxPython ToolKit for Mac OS X

2007-05-03 Thread James Stroud
miah_gbg wrote: > Hi there! > > Just wanted to let people know in this group that I have recently > (April 24th) published an introductory article on wxPython and Mac OS > X. It is available here: http://www.macdevcenter.com/ > > Hope someone finds it useful. > > Regards, > > Jeremiah > N

Re: Article on wxPython ToolKit for Mac OS X

2007-05-03 Thread James Stroud
James Stroud wrote: > miah_gbg wrote: > >> Hi there! >> >> Just wanted to let people know in this group that I have recently >> (April 24th) published an introductory article on wxPython and Mac OS >> X. It is available here: http://www.macdevcenter.com

<    1   2   3   4   5   6   7   8   9   10   >