Re: inherit from file and create stdout instance?

2007-05-15 Thread 7stud
On May 15, 4:18 pm, MisterPete <[EMAIL PROTECTED]> wrote: > How can I inherit from file but stil create an instance that writes to > stdout? > --- > I'm writing a file-like object that has verbosity options (among > some other things). I know I could just set self.file to a file object

Re: inherit from file and create stdout instance?

2007-05-15 Thread 7stud
>but it is frustrating me that if I try to inherit from file it >works fine for regular files I don't think that is correct characterization at all. What really happens is that when you inherit from file, your class works when you send the __init__ method a string, i.e. a filename. sys.stdout is

Re: inherit from file and create stdout instance?

2007-05-15 Thread 7stud
On May 15, 7:43 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >>... def __getattr__(self, name): >>... return getattr(self.file, name) Nice. -- http://mail.python.org/mailman/listinfo/python-list

setting an attribute

2007-05-16 Thread 7stud
"When you bind (on either a class or an instance) an attribute whose name is not special...you affect only the __dict__ entry for the attribute(in the class or instance, respectively)." In light of that statement, how would one explain the output of this code: class Test(object): x = [1, 2]

Re: setting an attribute

2007-05-16 Thread 7stud
On May 16, 2:24 am, Bruno Desthuilliers wrote: > 7stud a écrit : > > > > > "When you bind (on either a class or an instance) an attribute whose > > name is not special...you affect only the __dict__ entry for the > > attribute(in the class or instance, res

Re: Newbie: Joining Lists

2007-05-17 Thread 7stud
On May 17, 3:49 am, mosscliffe <[EMAIL PROTECTED]> wrote: > I have been playing with GLOB and OS.PATH and it all works, but is > there a better way of getting GLOB to recognise, multiple patterns at > one call (ONE). > A better way? You haven't posted a way to do that. And a quick perusal of the

omissions in python docs?

2007-05-17 Thread 7stud
Hi, 1) The shelve module doesn't list close() as a method. 2) The fnmatch module does not even mention translate(). I have a hard time believing I am the first one to notice those omissions. Are the docs just old and poorly maintained? Or, is there some reason those methods were omitted? -- h

Re: omissions in python docs?

2007-05-17 Thread 7stud
On May 17, 5:24 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > At least for 2) you're late. It's already documented on > 2.5.1:http://sourceforge.net/tracker/index.php?func=detail&aid=1630844&grou... > Darn. I could have been somebody! >Nit-pickingly yours, >John No so. I checked the dow

Re: omissions in python docs?

2007-05-17 Thread 7stud
On May 17, 7:23 pm, 7stud <[EMAIL PROTECTED]> wrote: > On May 17, 5:24 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > > At least for 2) you're late. It's already documented on > > 2.5.1:http://sourceforge.net/tracker/index.php?func=de

Re: namespace question

2007-05-18 Thread 7stud
On May 18, 12:29 pm, "T. Crane" <[EMAIL PROTECTED]> wrote: > If you put them at the top level, and suppose you saved it all in a file > called test.py, then when you type > > ln [1]: from test import myClass > > does it still load a,b,c and numpy into the namespace? > Yep. Easy to test: toBeImpo

Re: Beginner question: module organisation

2007-05-19 Thread 7stud
On May 14, 7:09 am, [EMAIL PROTECTED] wrote: > Hello :) > > I am new to python and I don't have much expirience in object-oriented > technologies neither. > > The problem is the following: I have to create a simple python > template script that will always follow the same algorithm, let's say: > -

Re: docs patch: dicts and sets

2007-05-19 Thread 7stud
On May 19, 9:06 am, Steven Bethard <[EMAIL PROTECTED]> wrote: > Alan Isaac wrote: > > I submitted the language based on Bill and Carsten's proposals: > > >https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1721372&;... > > > That language has been rejected. > > You many want to read the d

Re: Beginner question: module organisation

