Re: os.walk and os.listdir problems python 3.0+

2009-06-24 Thread Mark Tolonen
"Amos Anderson" wrote in message news:a073a9cf0906242007k5067314dn8e9d7b1c6da62...@mail.gmail.com... I've run into a bit of an issue iterating through files in python 3.0 and 3.1rc2. When it comes to a files with '\u200b' in the file name it gives the error... Traceback (most recent call la

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread rom
Ok. I think I got it. I have to do it in this way: ### import Tkinter import tkFileDialog filename='' root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=lambda: open_file_dialog()).pack() def open_file_dialog(): global filename filename = tk

Re: Problem with multithreading

2009-06-24 Thread Scott David Daniels
Jeffrey Barish wrote: Jeffrey Barish wrote: print "about to try" try: print "in try" As I ponder this problem, I am beginning to believe that the problem is not related to multithreading. If the problem were due to a collision between the two threads then timing would matter,

Re: fileinput.input, readlines and ...

2009-06-24 Thread Private Private
On Jun 24, 12:23 pm, Przemyslaw Bak wrote: > Hello, > > I many files with log data. The structure of the file is quite Each requested value is in separated file. While traversing using os.path.walk I have noticed that I get files unsorted. Is it possible to get them sorted ? przemol -- http://m

Re: fileinput.input, readlines and ...

2009-06-24 Thread Private Private
On Jun 24, 11:00 pm, Peter Otten <__pete...@web.de> wrote: > Private Private wrote: > > > lines = fileinput.input(filename) > > > for line in lines: > > >     if "Data2" in line: > > >         print line.strip(), "-->", next(lines).strip() > > > I get an error: > > > ... > >     print line.strip(),

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread rom
Thanks for your response. I have modified this minimal program as you suggested but still is not able to print the filename: ## import Tkinter import tkFileDialog global filename filename='' root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=lambda: open

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread norseman
OOPS - I left out the global statement rom wrote: Hi there, I am writing an interface with Tkinter. My minimal program looks like this: # import Tkinter import tkFileDialog # define globals here filename= '' # will take care of the problem root = Tkinter.Tk() Tkinter.Butto

Re: It's ...

2009-06-24 Thread Scott David Daniels
Scott David Daniels wrote: Angus Rodgers wrote: ... my first ... question is how best to find out what's changed from version 2.1 > to version 2.5. (I've recently installed 2.5.4) Consecutively read: http://docs.python.org/whatsnew/2.2.html As someone else pointed out: http://www.p

Re: Paramiko help - processing multiple commands

2009-06-24 Thread Noah Dain
On Wed, Jun 24, 2009 at 8:35 PM, Frank Ruiz wrote: > Hi Jon, > > Thanks for the reply. So there are no errors. Essentially everything > runs as planned. Sorry for being ignorant, but I am not sure if there > is another way for providing trace data. I will look into what other > debugging I can prov

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread norseman
rom wrote: Hi there, I am writing an interface with Tkinter. My minimal program looks like this: # import Tkinter import tkFileDialog # define globals here filename= '' # will take care of the problem root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=la

Re: Problem with multithreading

2009-06-24 Thread Jeffrey Barish
Jeffrey Barish wrote: > I have a program that uses multithreading to monitor two loops. When > something happens in loop1, it sends a message to loop2 to have it execute > a command. loop2 might have to return a result. If it does, it puts the > result in a queue. loop1, meanwhile, would have

Re: Matplotlib - an odd problem

2009-06-24 Thread koranthala
On Jun 25, 2:55 am, Jean-Paul Calderone wrote: > On Wed, 24 Jun 2009 11:38:02 -0700 (PDT), koranthala > wrote: > >Hi, > >I am using Matplotlib with Django to display charts on the web page. > >I am facing an odd problem in that, everytime I do a refresh on the > >web page, the image darkens - an

os.walk and os.listdir problems python 3.0+

2009-06-24 Thread Amos Anderson
I've run into a bit of an issue iterating through files in python 3.0 and 3.1rc2. When it comes to a files with '\u200b' in the file name it gives the error... Traceback (most recent call last): File "ListFiles.py", line 19, in f.write("file:{0}\n".format(i)) File "c:\Python31\lib\enco

Re: Dictionary self lookup

2009-06-24 Thread Carl Banks
On Jun 24, 2:39 am, Norberto Lopes wrote: > Hi all. > Assuming that python dictionaries already provide a bit of "shoot > yourself in the foot", I think what I have in mind would not be so > bad. > > What do you think of dictionaries having a self lookup in their > declaration? > > Be able to do t