2007-05-19 Thread 7stud
On May 19, 10:45 am, 7stud <[EMAIL PROTECTED]> wrote: > > refineModule.py: > --- > def refine(userfunc, mesh): > #process mesh > func(mesh) > The last line should be: userfunc(mesh) -- http://mail.python.org/mailman/listinfo/python-list

Re: Many-to-many pattern possiable?

2007-05-19 Thread 7stud
On May 19, 10:33 am, Jia Lu <[EMAIL PROTECTED]> wrote: > Hi all > > I see dict type can do 1-to-1 pattern, But is there any method to do > 1-to-many, many-to-1 and many-to-many pattern ? How about: one_to_many = {"a":[10, "red", 2.5]} many_to_1 = {("red", 2.5, 3):"hello"} many_to_many = {("red

Re: docs patch: dicts and sets

2007-05-19 Thread 7stud
On May 19, 11:38 am, Steve Holden <[EMAIL PROTECTED]> wrote: > Except in those instances where users added information that was > explicitly wrong. It's a self correcting mechanism. Other reader's will spot the error and post corrections. -- http://mail.python.org/mailman/listinfo/python-list

Re: docs patch: dicts and sets

2007-05-19 Thread 7stud
On May 19, 12:36 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > The last thing I want to read in a language's documentation is an > ill-informed and sometimes interminable argument about a particular feature. > Yet some readers will be able to get to the bottom of an issue they are having by readin

Re: docs patch: dicts and sets

2007-05-19 Thread 7stud
>Actually, it would just move the "endless, petty discussions about what >minutiae are more important" into the docs. I don't see how that's an >improvement. Because it highlights the issues you will be faced with when using the described functions. People will post about an issue they had with a

f.readline(), for line in f

2007-05-23 Thread 7stud
Hi, 1) Does this make any sense: """ Thus, the loop: for line in f: iterates on each line of the file. Due to buffering issues, interrupting such a loop prematurely(e.g. with break), or calling f.next() instead of f.readline(), leaves the files position set to an arbitrary value. """ The

Re: Namespace issue

2007-05-23 Thread 7stud
On May 23, 12:20 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > As per my understanding, the bad part is that on every call of the method > FetchData(), an import would be done. > > To not let that happen, I can put the import into __init__(). But when I put > in there, I get a NameError saying

Re: Namespace issue

2007-05-23 Thread 7stud
On May 23, 12:20 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > As per my understanding, the bad part is that on every call of the method > FetchData(), an import would be done. > > To not let that happen, I can put the import into __init__(). But when I put > in there, I get a NameError saying

Re: Namespace issue

2007-05-23 Thread 7stud
On May 23, 12:20 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > As per my understanding, the bad part is that on every call of the method > FetchData(), an import would be done. > > To not let that happen, I can put the import into __init__(). But when I put > in there, I get a NameError saying

Re: read file to a dictionary

2007-05-23 Thread 7stud
On May 23, 6:46 pm, James Stroud <[EMAIL PROTECTED]> wrote: lol -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
On May 24, 9:36 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I am using timeit to time a global function like this > > t = timeit.Timer("timeTest()","from __main__ import timeTest") > result = t.timeit(); > > But how can i use timeit to time a function in a class? > class FetchUrlTh

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
On May 24, 11:30 am, 7stud <[EMAIL PROTECTED]> wrote: > On May 24, 9:36 am, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > Hi, > > > I am using timeit to time a global function like this > > > t = timeit.Timer("

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
Actually, you can do this: class Dog(object): def aFunction(self): result = 20 + 2 def run(self): #do stuff aFunction() #do other stuff import timeit t = timeit.Timer("d.aFunction()", "from __main__ import Dog; d = Dog()") print t.timeit() Since you only

Re: Different methods with same name but different signature?

2007-05-24 Thread 7stud
In python, every(?) variable name and its value is stored in a dict somewhere, and when you try to access the name, it is looked up in the dict. So if you write: def f(x): print x def f(x, y): print x,y when those lines are first parsed as your file loads, somewhere this happens: somedi

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
On May 24, 12:23 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On May 24, 12:41 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > > > Actually, you can do this: > > > class Dog(object): > > def aFunction(self): > >

Re: How can I time a method of a class in python using Timeit

2007-05-24 Thread 7stud
On May 24, 12:23 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On May 24, 12:41 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > > > Actually, you can do this: > > > class Dog(object): > > def aFunction(self): > >

sockets, gethostname() changing

2007-05-24 Thread 7stud
Hi, I'm experimenting with a basic socket program(from a book), and both the client and server programs are on my computer. In both programs, I call socket.gethostname(), but I discovered that when I am connected to the internet, both the client and server hang and nothing happens. I discovered

Re: sockets, gethostname() changing

2007-05-24 Thread 7stud
Thanks for the response. On May 24, 9:24 pm, [EMAIL PROTECTED] wrote: > I can't imagine why your hostname would be changing, unless you > installed some of their proprietary software thats messing around with > things. When I first started using Terminal, I noticed that the prompt in Terminal c

Re: Find the closest relative

2007-05-25 Thread 7stud
On May 25, 12:31 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > This is how I implemented; I guess there must be elegant way to do > this... > > def find_closest_relative(a,b,c): > c1 = b.__class__ > c2 = b.__class__ > > while True: > if isinstance(a, c1): > re

Re: sockets, gethostname() changing

2007-05-25 Thread 7stud
>For local testing it is *much* easier to have your client >and server use IP address 127.0.0.1 According to my book, an address is a tuple of the form (hostname, port), so I didn't know what you meant by using 127.0.0.1 as the address. I played around with it, and using the tuple ("127.0.0.1", 1

Re: csv.reader length?

2007-05-25 Thread 7stud
On May 25, 12:49 pm, cjl <[EMAIL PROTECTED]> wrote: > P: > > Stupid question: > > reader = csv.reader(open('somefile.csv')) > for row in reader: > do something > > Any way to determine the "length" of the reader (the number of rows) > before iterating through the rows? > > -CJL How about: f =

Re: problem with eval while using PythonCard

2007-05-25 Thread 7stud
On May 25, 3:33 pm, "Michal Lipinski" <[EMAIL PROTECTED]> wrote: > Hi > > its my first post. I have a problem, I want to user eval() function in > a for loop to set labels to staticText so i done something like this: > > dzien=self.components.Calendar.GetDate().GetDay() >for i in range(1,8):

Re: problem with eval while using PythonCard

2007-05-25 Thread 7stud
Here's a complete example: ### #create object 's': class S(object):pass class X(object):pass class Y(object):pass s = S() s.components = X() s.components.d1 = Y() s.components.d2 = Y() s.components.d3 = Y() ## ## set some initial values: f

Re: problem with eval while using PythonCard

2007-05-25 Thread 7stud
On May 25, 4:43 pm, "Michal Lipinski" <[EMAIL PROTECTED]> wrote: > now it's working just fine. but still I dont know why eval dont work ? > > and thx for help > > 25 May 2007 15:05:03 -0700, 7stud <[EMAIL PROTECTED]>: > > > > > Here&#x

Re: sockets, gethostname() changing

2007-05-26 Thread 7stud
I figured something out that succeeded in making the hostname constant, and it allows me to run the socket programs without error. I'm posting what I did for future seekers. This is for mac os 10.4.7: 1) In System Preferences>Sharing, there is a name entered there: Computer Name: John S

Re: Newbie: Struggling again 'map'

2007-05-26 Thread 7stud
1) If you write (...) after a function name, it executes the function(except when defining a function). And when you write (...) after a function name it's known as a "function call": def calc(): return 3.5 result = calc() + 2 2) Function calls are replaced in the code by the function's ret

Re: PHP5 programmer learning Python

2007-05-27 Thread 7stud
On May 27, 9:41 am, romiro <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm a PHP5 developer looking to "broaden my horizons" so to speak by > learning a new language. I emphasize the 5 in PHP since I have fully > engrossed myself in the full OOP of version 5 with my own ground-up > projects as well as

itertools.groupby

2007-05-27 Thread 7stud
Bejeezus. The description of groupby in the docs is a poster child for why the docs need user comments. Can someone explain to me in what sense the name 'uniquekeys' is used this example: import itertools mylist = ['a', 1, 'b', 2, 3, 'c'] def isString(x): s = str(x) if s == x:

Re: itertools.groupby

2007-05-27 Thread 7stud
On May 27, 11:28 am, Steve Howell <[EMAIL PROTECTED]> wrote: > --- 7stud <[EMAIL PROTECTED]> wrote: > > Bejeezus. The description of groupby in the docs is > > a poster child > > for why the docs need user comments. Can someone > > explain to me in >

Re: itertools.groupby

2007-05-28 Thread 7stud
nd like using it, and > there have been no bug reports or reports of usability problems). > All in all, that ain't bad (for what 7stud calls a poster child). > > Raymond >- there is an accurate, succinct one-paragraph description > of what the itertool does. As is ofte