tkinter: get filename of askopenfilename

2009-06-24 Thread rom
Hi there, I am writing an interface with Tkinter. My minimal program looks like this: # import Tkinter import tkFileDialog root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=lambda: open_file_dialog()).pack() def open_file_dialog(): filename = tkFileDialog.a

Re: Converting Python code to C/C++

2009-06-24 Thread Carl Banks
On Jun 24, 7:10 am, Grant Edwards wrote: > On 2009-06-24, Couper, Tim T wrote: > > > Your prof. may find this thread of interest > > >http://mail.python.org/pipermail/python-list/2000-June/039779.html > > > My experience is that developers who know C and C++ can be productive in > > less than 1 w

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread John Machin
On Jun 25, 7:17 am, Lie Ryan wrote: > MRAB wrote: > > There's no difference between the two types of quote character. > > a small exception is single-quote can contain double quote but cannot > contain unescaped single quote while double-quote can contain single > quote but cannot contain unescape

Re: [Mac] file copy

2009-06-24 Thread Tommy Nordgren
On Jun 23, 2009, at 4:54 PM, Diez B. Roggisch wrote: Tobias Weber wrote: Hi, which is the best way to copy files on OS X? I want to preserve resource forks and extended attributes. Are these still relevant on OSX? I've always only copied files directly, and never had any troubles. Di

Re: Paramiko help - processing multiple commands

2009-06-24 Thread Frank Ruiz
Hi Jon, Thanks for the reply. So there are no errors. Essentially everything runs as planned. Sorry for being ignorant, but I am not sure if there is another way for providing trace data. I will look into what other debugging I can provide. Essentially what happens is that only the second command

Re: Converting Python code to C/C++

2009-06-24 Thread Neuruss
On 23 jun, 12:49, Kurt Smith wrote: > On Mon, Jun 22, 2009 at 9:49 PM, Andras > > > > > > Pikler wrote: > > Hi! > > > Short: I need to turn a Python program that I (mostly) wrote into C code, > > and I am at a loss. > > > Long: I’m doing research/programming for a professor, and we are working > >

Re: It's ...

2009-06-24 Thread J. Clifford Dyer
On Wed, 2009-06-24 at 14:54 -0700, Aahz wrote: > In article , > J. Cliff Dyer wrote: > > > >Glad you're enjoying Beazley. I would look for something more > >up-to-date. Python's come a long way since 2.1. I'd hate for you to > >miss out on all the iterators, booleans, codecs, subprocess, yield,

Re: Paramiko help - processing multiple commands

2009-06-24 Thread Jon Clements
On Jun 24, 11:22 pm, Frank Ruiz wrote: > Greetings, > > I am trying to process multiple commands using paramiko. I have > searched other threads, and I think my use case is a little different. > I am trying to login to a storage node that has a special shell, and > as such I cant execute a script

Re: It's ...