Re: Off Topic: What is the good book to learn Python ?

2007-05-30 Thread 7stud
In my opinion, "Beginning Python: From Novice to Professional" is a horrible book. I constantly have to consult "Learning Python(2nd ed.) to clear up all the blunders in Beginning Python. In addition, Learning Python(2nd ed) has exercises and Beginning Python doesn't. So I would recommend "Learni

Re: trouble with wxPython intro

2007-05-31 Thread 7stud
On May 30, 11:41 pm, Anthony Irwin <[EMAIL PROTECTED]> wrote: > Daniel Gee wrote: > > I'm trying to learn WxPython with the tutorial: > >http://wiki.wxpython.org/Getting_Started > I'm a wxPython beginner too, but instead of Anthony Irwin's suggestions, I think you should delete these two lines: I

Re: trouble with wxPython intro

2007-05-31 Thread 7stud
On May 31, 1:56 am, 7stud <[EMAIL PROTECTED]> wrote: > By setting redirect=False in wx.App.__init__(), the errors will be > sent to the console. Hmmm...I just read a note I scribbled in the margin of my book that says setting redirect=False sends the error messages to the consol

printing unicode strings

2007-07-24 Thread 7stud
Can anyone tell me why I can print out the individual variables in the following code, but when I print them out combined into a single string, I get an error? symbol = u'ibm' price = u'4 \xbd' # 4 1/2 print "%s" % symbol print "%s" % price.encode("utf-8") print "%s %s" % (symbol, price.encode("