2009-06-24 Thread Angus Rodgers
On Wed, 24 Jun 2009 22:43:01 +0100, I wrote: >No point in nailing this polly to the perch any more! Indeed not, so please skip what follows (I've surely been enough of an annoying newbie, already!), but I've just remembered why I wrote my program in such an awkward way. I wanted to be able to im

Re: dynamically associate radio buttons with droplists

2009-06-24 Thread Che M
On Jun 24, 10:37 am, a...@pythoncraft.com (Aahz) wrote: > In article > <16b382ee-a3ae-46ee-88fd-d87fc40d2...@g20g2000vba.googlegroups.com>, > > > > Shoryuken   wrote: > >On Jun 21, 8:43=A0pm, a...@pythoncraft.com (Aahz) wrote: > >> In article >.com>,LeoBrugud=A0 wrote: > > >>>Not being very famil

Paramiko help - processing multiple commands

2009-06-24 Thread Frank Ruiz
Greetings, I am trying to process multiple commands using paramiko. I have searched other threads, and I think my use case is a little different. I am trying to login to a storage node that has a special shell, and as such I cant execute a script on the storage node side. I am also trying to avoi

Re: urllib2.urlopen issue

2009-06-24 Thread Miles Kaufmann
On Jun 24, 2009, at 2:59 PM, David wrote: On Jun 24, 11:27 am, Chris Rebert wrote: On Wed, Jun 24, 2009 at 10:50 AM, David wrote: hello, I have a url that is "http://query.directrdr.com/ptrack? pid=225&v_url=http:// www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said". If I open

Re: Get name of class without instance

2009-06-24 Thread Christian Heimes
Terry Reedy wrote: > Bryan wrote: > >> How come dir(Foo) does not show __name__? That is how I was >> investigating the possibilities. > > Interesting question. Seems like an oversight. dir(some_module) and > dir(some_function) include '__name__'. I suggest you search the tracker > for existing

Re: It's ...

2009-06-24 Thread Aahz
In article , J. Cliff Dyer wrote: > >Glad you're enjoying Beazley. I would look for something more >up-to-date. Python's come a long way since 2.1. I'd hate for you to >miss out on all the iterators, booleans, codecs, subprocess, yield, >unified int/longs, decorators, decimals, sets, context ma

Re: Matplotlib - an odd problem

2009-06-24 Thread Jean-Paul Calderone
On Wed, 24 Jun 2009 11:38:02 -0700 (PDT), koranthala wrote: Hi, I am using Matplotlib with Django to display charts on the web page. I am facing an odd problem in that, everytime I do a refresh on the web page, the image darkens - and the text becomes little unreadable. 5/6 refreshes later, the

Re: It's ...

2009-06-24 Thread Angus Rodgers
On Wed, 24 Jun 2009 14:10:54 -0700, Scott David Daniels wrote: >Angus Rodgers wrote: > >> from types import StringType # Is this awkwardness necessary? >Nope I'm starting to see some of the mental haze that was confusing me. >Also, expandtabs is an instance method, so the roundabout is not ne

Re: Reading then sending new parts of a log file

2009-06-24 Thread Dave Angel
Chuck Connors wrote: Hey guys. I'm trying to work up a little program that will send any new lines written to a file (log file from my home automation software) to me via instant message. I've gotten the instant message sending part figured out using xmpppy. I've done a few things with Python

Re: Problem with multithreading

2009-06-24 Thread Lie Ryan
Jeffrey Barish wrote: > I have a program that uses multithreading to monitor two loops. When > something happens in loop1, it sends a message to loop2 to have it execute > a command. loop2 might have to return a result. If it does, it puts the > result in a queue. loop1, meanwhile, would have b

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread Lie Ryan
MRAB wrote: > There's no difference between the two types of quote character. a small exception is single-quote can contain double quote but cannot contain unescaped single quote while double-quote can contain single quote but cannot contain unescaped double quote. -- http://mail.python.org/mai

Re: It's ...

2009-06-24 Thread Angus Rodgers
On Wed, 24 Jun 2009 22:12:33 +0100, I wrote: >How exactly do I get detab, as a function from strings to strings >(for a fixed tab size)? (It's OK - this has been explained in another reply. I'm still a little hazy about what exactly objects are in Python, but the haze will soon clear, I'm sure,

Re: It's ...

2009-06-24 Thread Angus Rodgers
On Wed, 24 Jun 2009 16:40:29 -0400, "J. Cliff Dyer" wrote: >On Wed, 2009-06-24 at 20:53 +0100, Angus Rodgers wrote: >> [...] >> from types import StringType # Is this awkwardness necessary? > >Not anymore. You can just use str for this. > >> detab = lambda s : StringType.expandtabs(s, stop) #

Re: Reading then sending new parts of a log file

2009-06-24 Thread Chuck Connors
On Jun 24, 2:48 pm, unayok wrote: > Here's a little nudge:http://code.activestate.com/recipes/157035/ > > In place of its "print" line, you'd make your call into your existing > code to send the message. Wow! Thanks for the _shove_ in the right direction. Looks perfect. -- http://mail.python.o

Re: Paramiko Help

2009-06-24 Thread MRAB
Frank Ruiz wrote: Apologies.. Python newb here.. switching from perl to python.. so please forgive if this is a dumb question. I am using the paramiko module and have some global variables defined. i.e. hostname = ' 10.10.10.10' sshport = '22' I am then trying to pass this variable into the c

Re: installation in mac os x

2009-06-24 Thread Philip Semanchuk
On Jun 24, 2009, at 4:48 PM, Karl Jansson wrote: What happens if you work on the commandline (Terminal)? Python2.6 should be available from (out of my head) /Library/Frameworks/Python.framework/Versions/2.6/bin/python If that's working, it is successfully installed. Diez -- http://mail.pyt

Re: fileinput.input, readlines and ...

2009-06-24 Thread Scott David Daniels
Private Private wrote: On Jun 24, 1:32 pm, Peter Otten <__pete...@web.de> wrote: ... lines = fileinput.input(filename) for line in lines: if "Data2" in line: print line.strip(), "-->", next(lines).strip() I get an error: ... print line.strip(), "-->", next(lines).strip() Name

Problem with multithreading

2009-06-24 Thread Jeffrey Barish
I have a program that uses multithreading to monitor two loops. When something happens in loop1, it sends a message to loop2 to have it execute a command. loop2 might have to return a result. If it does, it puts the result in a queue. loop1, meanwhile, would have blocked waiting for something t

Re: Paramiko Help

2009-06-24 Thread Chris Rebert
On Wed, Jun 24, 2009 at 2:01 PM, Frank Ruiz wrote: > Apologies.. Python newb here.. switching from perl to python.. so > please forgive if this is a dumb question. > > I am using the paramiko module and have some global variables defined. > > i.e. > > hostname = ' 10.10.10.10' > sshport = '22' I'm

Re: Paramiko Help

2009-06-24 Thread Jon Clements
On Jun 24, 10:01 pm, Frank Ruiz wrote: > Apologies.. Python newb here.. switching from perl to python.. so > please forgive if this is a dumb question. > > I am using the paramiko module and have some global variables defined. > > i.e. > > hostname = ' 10.10.10.10' > sshport = '22' > > I am then t

Re: It's ...

2009-06-24 Thread Scott David Daniels
Angus Rodgers wrote: ... my first ... question is how best to find out what's changed from version 2.1 > to version 2.5. (I've recently installed 2.5.4) Consecutively read: http://docs.python.org/whatsnew/2.2.html http://docs.python.org/whatsnew/2.3.html http://docs.python.org/whatsn

Re: fileinput.input, readlines and ...

2009-06-24 Thread Peter Otten
Private Private wrote: > > lines = fileinput.input(filename) > > for line in lines: > > if "Data2" in line: > > print line.strip(), "-->", next(lines).strip() > > I get an error: > > ... > print line.strip(), "-->", next(lines).strip() > NameError: global name 'next' is not defin

Paramiko Help

2009-06-24 Thread Frank Ruiz
Apologies.. Python newb here.. switching from perl to python.. so please forgive if this is a dumb question. I am using the paramiko module and have some global variables defined. i.e. hostname = ' 10.10.10.10' sshport = '22' I am then trying to pass this variable into the client connect method

Re: installation in mac os x

2009-06-24 Thread Karl Jansson
What happens if you work on the commandline (Terminal)? Python2.6 should be available from (out of my head) /Library/Frameworks/Python.framework/Versions/2.6/bin/python If that's working, it is successfully installed. Diez -- http://mail.python.org/mailman/listinfo/python-list If I work o

Re: [SPAM] It's ...

2009-06-24 Thread MRAB
Angus Rodgers wrote: [snip] This sort of thing seems to work, in the interpreter (for an ASCII text file, named 'h071.txt', in the current directory): stop = 3 # Tab stops every 3 characters from types import StringType # Is this awkwardness necessary? detab = lambda s : StringType.expandta

Re: It's ...

2009-06-24 Thread J. Cliff Dyer
On Wed, 2009-06-24 at 20:53 +0100, Angus Rodgers wrote: > ... my first Python program! So please be gentle (no fifty ton > weights on the head!), but tell me if it's properly "Pythonic", > or if it's a dead parrot (and if the latter, how to revive it). > Yay. Welcome to Python. > I'm working

Re: How to find info about python 3.x extension module availability?

2009-06-24 Thread Aahz
In article <2838671f-d582-4af1-b850-ccc18ff9d...@a36g2000yqc.googlegroups.com>, Francesco Bochicchio wrote: > >is there any site that reports the current porting (to Python 3.x) >status of the main non-standard extension modules (such as pygtk, >pywin32, wxpython, ...) ? Feel free to create a wi

Re: It's ...

2009-06-24 Thread Angus Rodgers
On Wed, 24 Jun 2009 20:53:49 +0100, I wrote: >[...] my first newbie question is how best to find out >what's changed from version 2.1 to version 2.5. >[...] is there a quick online way to find this out? One way seems to be:

Re: fileinput.input, readlines and ...

2009-06-24 Thread Scott David Daniels
Peter Otten wrote: Scott David Daniels wrote: Peter Otten wrote: with open(filename) as instream: lines = (line.strip() for line in lines) lookup = dict(zip(lines, lines)) Little bit of a fluff-up here. Sorry, it should have been with open(filename) as instream: lines = (lin

Re: fileinput.input, readlines and ...

2009-06-24 Thread Private Private
On Jun 24, 1:32 pm, Peter Otten <__pete...@web.de> wrote: > Przemyslaw Bak wrote: > > Hello, > > > I many files with log data. The structure of the file is quite > > inconvenience and similar to the following example: > > Data1 > >   ValueA > > Data2 > >   ValueB > > Data3 > >   ValueC > > ... > >

Re: Reading a large csv file

2009-06-24 Thread Lie Ryan
Mag Gam wrote: > Sorry for the delayed response. I was trying to figure this problem > out. The OS is Linux, BTW Maybe I'm just being pedantic, but saying your OS is Linux means little as there are hundreds of variants (distros) of Linux. (Not to mention that Linux is a kernel, not a full blown OS

It's ...

2009-06-24 Thread Angus Rodgers
... my first Python program! So please be gentle (no fifty ton weights on the head!), but tell me if it's properly "Pythonic", or if it's a dead parrot (and if the latter, how to revive it). I'm working from Beazley's /Python: Essential Reference/ (2nd ed. 2001), so my first newbie question is h

Re: Reading then sending new parts of a log file

2009-06-24 Thread unayok
On Jun 24, 10:23 am, Chuck Connors wrote: > Hey guys.  I'm trying to work up a little program that will send any > new lines written to a file (log file from my home automation > software) to me via instant message.  I've gotten the instant message > sending part figured out using xmpppy. > > I've

Re: urllib2.urlopen issue

2009-06-24 Thread David
On Jun 24, 11:27 am, Chris Rebert wrote: > On Wed, Jun 24, 2009 at 10:50 AM, David wrote: > > hello, > > > I have a url that is "http://query.directrdr.com/ptrack? > > pid=225&v_url=http:// > >www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said". > > If I open it on a browser, I can

Re: Reading then sending new parts of a log file

2009-06-24 Thread Chuck Connors
On Jun 24, 11:57 am, Scott David Daniels wrote: > What OS and version, what Python and version. Win XP, Python 2.6.2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Get name of class without instance

2009-06-24 Thread Terry Reedy
Bryan wrote: How come dir(Foo) does not show __name__? That is how I was investigating the possibilities. Interesting question. Seems like an oversight. dir(some_module) and dir(some_function) include '__name__'. I suggest you search the tracker for existing issues on this subject and add a

Matplotlib - an odd problem

2009-06-24 Thread koranthala
Hi, I am using Matplotlib with Django to display charts on the web page. I am facing an odd problem in that, everytime I do a refresh on the web page, the image darkens - and the text becomes little unreadable. 5/6 refreshes later, the text becomes completely unreadable. Since I am using Django tes

Re: Converting Python code to C/C++

2009-06-24 Thread Grant Edwards
On 2009-06-24, Terry Reedy wrote: > Your professor should wait until your Python version is complete and in > final form and until a C version is needed. Then hire someone competent > in both languages to do the translation. Professor... hire... Good one! :) -- Grant Edwards

Re: isinstance(obj, type(obj)) == True?

2009-06-24 Thread Terry Reedy
Art wrote: I have the following problem: ipdb> p type(self) ipdb> isinstance(self, component.BiasComponent) False I thought that isinstance(obj, type(obj)) == True. Yes, but that is not what you entered ;-). The name 'component.BiasComponent' is not bound to type(self), but to another objec

Re: urllib2.urlopen issue

2009-06-24 Thread Chris Rebert
On Wed, Jun 24, 2009 at 10:50 AM, David wrote: > hello, > > I have a url that is "http://query.directrdr.com/ptrack? > pid=225&v_url=http:// > www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said". > If I open it on a browser, I can get its contents without any > problem. > However, i

Re: urllib2.urlopen issue

2009-06-24 Thread Aahz
In article <854313cf-6323-4ca9-b883-65ca8f414...@v23g2000pro.googlegroups.com>, David wrote: > >import urllib2 >url = 'http://query.directrdr.com/ptrack?pid=225&v_url=http:// >www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said' >xml = urllib2.urlopen(url).read() > >then I get an e

talk of concurrency by Anders Hejlsberg and Guy Steele

2009-06-24 Thread Xah Lee
of recent talks about concurrency, this video interview would be of interest: http://channel9.msdn.com/posts/Charles/Anders-Hejlsberg-and-Guy-Steele-Concurrency-and-Language-Design/ Anders Hejlsberg and Guy Steele: Concurrency and Language Design Posted By: Charles | Oct 6th, 2008 @ 6:27 AM | 75,

Re: Dictionary self lookup

2009-06-24 Thread Norberto Lopes
On Jun 24, 6:26 pm, Scott David Daniels wrote: > Norberto Lopes wrote: > > On Jun 24, 1:21 pm, "Diez B. Roggisch" wrote: > >> Norberto Lopes wrote: ... > >>> config = {"home" : "/home/test"} > >>> config["user1"] = config["home"] + "/user1" > >>> config["user2"] = config["home"] + "/user2" > >>>