Re: printing unicode strings

2007-07-24 Thread 7stud
Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing mod_python on mac os 10.4.7

2007-07-28 Thread 7stud
On Jul 14, 8:34 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Jul 15, 10:06 am, Graham Dumpleton <[EMAIL PROTECTED]> > wrote: > > > > > On Jul 15, 2:47 am, 7stud <[EMAIL PROTECTED]> wrote: > > > > Themod_pythonmanual says this under secti

Re: Installing mod_python on mac os 10.4.7

2007-07-28 Thread 7stud
I also get this: >>> import mod_python.psp Traceback (most recent call last): File "", line 1, in ? ImportError: No module named mod_python.psp >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing mod_python on mac os 10.4.7

2007-07-28 Thread 7stud
I'm using Apache 2.2.4 whose root is /Library/Apache2. My installation of python 2.4 is here: /Library/Frameworks/Python.framework/Versions/2.4/ /Library/Frameworks/Python.framework/Versions/Current/ "Current" is a link to the 2.4 directory: $ ls -al /Library/Frameworks/Python.framework/Ver

Re: Installing mod_python on mac os 10.4.7

2007-07-28 Thread 7stud
My PATH environment variable looks like this: PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:/bin:/ sbin:/usr/bin:/usr/sbin:/usr/local/mysql/bin -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing mod_python on mac os 10.4.7