urllib2.urlopen issue

2009-06-24 Thread David
hello, I have a url that is "http://query.directrdr.com/ptrack? pid=225&v_url=http:// www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said". If I open it on a browser, I can get its contents without any problem. However, if I use following code, import urllib2 url = 'http://query

Re: fileinput.input, readlines and ...

2009-06-24 Thread Peter Otten
Scott David Daniels wrote: > Peter Otten wrote: >> with open(filename) as instream: >> lines = (line.strip() for line in lines) >> lookup = dict(zip(lines, lines)) > Little bit of a fluff-up here. Sorry, it should have been with open(filename) as instream: lines = (line.strip()

Re: IMPORTANT: I NEED TO HELP WITH ONE OF THE CORE DEVELOPERS

2009-06-24 Thread Chris Rebert
On Wed, Jun 24, 2009 at 6:22 AM, Pegasus wrote: > I need help with an implementation of your > interpreter under PSPE/PSP. > > I need to know something about the C > functions that are recalled by the interpreter > when it executes a .pyc file. > > Our version of ndPython is very slow in > executio

Re: Converting Python code to C/C++

2009-06-24 Thread Terry Reedy
Short: I need to turn a Python program that I (mostly) wrote into C code, and I am at a loss. Now, my professor would like to have this exact code in C/C++, as she believes C is more compatible with MATLAB, and wants the code to be available in multiple languages in case a programmer works f

Re: reply to OT diversion (was: What is the best method to match a pattern in set of lines

2009-06-24 Thread Ross Ridge
a...@pythoncraft.com (Aahz) writes: > Guess what? Prior to DejaNews, discussions on Usenet *were* ephemeral, > and it all worked. Not really, Usenet was archived before DejaNews arrived on the scene. I can find plenty of my posts from before then. Regardless, Usenet works better now that searcha

Re: isinstance(obj, type(obj)) == True?

2009-06-24 Thread Chris Rebert
On Wed, Jun 24, 2009 at 7:57 AM, Art wrote: > I have the following problem: > > ipdb> p type(self) > > > ipdb> isinstance(self, component.BiasComponent) > False > > I thought that isinstance(obj, type(obj)) == True. > > The specific problem is when I try to call the super of a class and it > only

Re: Measuring Fractal Dimension ?

2009-06-24 Thread pdpi
On Jun 24, 1:32 pm, Mark Dickinson wrote: > On Jun 24, 10:12 am, pdpi wrote: > > > Regarding inf ** 0, why does IEEE745 define it as 1, when there is a > > perfectly fine NaN value? > > Other links:  the IEEE 754 revision working group mailing list > archives are public;  there was extensive disc

Re: Best way to enumerate classes in a module

2009-06-24 Thread Terry Reedy
Дамјан Георгиевски wrote: I need to programmaticaly enumerate all the classes in a given module. Currently I'm using dir(module) but the Notice on the documentation page [1] says "dir() is supplied primarily as a convenience for use at an interactive prompt" so that kind of scares me. That n

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread MRAB
humn wrote: On Jun 24, 12:28 pm, unayok wrote: On Jun 24, 12:11 pm, humn wrote: but this doesn't: if '\title' in line: line = line.replace('\title{', '[size=150][b]') line = line.replace('}', '[/b][/size]') \t is an escaped character. so, '\title' will look for 'itle' Two

Re: Reading then sending new parts of a log file

2009-06-24 Thread Scott David Daniels
Chuck Connors wrote: Hey guys. I'm trying to work up a little program that will send any new lines written to a file (log file from my home automation software) to me via instant message. I've gotten the instant message sending part figured out using xmpppy. I've done a few things with Python

Re: Get name of class without instance

2009-06-24 Thread David Stanek
Try Foo.__name__ if Foo is a class object. On 6/24/09, Bryan wrote: > Given a class: > > class Foo(object): > pass > > How can I get the name "Foo" without having an instance of the class? > > str(Foo) gives me more than just the name Foo. "__main__.Account" > Foo.__class__.__name__ gives m

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread humn
On Jun 24, 12:28 pm, unayok wrote: > On Jun 24, 12:11 pm, humn wrote: > > > but this doesn't: > > > if '\title' in line: > >         line = line.replace('\title{', '[size=150][b]') > >         line = line.replace('}', '[/b][/size]') > > \t is an escaped character. so, '\title' will look for > 'i

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread Ken Dyck
On Jun 24, 12:11 pm, humn wrote: > I'm confused as to why this works: > > if '\chapter' in line: >         line = line.replace('\chapter{', '[b][u]') >         line = line.replace('}', '[/b][/u]') > > but this doesn't: > > if '\title' in line: >         line = line.replace('\title{', '[size=150][b

Re: A superclass using a child classes' methods

2009-06-24 Thread Kurt Schwehr
Jean-Michel, Thanks for the excellent response setting me straight. Now to figure out what dumb thing I did to make my code not work... -kurt On Jun 24, 12:23 pm, Jean-Michel Pichavant wrote: > Kurt Schwehr wrote: > > I'm trying to build an OO system for encoding and decoding > > datapackets.

Re: Get name of class without instance

2009-06-24 Thread J. Cliff Dyer
On Wed, 2009-06-24 at 09:17 -0700, Bryan wrote: > Given a class: > > class Foo(object): > pass > > How can I get the name "Foo" without having an instance of the class? > > str(Foo) gives me more than just the name Foo. "__main__.Account" > Foo.__class__.__name__ gives me "type" > > I don

Re: fileinput.input, readlines and ...

2009-06-24 Thread Scott David Daniels
Peter Otten wrote: ... If you need more than a few name value pairs it pays to put the data in a dictionary first: # assuming that values always consist of a single line with open(filename) as instream: lines = (line.strip() for line in lines) lookup = dict(zip(lines, lines)) print lo

Re: Get name of class without instance

2009-06-24 Thread Bryan
On Jun 24, 9:25 am, Tim Golden wrote: > Bryan wrote: > > Given a class: > > > class Foo(object): > >     pass > > > How can I get the name "Foo" without having an instance of the class? > > > str(Foo) gives me more than just the name Foo.   "__main__.Account" > > Foo.__class__.__name__ gives me "t

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread unayok
On Jun 24, 12:11 pm, humn wrote: > but this doesn't: > > if '\title' in line: >         line = line.replace('\title{', '[size=150][b]') >         line = line.replace('}', '[/b][/size]') \t is an escaped character. so, '\title' will look for 'itle' Two ways to fix this: 1. use r'\title' 2. use

Re: Get name of class without instance

2009-06-24 Thread Tim Golden
Bryan wrote: Given a class: class Foo(object): pass How can I get the name "Foo" without having an instance of the class? str(Foo) gives me more than just the name Foo. "__main__.Account" Foo.__class__.__name__ gives me "type" I don't want to do: Foo().__class__.__name__ if possible. I

Unable to get Tkinter menubar to appear under OS X

2009-06-24 Thread Eric Winter
Hi all. I've googled this issue several times and come up dry. Here's the situation: I have a X-windows build of Tkinter for Python built on an OS X machine (10.4 or 10.5, same issue). This is not the Aqua version of Tk, but Tk built from source using X-Window support. I also use a from- source bu

Re: Get name of class without instance

2009-06-24 Thread Jean-Michel Pichavant
Bryan wrote: Given a class: class Foo(object): pass How can I get the name "Foo" without having an instance of the class? str(Foo) gives me more than just the name Foo. "__main__.Account" Foo.__class__.__name__ gives me "type" I don't want to do: Foo().__class__.__name__ if possible. I

Re: A superclass using a child classes' methods

2009-06-24 Thread Jean-Michel Pichavant
Kurt Schwehr wrote: I'm trying to build an OO system for encoding and decoding datapackets. I'd like the parent class to have an encode function that uses each of the child classes' packing methods. It appears that this works for attributes of children accessed by the parent, but not for method

Re: Reading a large csv file

2009-06-24 Thread skip
Mag> s=0 Mag> #Takes the longest here Mag> for y in fs: Mag> continue Mag> a=y.split(',') Mag> s=s+1 Mag> dset.resize(s,axis=0) Mag> fs.close() Mag> f.close() Mag> This works but just takes a VERY long time. Mag> Any way to optimize this?

Re: Dictionary self lookup

2009-06-24 Thread Scott David Daniels
Norberto Lopes wrote: On Jun 24, 1:21 pm, "Diez B. Roggisch" wrote: Norberto Lopes wrote: ... config = {"home" : "/home/test"} config["user1"] = config["home"] + "/user1" config["user2"] = config["home"] + "/user2" config["python-dev"] = config["user1"] + "/py-dev" I'd write this as: home

Get name of class without instance

2009-06-24 Thread Bryan
Given a class: class Foo(object): pass How can I get the name "Foo" without having an instance of the class? str(Foo) gives me more than just the name Foo. "__main__.Account" Foo.__class__.__name__ gives me "type" I don't want to do: Foo().__class__.__name__ if possible. I would rather a

Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread humn
I'm writing a script to convert Latex commands to bbcode by using the str.replace function and I'm confused as to why this works: if '\chapter' in line: line = line.replace('\chapter{', '[b][u]') line = line.replace('}', '[/b][/u]') but this doesn't: if '\title' in line:

Re: Converting Python code to C/C++

2009-06-24 Thread Scott David Daniels
Couper, Tim T wrote: ... My experience is that developers who know C and C++ can be productive in less than 1 week in python, and find it liberating, and educational, to do so. And at the same time they will have added a second language to their toolbox. As Kurt points out, learning C/C++ takes c

Re: Converting Python code to C/C++

2009-06-24 Thread bobicanprogram
On Jun 23, 11:49 am, Kurt Smith wrote: > On Mon, Jun 22, 2009 at 9:49 PM, Andras > > > > Pikler wrote: > > Hi! > > > Short: I need to turn a Python program that I (mostly) wrote into C code, > > and I am at a loss. > > > Long: I’m doing research/programming for a professor, and we are working > >

Re: IDLE / Python 2.5 under Jaunty

2009-06-24 Thread duncan smith
Michiel Overtoom wrote: > > Duncan Smith wrote: > >> IDLE now refuses to >> respond to left click events (for code editing, menus etc. respond as >> expected). If I right click, then left click I can move the cursor, but >> that's not ideal. >> >> So, has anybody else had the left click issue w

Re: IMPORTANT: I NEED TO HELP WITH ONE OF THE CORE DEVELOPERS

2009-06-24 Thread Brian Quinlan
You could start by reading this: http://catb.org/~esr/faqs/smart-questions.html Cheers, Brian Pegasus wrote: I need help with an implementation of your interpreter under PSPE/PSP. I need to know something about the C functions that are recalled by the interpreter when it executes a .pyc file.

Re: A superclass using a child classes' methods

2009-06-24 Thread Michael Torrie
Kurt Schwehr wrote: > I'm trying to build an OO system for encoding and decoding > datapackets. I'd like the parent class to have an encode function > that uses each of the child classes' packing methods. It appears that > this works for attributes of children accessed by the parent, but not > fo

A superclass using a child classes' methods

2009-06-24 Thread Kurt Schwehr
I'm trying to build an OO system for encoding and decoding datapackets. I'd like the parent class to have an encode function that uses each of the child classes' packing methods. It appears that this works for attributes of children accessed by the parent, but not for methods. Is that right? Fo

Animate Surface / Clear Scene (vpython)

2009-06-24 Thread Philip Gröger
Hi there! I just found a nice vpython example program on how to create surfaces (its one of the standard examples if you download vpython ... called "faces_heightfield" - just search for that). Is there a way to animate this surface? All my attempts resulted in creating just another surface withou

isinstance(obj, type(obj)) == True?

2009-06-24 Thread Art
I have the following problem: ipdb> p type(self) ipdb> isinstance(self, component.BiasComponent) False I thought that isinstance(obj, type(obj)) == True. The specific problem is when I try to call the super of a class and it only occurs after 'reload'ing the file in the interpreter. What am I

Re: Python 3.0.1 and mingw

2009-06-24 Thread Gabriel Genellina
En Wed, 24 Jun 2009 08:55:07 -0300, lkcl escribió: On Jun 23, 10:59 pm, smartmobili wrote: I wanted to know if you have some patch to compile python 3.x on mingw platform because I found some but doesn't work very well : you should compile a 2.N version. [...] http://bugs.python.org/i

  1   2   >