2007-07-29 Thread 7stud
On Jul 29, 4:07 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > Any ideas what went wrong? > > Have you got an appropriate LoadModule directive in Apache > configuration to load the mod_python module? That you get this error > is indicative of mod_python module not being loaded. > I checked an

Re: Installing mod_python on mac os 10.4.7

2007-07-29 Thread 7stud
On Jul 29, 4:07 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > Have you got an appropriate LoadModule directive in Apache > configuration to load the mod_python module? That you get this error > is indicative of mod_python module not being loaded. You can check the > Apache error logs to see if

Re: Installing mod_python on mac os 10.4.7

2007-07-29 Thread 7stud
On Jul 29, 5:28 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Jul 30, 2:37 am, 7stud <[EMAIL PROTECTED]> wrote: > > > > > On Jul 29, 4:07 am, Graham Dumpleton <[EMAIL PROTECTED]> > > wrote: > > > > Have you got an appropriate LoadModu

Re: Installing mod_python on mac os 10.4.7

2007-07-30 Thread 7stud
> Yeah! So is my install good? Why didn't the Directory tags in > httpd.conf work? Ok. I got the mod_python manual's Testing directions to work as well. The Testing section actually says: --- Add the following Apache directives, which can appear in ... the main server configuration file..

Re: Installing mod_python on mac os 10.4.7

2007-07-30 Thread 7stud
The Testing section of the mod_python manual says to add the following to httpd.conf(with my directory structure): AddHandler mod_python .py PythonHandler mptest PythonDebug On and your tutorial says to add this to httpd.conf: --- AllowOverride FileInfo Replace "

Re: Pysqlite storing file as blob example

2007-07-31 Thread 7stud
On Jul 30, 6:25 pm, [EMAIL PROTECTED] wrote: > I'm trying to store binary data in a sqlite database and call into the > db using pysqlite 3. > What I've got so far is this: > > import sqlite > con = sqlite.connect(DB_PATH) > cur = con.cursor() > query = """create table t1( > ID INTEGER

encode() question

2007-07-31 Thread 7stud
s1 = "hello" s2 = s1.encode("utf-8") s1 = "an accented 'e': \xc3\xa9" s2 = s1.encode("utf-8") The last line produces the error: --- Traceback (most recent call last): File "test1.py", line 6, in ? s2 = s1.encode("utf-8") UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position

Re: encode() question

2007-07-31 Thread 7stud
On Jul 31, 11:18 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > str.decode and unicode.encode should NOT exist, or at least issue a > warning (IMHO). > Yes, that sounds like a good idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: Script that Navigates Page needs Javascript Functionality

2007-08-03 Thread 7stud
On Aug 3, 7:58 pm, SMERSH009 <[EMAIL PROTECTED]> wrote: > I have a script that navigates pages and scrapes the HTML source of > the page. > in order to view the results I need I need python to "navigate to" > this Javascript link: > javascript:__doPostBack('ctl00$cpMain$pagerTop','4') This basical

udp, datagram sockets

2007-08-06 Thread 7stud
I'm trying to understand datagrams. My client program sends a message to the server, and then the server infinitely loops over the recv() to make sure all the data was received. I'm trying to use an * to signal the end of the message, so that the server can break out of the infinite while loop us

Re: udp, datagram sockets

2007-08-06 Thread 7stud
On Aug 6, 10:59 am, Thomas Jollans <[EMAIL PROTECTED]> wrote: > > You don't make any attempt to break out of the outer loop. (break breaks the > innermost loop) > By design. My server stands ready to process any and all messages forever. The problem I'm having is that my server processes the sam

Re: udp, datagram sockets

2007-08-06 Thread 7stud
On Aug 6, 11:05 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > > The network is probably dropping some of your data, causing the server > to never see the termination marker. > As far as I can tell, the output disproves that notion. If the termination character were somehow lost in transm

Re: udp, datagram sockets

2007-08-06 Thread 7stud
On Aug 6, 1:27 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > I don't think that sending the datagram to port on localhost sends > the message back to the client. I'm guessing the server is sending the > message back to itself, which throws it into the infinite feedback loop > you're experienc

read(size=-1)

2007-08-06 Thread 7stud
Suppose I write: f = open("myimg.jpg") f.read(10) According to the docs, --- read([size]) Read at most size bytes from the fileThe bytes are returned as a string object. -- How does python convert a byte to a string? -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython before MainLoop

2007-08-09 Thread 7stud
On Aug 8, 11:25 pm, "[david]" <[EMAIL PROTECTED]> wrote: > I'd like to refresh the display before I start the main loop. > > I have code like this: > > app = App() > app.Show() > app.long_slow_init() > app.MainLoop() > > The main frame partly loads at Show, but because the mainloop has not > starte

Re: wxPython before MainLoop

2007-08-09 Thread 7stud
I reorganized my Thread class a little bit: class MyThread(threading.Thread): def __init__(self, a_frame): threading.Thread.__init__(self) self.frame_obj = a_frame def run(self): result = self.long_slow_init() wx.CallAfter(self.frame_obj.recei

Re: wxPython before MainLoop

2007-08-09 Thread 7stud
On Aug 8, 11:25 pm, "[david]" <[EMAIL PROTECTED]> wrote: > I'd like to refresh the display before I start the main loop. > > I have code like this: > > app = App() > app.Show() > app.long_slow_init() > app.MainLoop() > > The main frame partly loads at Show, but because the mainloop has not > starte

Re: wxPython - drawing without paint event

2007-08-10 Thread 7stud
On Aug 9, 7:46 pm, Matt Bitten <[EMAIL PROTECTED]> wrote: > I've got a wxPython program that needs to do some drawing on a DC on a > regular basis And there is no event, > so my code doesn't get called. What do I do? Then the event is: "on a regular basis", i.e. the passage of time. You can us

Re: wxPython - drawing without paint event

2007-08-11 Thread 7stud
On Aug 11, 7:59 pm, [EMAIL PROTECTED] wrote: > On Aug 11, 3:31 am, Bjoern Schliessmann > > > [EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > On a related topic, it seems like it would be nice to do *all* > > > drawing in > > > response topaintevents. When I get aneventfrom the timer,

Re: wxPython - drawing without paint event

2007-08-12 Thread 7stud
On Aug 12, 6:06 am, Bjoern Schliessmann wrote: > I really recommend reading "wxPython in Action", or at least the > tutorial. > I don't. "wxPython in Action" is by far the worst computer book I've ever purchased. It's poorly organized, poorly written, and full of mistakes--and it's expensive.

Re: wxPython - drawing without paint event

2007-08-12 Thread 7stud
On Aug 12, 2:20 pm, Bjoern Schliessmann wrote: > But any suggestions what's > better for a beginner? The (incomplete) tutorial surely not. > Another GUI toolkit. -- http://mail.python.org/mailman/listinfo/python-list

Re: wx.ListBox drag and drop

2007-08-13 Thread 7stud
On Aug 12, 11:06 pm, ianaré <[EMAIL PROTECTED]> wrote: > Hey all, > > I see plenty of drag and drop examples but they are all for > wx.ListCtrl. Anyone know of examples or tutorials for wx.ListBox? > Specifically, I would like to be able to drag a selection from one > ListBox to another. > > Thanks

Re: Configuring apache to execute python scripts using mod_python handler

2007-08-13 Thread 7stud
On Aug 13, 5:16 am, joe jacob <[EMAIL PROTECTED]> wrote: > I configured apache to execute python scripts using mod_python > handler. I followed below mentioned steps to configure apache. > > 1. In http.conf I added > > > AddHandler mod_python .py > PythonHandler mptest > PythonDebug On >

using super() to call two parent classes __init__() method

2007-08-16 Thread 7stud
When I run the following code and call super() in the Base class's __init__ () method, only one Parent's __init__() method is called. class Parent1(object): def __init__(self): print "Parent1 init called." self.x = 10 class Parent2(object): def __init__(self): pr

Re: Learning Python using a book based on version 1.5

2007-08-22 Thread 7stud
[EMAIL PROTECTED] wrote: > Greetings, > > A friend of mine dropped off a copy of Sams Teach Yourself Python in > 24 Hours published in 2000. I skimmed the first couple of chapters > looking for the interpreter version and the book was based on version > Python version 1.5. > > Is this book still r

Re: I can't get value of entry box, Tinker

2007-08-24 Thread 7stud
Matt McCredie wrote: > > What/should I, can I do? > > Fix your code? > > > def login(): > > global e2,e1 > > print e2.get() > > print e1.get() > > That should work. > > Matt Try something like this: import Tkinter as tk root = tk.Tk() entry = tk.Entry(root) button = tk.Button(root, t

gc.garbage

2007-08-30 Thread 7stud
gc.garbage returns an empty list even though the command: gc.set_debug(gc.DEBUG_LEAK) produces the following output: gc: uncollectable gc: uncollectable gc: uncollectable gc: uncollectable I expected all those objects to be in the list returned by gc.garbage. Here's the code: import gc

Re: gc.garbage

2007-08-30 Thread 7stud
On Aug 30, 3:50 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > gc.set_debug(gc.DEBUG_LEAK) > > print gc.garbage > > > --output:-- > > [] > > gc: uncollectable > > gc: uncollectable > > gc: uncollectable > > gc: uncollectable > > gc.garbage is filled only after these messages > are printed

Re: gc.garbage

2007-08-30 Thread 7stud
On Aug 30, 3:50 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > gc.set_debug(gc.DEBUG_LEAK) > > print gc.garbage > > > --output:-- > > [] > > gc: uncollectable > > gc: uncollectable > > gc: uncollectable > > gc: uncollectable > > gc.garbage is filled only after these messages > are printed

Re: gc.garbage

2007-08-30 Thread 7stud
On Aug 30, 12:36 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 8/30/07, 7stud <[EMAIL PROTECTED]> wrote: > > > On Aug 30, 3:50 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > > > gc.set_debug(gc.DEBUG_LEAK) > &

Re: why should I learn python

2007-09-07 Thread 7stud
On Sep 6, 9:20 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 06 Sep 2007 23:34:10 -0300, Grant Edwards <[EMAIL PROTECTED]> > escribi?: > > > On 2007-09-06, Torsten Bronger <[EMAIL PROTECTED]> wrote: > >> Hallöchen! > > >> Tom Brown writes: > > >>> [...] Python has been by far the e

Re: why should I learn python

2007-09-07 Thread 7stud
On Sep 6, 10:51 pm, James Stroud <[EMAIL PROTECTED]> wrote: > BartlebyScrivener wrote: > > On Sep 6, 5:36 pm, André <[EMAIL PROTECTED]> wrote: > > >> Easy to read, easy to write, good libraries and, I have found, an > >> extremely helpful community. > > >> Hobbyists (like me) can work on projects w

problem with str()

2007-03-15 Thread 7stud
I can't get the str() method to work in the following code(the last line produces an error): class test: """class test""" def __init__(self): """I am init func!""" self.num = 10 self.num2 = 20 def someFunc(self):

Re: problem with str()

2007-03-15 Thread 7stud
Sheesh! You would think that after looking at every inch of the code for way too many hours, at some point that would have poked me in the eye. Thanks all. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with str()

2007-03-15 Thread 7stud
On Mar 15, 5:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > The fact that a list comprehension "leaks" its variables into the > containing scope is a bit weird. > A generator expression doesn't: > > py> str > > py> w = (str for str in range(10)) > py> w > > py> str > > py> w.next() >

Re: Pickle Problem

2007-03-15 Thread 7stud
> I'm trying to make the transition from Java > The biggest thing that was messing me up was the > mandatory "self" input. For some reason I was thinking > that, if I had parenthesis, I would have to define it. I think things are pretty similar in Java. Java does the same thing except 'self' is

Re: python noob, multiple file i/o

2007-03-16 Thread 7stud
The general idiom for altering lines in a file is to open the original file and write the alterations to a temp file. After you are done writing to the temp file, delete the original file, and change the temp file name to the original file name. If instead you were to read the whole file into a va

Re: python noob, multiple file i/o

2007-03-16 Thread 7stud
On Mar 16, 9:38 am, "7stud" <[EMAIL PROTECTED]> wrote: > - > import os > > filepath = "./change_files" > > li = os.listdir(filepath) > for name in li: > fullpath = filepath + "/" + name > if os.path

Re: TypeError: 'module' object is not callable

2007-03-16 Thread 7stud
Hi, I can't find any documentation on the profile() function. But it might take a function reference as an argument and not the string you are feeding it. For instance: profile(t.printworld) Note the difference between: t.printworld t.printworld() The latter executes the function and then re

Re: Finding the insertion point in a list

2007-03-16 Thread 7stud
How about: --- x = [0, 100, 200, 1000] y = -1 inserted = False for i in range(len(x)): if(y <= x[i]): x.insert(i, y) inserted = True break if(not inserted): x.append(y) print x -- http://mail.python.org/mailman/listin

Re: Executing a list of functions

2007-03-16 Thread 7stud
lst = [a, b] The () symbol causes the named function to execute, and a function call in the code is always replaced by the function's return value. -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing a list of functions

2007-03-16 Thread 7stud
On Mar 16, 3:59 pm, "7stud" <[EMAIL PROTECTED]> wrote: > lst = [a, b] > > The () symbol causes the named function to execute, and a function > call in the code is always replaced by the function's return value. Try this: -- def a(): print "this

Re: Python shell on mac os x

2007-03-16 Thread 7stud
On Mar 16, 2:53 am, [EMAIL PROTECTED] wrote: > or go tohttp://pythonmac.org/packages/ > and you have python 2.5 or python 2.4.4 with readline support The download instructions seem to steer Mac users to version 2.4.4 because it has more modules available. What is the consensus on that? -- http:

Re: Finding the insertion point in a list

2007-03-17 Thread 7stud
On Mar 17, 4:12 am, "Martin Blume" <[EMAIL PROTECTED]> wrote: > "7stud" schrieb > > > > > How about: > > > --- > > x = [0, 100, 200, 1000] > > y = -1 > > inserted = False > > > for

Re: Finding the insertion point in a list

2007-03-18 Thread 7stud
On Mar 18, 2:23 am, Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > > >max(i for i,t in enumerate(x) if t <= y) > > > Those are actually pretty direct. > > > How about a solution (like the bisect one suggested almost as soon as > > this thread started)

* operator--as in *args?

2007-03-18 Thread 7stud
Hi, I can't find any documentation for the * operator when applied in front of a name. Is it a pointer? What about the @ operator? Are there python names for these operators that would make searching for documentation on them more fruitful? Thanks -- http://mail.python.org/mailman/listinfo/p

Re: * operator--as in *args?

2007-03-18 Thread 7stud
On Mar 18, 3:40 pm, "Dustan" <[EMAIL PROTECTED]> wrote: > For example: > aFunction(*(1,2,3)) > is equivalent to: > aFunction(1,2,3) > That's the context I've seen it in, but written like this: someFunc(*args) I played around with it a little bit, and it appears the * operator unpacks a list, tup

class objects, method objects, function objects

2007-03-18 Thread 7stud
Hi, I'm trying to figure out what this passage from GvR's tutorial means: --- Class definitions, like function definitions (def statements) must be executed before they have any effect When a class definition is entered, a new namespace is created... When a class definition is left norma

Re: class objects, method objects, function objects

2007-03-18 Thread 7stud
Oops, here is that last sentence in context(section 9.3.4): What exactly happens when a method is called? You may have noticed that x.f() was called without an argument above, even though the function definition for f specified an argument. What happened to the argument? Surely Python

<    1   2   3   4   5   6   >