Updating an OptionMenu every time the text file it reads from is updated (Tkinter)

2010-01-18 Thread Dr. Benjamin David Clarke
I currently have a program that reads in values for an OptionMenu from a text file. I also have an option to add a line to that text file which corresponds to a new value for that OptionMenu. How can I make that OptionMenu update its values based on that text file without restarting the program? In

Python IDE for MacOS-X

2010-01-18 Thread Jean Guillaume Pyraksos
What's the best one to use with beginners ? Something with integrated syntax editor, browser of doc... Thanks, JG -- http://mail.python.org/mailman/listinfo/python-list

Re: Generic Python Benchmark suite?

2010-01-18 Thread Anand Vaidya
On Jan 19, 5:42 am, Terry Reedy wrote: > On 1/18/2010 4:58 AM, Anand Vaidya wrote: > > > Is there a generic python benchmark suite in active development? I am > > looking forward to comparing some code on various python > > implementations (primarily CPython 2.x, CPython 3.x, UnladenSwallow, > > P

Re: python replace/sub/wildcard/regex issue

2010-01-18 Thread Chris Rebert
On Mon, Jan 18, 2010 at 8:31 PM, Chris Rebert wrote: > On Mon, Jan 18, 2010 at 8:04 PM, tom wrote: >> hi... >> >> trying to figure out how to solve what should be an easy python/regex/ >> wildcard/replace issue. >> >> i've tried a number of different approaches.. so i must be missing >> something

RE: python replace/sub/wildcard/regex issue

2010-01-18 Thread tom
hi chris... should the reply you sent me be implemented all on one line? like: test='Soo ChoiLONGEDITBOX">Apryl Berney' new_text = "\n".join(line[:line.index('<')] + line[line.rindex('>')+1:] for line in test.split('\n')) and what would line be? thanks -Original Message- From: python

Re: python replace/sub/wildcard/regex issue

2010-01-18 Thread alex23
On Jan 19, 2:04 pm, tom wrote: > trying to figure out how to solve what should be an easy python/regex/ > wildcard/replace issue. > but i'm missing something... Well, some would say you've missed the most obvious solution of _not_ using regexps :) I'd probably do it via string methods wrapped up

Re: python replace/sub/wildcard/regex issue

2010-01-18 Thread Chris Rebert
On Mon, Jan 18, 2010 at 8:04 PM, tom wrote: > hi... > > trying to figure out how to solve what should be an easy python/regex/ > wildcard/replace issue. > > i've tried a number of different approaches.. so i must be missing > something... > > my initial sample text are: > > Soo ChoiLONGEDITBOX">Ap

python replace/sub/wildcard/regex issue

2010-01-18 Thread tom
hi... trying to figure out how to solve what should be an easy python/regex/ wildcard/replace issue. i've tried a number of different approaches.. so i must be missing something... my initial sample text are: Soo ChoiLONGEDITBOX">Apryl Berney Soo ChoiLONGEDITBOX">Joel Franks Joel FranksGEDITBOX

Re: What is a list compression in Python?

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 16:24:11 -0800, Kit wrote: > Thank you so much guys. > > Just out of curiosity: can I do something like this to "square all even > numbers in the range 1-10"? > print [x^2 for x in range (1,11) if x % 2 == 0] ^ is the XOR operator in Python. You want: [x**2 for x in range (

Re: syntax

2010-01-18 Thread MRAB
marlowe wrote: I wrote this program, but i have a feeling like there might be a more practical way of writing it. Can someone give me an idea of how to simplify this? Here is an example of the csv file i am using. This program calculates the exponential moving average of the 20 day range. USOtab

Re: What is a list compression in Python?

2010-01-18 Thread MRAB
Kit wrote: Oops... print [x^2 for x in range (1,11) if x % 2 == 0] print [x^2 for x in range (1,10) if x % 2 == 0] The start is inclusive and the end is exclusive. This is a general rule in Python. In fact, there's only one exception that I know of: randint(a, b) in the 'random' module. --

Re: basic Class in Python

2010-01-18 Thread MRAB
bartc wrote: "Wolfgang Rohdewald" wrote in message news:mailman.1056.1263771299.28905.python-l...@python.org... On Monday 18 January 2010, BarryJOgorman wrote: TypeError: object._new_() takes no parameters def _init_(self, name, job=None, pay=0): __init__ needs two underscores left

Re: PyQwt installation

2010-01-18 Thread Chris Colbert
On Mon, Jan 18, 2010 at 6:15 PM, Gib Bogle wrote: > Should there be a problem installing PyQwt5.2.0 with PyQt4.4.4 and > Python2.6 on Windows? My student is saying she can't get the Windows > installer to work, and she points out that the download site says "Binary > installation of PyQwt-5.2.0 o

Re: inner methods and recursion

2010-01-18 Thread Steve Howell
On Jan 18, 6:07 pm, "Gabriel Genellina" wrote: > En Mon, 18 Jan 2010 19:00:17 -0300, Steve Howell   > escribió: > > > Hi, I have a style/design question relating to recursion and inner > > methods. > > > I wrote some code recently that implements a recursive algorithm that > > takes several param

Re: What is a list compression in Python?

2010-01-18 Thread Gib Bogle
Kit wrote: Thank you so much guys. Just out of curiosity: can I do something like this to "square all even numbers in the range 1-10"? print [x^2 for x in range (1,11) if x % 2 == 0] Why not try it? -- http://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing question

2010-01-18 Thread MRAB
Neal Becker wrote: I'm using multiprocessing as a crude batch queuing system, like this: import my_test_program as prog (where my_test_program has a function called 'run') def run_test (args): prog.run (args[1:]) cases = [] for t in test_conditions: args = [prog.__name__]+[more args...]

multiprocessing question

2010-01-18 Thread Neal Becker
I'm using multiprocessing as a crude batch queuing system, like this: import my_test_program as prog (where my_test_program has a function called 'run') def run_test (args): prog.run (args[1:]) cases = [] for t in test_conditions: args = [prog.__name__]+[more args...] cases.append (args

Re: inner methods and recursion

2010-01-18 Thread Gabriel Genellina
En Mon, 18 Jan 2010 19:00:17 -0300, Steve Howell escribió: Hi, I have a style/design question relating to recursion and inner methods. I wrote some code recently that implements a recursive algorithm that takes several parameters from the original caller. Once the algorithm starts running a

Re: syntax

2010-01-18 Thread marlowe
oh, and i need to make those a new column that is added to the csv file. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax

2010-01-18 Thread Matthew Barnett
marlowe wrote: I wrote this program, but i have a feeling like there might be a more practical way of writing it. Can someone give me an idea of how to simplify this? Here is an example of the csv file i am using. This program calculates the exponential moving average of the 20 day range. USOtab

Re: syntax

2010-01-18 Thread Chris Rebert
On Mon, Jan 18, 2010 at 5:23 PM, Chris Rebert wrote: > On Mon, Jan 18, 2010 at 4:53 PM, marlowe wrote: >> L=float(data[40][3])+float(data[41][3])+float(data[42][3])+float(data >> [43][3])\ >> +float(data[44][3])+float(data[45][3])+float(data[46][3])+float(data >> [47][3])\ >> +float(data[48][3])

Re: syntax

2010-01-18 Thread Chris Rebert
On Mon, Jan 18, 2010 at 4:53 PM, marlowe wrote: > I wrote this program, but i have a feeling like there might be a more > practical way of writing it. Can someone give me an idea of how to > simplify this? Here is an example of the csv file i am using. This > program calculates the exponential mov

Re: using super

2010-01-18 Thread Gabriel Genellina
En Mon, 18 Jan 2010 16:50:45 -0300, Jean-Michel Pichavant escribió: Duncan Booth wrote: Jean-Michel Pichavant wrote: class SubClass(Base): colour = "Red" def parrot(self): """docstring for Subclass""" return super(Subclass, self).parrot() I'm not a big fan of supe

syntax

2010-01-18 Thread marlowe
I wrote this program, but i have a feeling like there might be a more practical way of writing it. Can someone give me an idea of how to simplify this? Here is an example of the csv file i am using. This program calculates the exponential moving average of the 20 day range. USOtable.csv (full tabl

Re: What is a list compression in Python?

2010-01-18 Thread Kit
Cool! Thank you very much. You mean this instead right? print [x*x for x in xrange(1,11,2)] Kit On 1月19日, 上午8時36分, Gary Herron wrote: > Kit wrote: > > Thank you so much guys. > > > Just out of curiosity: can I do something like this to "square all > > even numbers in the range 1-10"? > > print

Re: What is a list compression in Python?

2010-01-18 Thread Gary Herron
Kit wrote: Thank you so much guys. Just out of curiosity: can I do something like this to "square all even numbers in the range 1-10"? print [x^2 for x in range (1,11) if x % 2 == 0] Or is there a better way of doing it? Thanks for the help, and I am really appreciate your help. That's a f

Re: What is a list compression in Python?

2010-01-18 Thread MRAB
Kit wrote: Thank you so much guys. Just out of curiosity: can I do something like this to "square all even numbers in the range 1-10"? print [x^2 for x in range (1,11) if x % 2 == 0] Or is there a better way of doing it? Thanks for the help, and I am really appreciate your help. That would be

Re: What is a list compression in Python?

2010-01-18 Thread Kit
Oops... > print [x^2 for x in range (1,11) if x % 2 == 0] print [x^2 for x in range (1,10) if x % 2 == 0] On 1月19日, 上午8時24分, Kit wrote: > Thank you so much guys. > > Just out of curiosity: can I do something like this to "square all > even numbers in the range 1-10"? > print [x^2 for x in range

Re: What is a list compression in Python?

2010-01-18 Thread Kit
Thank you so much guys. Just out of curiosity: can I do something like this to "square all even numbers in the range 1-10"? print [x^2 for x in range (1,11) if x % 2 == 0] Or is there a better way of doing it? Thanks for the help, and I am really appreciate your help. Kit. On 1月19日, 上午12時30分, S

Re: searching and storing large quantities of xml!

2010-01-18 Thread MRAB
dads wrote: [snip] import os.path import shutil import zlib import os There's no need to import both os.path and os. Import just os; you can still refer to os.path in the rest of the code. [snip] def _mkMonthAndDaysDirs(self): ''' creates dirs for every month and day of a of sp

Re: Py 3: Terminal script can't find relative path

2010-01-18 Thread John Bokma
Gnarlodious writes: > I am running a script in a browser that finds the file in subfolder > Data: > > Content=Plist('Data/Content.plist') > > However, running the same script in Terminal errors: > > IOError: [Errno 2] No such file or directory: 'Data/Content.plist' What does: ls -l Data/Content

PyQwt installation

2010-01-18 Thread Gib Bogle
Should there be a problem installing PyQwt5.2.0 with PyQt4.4.4 and Python2.6 on Windows? My student is saying she can't get the Windows installer to work, and she points out that the download site says "Binary installation of PyQwt-5.2.0 on Windows for Python-2.6.x, PyQt-4.5.4" -- http://mail.

Re: Parse a log file

2010-01-18 Thread kak...@gmail.com
On Jan 18, 11:56 pm, Tim Chase wrote: > kak...@gmail.com wrote: > > I want to parse a log file with the following format for > > example: > >               TIMESTAMPE            Operation     FileName > > Bytes > > 12/Jan/2010:16:04:59 +0200   EXISTS       sample3.3gp   37151 > > 12/Jan/2010:16:04

Py 3: Terminal script can't find relative path

2010-01-18 Thread Gnarlodious
I am running a script in a browser that finds the file in subfolder Data: Content=Plist('Data/Content.plist') However, running the same script in Terminal errors: IOError: [Errno 2] No such file or directory: 'Data/Content.plist' Is Py 3 unable to find relative paths? I tried all kinds of trick

Re: heapq._siftdown / decrease-key support?

2010-01-18 Thread Joshua Bronson
On Sun, Jan 17, 2010 at 11:30 PM, Raymond Hettinger wrote: > > > Raymond, do you think this technique is worth documenting in the heapq > > module? It'd be too bad if any future users incorrectly think that it > > won't meet their needs the way I did. > > Yes.  Please assign a tracker issue to me

Re: monitor reading file with thread

2010-01-18 Thread Aahz
In article <4b47712a$0$1115$4fafb...@reader4.news.tin.it>, wiso wrote: > >class Reader(): >def __init__(self,filename): >self.filename = filename >self.lineno = 0 >def __iter__(self): >f = open(self.filename) >for line in f: >self.lineno += 1 >

Re: r"string" vs R"string

2010-01-18 Thread Terry Reedy
On 1/18/2010 8:01 AM, Colin W. wrote: On 17-Jan-10 18:27 PM, Steven D'Aprano wrote: On Sun, 17 Jan 2010 11:13:48 -0500, Roy Smith wrote: In article, "Colin W." wrote: On 17-Jan-10 02:16 AM, Terry Reedy wrote: On 1/17/2010 1:55 AM, Brendan Miller wrote: Is there any difference whatsoever be

inner methods and recursion

2010-01-18 Thread Steve Howell
Hi, I have a style/design question relating to recursion and inner methods. I wrote some code recently that implements a recursive algorithm that takes several parameters from the original caller. Once the algorithm starts running and recursing, those parameters remain the same, so I define an in

Re: Parse a log file

2010-01-18 Thread Tim Chase
kak...@gmail.com wrote: I want to parse a log file with the following format for example: TIMESTAMPEOperation FileName Bytes 12/Jan/2010:16:04:59 +0200 EXISTS sample3.3gp 37151 12/Jan/2010:16:04:59 +0200 EXISTSsample3.3gp 37151 12/Jan/2010:16:04:

Re: Generic Python Benchmark suite?

2010-01-18 Thread Terry Reedy
On 1/18/2010 4:58 AM, Anand Vaidya wrote: Is there a generic python benchmark suite in active development? I am looking forward to comparing some code on various python implementations (primarily CPython 2.x, CPython 3.x, UnladenSwallow, Psyco). You might find this interesting if you have not s

Re: searching and storing large quantities of xml!

2010-01-18 Thread dads
Thanks all, took your advice and have been playing all weekend which has been great fun. ElementTree is awesome. I created a script that organises the xml as they're in year blocks and I didn't realise the required xml is mixed up with other xml. Plus the volumes are much greater than I realised, I

form mailer for info + files

2010-01-18 Thread Gregory
There is code all over on how to create a form mailer. I need an example that will show how to upload two files and send them along with form field info. Is it required to overwrite the python cgi.fieldstorage to do this? Working with Python 2.4.3. -- http://mail.python.org/mailman/listinfo/python

Re: I really need webbrowser.open('file://') to open a web browser

2010-01-18 Thread Timur Tabi
On Sat, Jan 16, 2010 at 3:43 PM, Paul Boddie wrote: > Generally, the desktop-specific tools should know that a browser is > the appropriate application for an HTML file, and testing with both > xdg-open, gnome-open and "kfmclient openURL" seems to open browsers on > HTML files (using file:///...)

Re: python gui ide under linux..like visual studio ;) ?

2010-01-18 Thread Mike Driscoll
On Jan 18, 8:32 am, ted wrote: > Hi at all... > Can someone please give me some advice, about a good IDE with control > GUI under Linux ? > > Actually i know QT Creator by Nokia which i can use with Python (but i > don't know how). > > And, a good library for access to database (mysql, sql server,

Re: Python decorator syntax limitations

2010-01-18 Thread Jonathan S
Thanks a lot, all of you! This was really helpful. (or at least give me the inspiration I needed to finish it.) I'm sure this is a use case where most other options are less readable than the chain of methods in the decorator. In this use case, I had a lot of Django views to which access permissio

Re: force URLencoding script

2010-01-18 Thread João
On Jan 15, 4:46 pm, r0g wrote: > João wrote: > > On Jan 15, 2:38 pm, r0g wrote: > >> João wrote: > >>> On Jan 14, 5:58 pm, r0g wrote: > João wrote: > > On Jan 12, 10:07 pm, r0g wrote: > >> João wrote: > > for the following data, > > authentication = "UID=somestring&" >

Re: force URLencoding script

2010-01-18 Thread João
On Jan 15, 4:46 pm, r0g wrote: > João wrote: > > On Jan 15, 2:38 pm, r0g wrote: > >> João wrote: > >>> On Jan 14, 5:58 pm, r0g wrote: > João wrote: > > On Jan 12, 10:07 pm, r0g wrote: > >> João wrote: > > for the following data, > > authentication = "UID=somestring&" >

Re: using super

2010-01-18 Thread Arnaud Delobelle
Jean-Michel Pichavant writes: [...] > Then is there a reason why return super(Subclass, self).parrot() > would be prefered over the "classic" return Base.parrot(self) > ? > > Or is it just a matter of preference ? Using super() calls the next method in the class's Method Resolution O

Re: Unable to install numpy

2010-01-18 Thread Robert Kern
On 2010-01-18 14:02 PM, vsoler wrote: Hi all, I just download Numpy, and tried to install it using "numpy-1.4.0- win32-superpack-python2.6.exe" I get an error: "Python version 2.6 required, which was not found in the Registry" However, I am using Python 2.6 every day. I'm running Windows 7.

Unable to install numpy

2010-01-18 Thread vsoler
Hi all, I just download Numpy, and tried to install it using "numpy-1.4.0- win32-superpack-python2.6.exe" I get an error: "Python version 2.6 required, which was not found in the Registry" However, I am using Python 2.6 every day. I'm running Windows 7. What can I do? -- http://mail.python.or

Re: using super

2010-01-18 Thread Jean-Michel Pichavant
Duncan Booth wrote: Jean-Michel Pichavant wrote: class SubClass(Base): colour = "Red" def parrot(self): """docstring for Subclass""" return super(Subclass, self).parrot() I'm not a big fan of super, but I'm still wondering if return super(self.__cl

Re: lightweight encryption of text file

2010-01-18 Thread Aahz
In article , Daniel Fetchinson wrote: > >Well, that's sort of true about learning a complex API :) But it's >also true that I'm not storing anything really valuable in the file >but still wouldn't want to leave it lying around in plain text. In >case I lose the laptop with the file I seriously do

Re: Python decorator syntax limitations

2010-01-18 Thread Arnaud Delobelle
a...@pythoncraft.com (Aahz) writes: > In article <4b54998...@dnews.tpgi.com.au>, > Lie Ryan wrote: >> >>If you are sure you can put up a convincing argument for lifting this >>restriction, and you are willing to put some time arguing, you are >>welcome to start a thread in the python-dev mailing

Re: substitution

2010-01-18 Thread Adi Eyal
> From: Steven D'Aprano > To: python-l...@python.org > Date: 18 Jan 2010 16:26:48 GMT > Subject: Re: substitution > On Mon, 18 Jan 2010 06:23:44 -0800, Iain King wrote: > >> On Jan 18, 2:17 pm, Adi Eyal wrote: > [...] >>> Using regular expressions the answer is short (and sweet) >>> >>> mapping =

Re: Python decorator syntax limitations

2010-01-18 Thread Aahz
In article <4b54998...@dnews.tpgi.com.au>, Lie Ryan wrote: > >If you are sure you can put up a convincing argument for lifting this >restriction, and you are willing to put some time arguing, you are >welcome to start a thread in the python-dev mailing list. Be sure to >read about previous discus

Re: Is python not good enough?

2010-01-18 Thread MRAB
Phlip wrote: On Jan 12, 7:09 am, ikuta liu wrote: Go language try to merge low level, hight level and browser language. Go uses := for assignment. This means, to appease the self-righteous indignation of the math professor who would claim = should mean "equality"... ...you gotta type a shi

Re: using super

2010-01-18 Thread Duncan Booth
Jean-Michel Pichavant wrote: > class SubClass(Base): colour = "Red" def parrot(self): """docstring for Subclass""" return super(Subclass, self).parrot() > I'm not a big fan of super, but I'm still wondering if > > >>> return super(self.__class__,

Re: python gui ide under linux..like visual studio ;) ?

2010-01-18 Thread Antoine Pitrou
Le Mon, 18 Jan 2010 15:32:36 +0100, ted a écrit : > > And, a good library for access to database (mysql, sql server, oracle) ? If you want something high-level: http://www.sqlalchemy.org/ You won't regret it :) -- http://mail.python.org/mailman/listinfo/python-list

using super

2010-01-18 Thread Jean-Michel Pichavant
class SubClass(Base): colour = "Red" def parrot(self): """docstring for Subclass""" return super(Subclass, self).parrot() I'm not a big fan of super, but I'm still wondering if >>> return super(self.__class__, self).parrot() would have made it. What if Subclass has mo

Re: Generic Python Benchmark suite?

2010-01-18 Thread Antoine Pitrou
Le Mon, 18 Jan 2010 01:58:42 -0800, Anand Vaidya a écrit : > Is there a generic python benchmark suite in active development? I am > looking forward to comparing some code on various python implementations > (primarily CPython 2.x, CPython 3.x, UnladenSwallow, Psyco). > > I am happy with something

Re: Python decorator syntax limitations

2010-01-18 Thread Peter Otten
Jonathan S wrote: > Hi all, > The following is what I want to do, but this results in a syntax > error: > > > @news_page('template.html').lookup(News, 'news_id', 'news') > def view(request, group, news): > pass > > > What does work is the equivalent old way of doing decorating: > > > def

Re: Generic Python Benchmark suite?

2010-01-18 Thread Antoine Pitrou
Le Mon, 18 Jan 2010 11:30:16 +0100, Stefan Behnel a écrit : > Anand Vaidya, 18.01.2010 10:58: >> Is there a generic python benchmark suite in active development? [...] >> PS: I think a benchmark should cover file / network, database I/O, >> data structures (dict, list etc), object creation/manipul

Re: Python decorator syntax limitations

2010-01-18 Thread Lie Ryan
On 01/19/10 03:44, Jonathan S wrote: > Any suggestions? I have my reasons for doing this, (news_page is a > class, and __call__ is used to wrap the template.) > I'm sure this is a limitation in the syntax, but would parenthesis > somewhere help? The restriction[1] is put in there since Guido has a

Re: ctypes: nested structures and pointers

2010-01-18 Thread Gabriele Modena
On Mon, Jan 18, 2010 at 10:33 AM, Gabriele Modena wrote: >  1. what is the correct (pythonic) way to capture the prototype > definition of dev_callbacks and the relation between that structure > and dev_info? > >  2. is it correct to wrap "connect", "transceive" and "disconnect" in > separate stru

Re: not and is not problem

2010-01-18 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 18 Jan 2010 16:43:25 +0100, superpollo wrote: hi: #!/usr/bin/env python data = "seq=123" name , value = data.split("=") print name print value if not name == "seq": print "DOES NOT PRINT OF COURSE..." if name is not "seq": print "WTF! WHY DOES IT PRI

Re: Python decorator syntax limitations

2010-01-18 Thread Steve Howell
On Jan 18, 8:44 am, Jonathan S wrote: > Hi all, > The following is what I want to do, but this results in a syntax > error: > > @news_page('template.html').lookup(News, 'news_id', 'news') > def view(request, group, news): >     pass > > What does work is the equivalent old way of doing decorating:

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 4:26 pm, Steven D'Aprano wrote: > On Mon, 18 Jan 2010 06:23:44 -0800, Iain King wrote: > > On Jan 18, 2:17 pm, Adi Eyal wrote: > [...] > >> Using regular expressions the answer is short (and sweet) > > >> mapping = { > >>         "foo" : "bar", > >>         "baz" : "quux", > >>        

Python decorator syntax limitations

2010-01-18 Thread Jonathan S
Hi all, The following is what I want to do, but this results in a syntax error: @news_page('template.html').lookup(News, 'news_id', 'news') def view(request, group, news): pass What does work is the equivalent old way of doing decorating: def view(request, group, news): pass view = ne

Re: Is python not good enough?

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 07:37:36 -0800, Phlip wrote: > They fixed the hideous redundancy of Java without the ill-defined scope > issues of Python Which ill-defined scope issues are you referring to? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python not good enough?

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 03:03:26 -0800, Phlip wrote: > On Jan 12, 7:09 am, ikuta liu wrote: > >> Go language try to merge low level, hight level and browser language. > > Go uses := for assignment. > > This means, to appease the self-righteous indignation of the math > professor who would claim =

Re: Arrrrgh! Another module broken

2010-01-18 Thread Grant Edwards
On 2010-01-18, Jive Dadson wrote: > I just found another module that broke when I went to 2.6. Gnuplot. > Apparently one of its routines has a parameter named "with." That used > to be okay, and now it's not. I remember seeing depreicated warnings about that _years_ ago, and I would have swor

py.test-1.2.0: junitxml, standalone test scripts, pluginization

2010-01-18 Thread holger krekel
Hi all, i just released some bits related to automated testing with Python: py-1.2.0: py.test core which grew junitxml, standalone-script generation pytest-xdist-1.0: separately installable dist-testing & looponfailing plugin pytest-figleaf-1.0: separately installable figleaf-coverage te

Re: What is a list compression in Python?

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 08:07:41 -0800, Kit wrote: > Hello Everyone, I am not sure if I have posted this question in a > correct board. Can anyone please teach me: > > What is a list compression in Python? Google "python list comprehension". If Google is broken for you, try Yahoo, or any other sear

Re: substitution

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 06:23:44 -0800, Iain King wrote: > On Jan 18, 2:17 pm, Adi Eyal wrote: [...] >> Using regular expressions the answer is short (and sweet) >> >> mapping = { >>         "foo" : "bar", >>         "baz" : "quux", >>         "quuux" : "foo" >> >> } >> >> pattern = "(%s)" % "|".join

Re: substitution

2010-01-18 Thread Anthra Norell
superpollo wrote: hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo --> bar baz --> quux quuux --> foo so that: fooxxxbazyyyquuux --> barxxxquuxyyyfoo bye Third attempt. Clearly something doesn't work right. My code gets clipped on the way up. I have

Re: What is a list compression in Python?

2010-01-18 Thread Stephen Hansen
On Mon, Jan 18, 2010 at 8:07 AM, Kit wrote: > Hello Everyone, I am not sure if I have posted this question in a > correct board. Can anyone please teach me: > > What is a list compression in Python? > > Would you mind give me some list compression examples? > Do you mean list *comprehension*? If

Re: not and is not problem

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 16:43:25 +0100, superpollo wrote: > hi: > > #!/usr/bin/env python > data = "seq=123" > name , value = data.split("=") > print name > print value > if not name == "seq": > print "DOES NOT PRINT OF COURSE..." > if name is not "seq": > print "WTF! WHY DOES IT PRINT?"

Re: substitution

2010-01-18 Thread Duncan Booth
Adi Eyal wrote: > Using regular expressions the answer is short (and sweet) > > mapping = { > "foo" : "bar", > "baz" : "quux", > "quuux" : "foo" > } > > pattern = "(%s)" % "|".join(mapping.keys()) > repl = lambda x : mapping.get(x.group(1), x.group(1)) > s = "fooxxxbazyy

Re: What is a list compression in Python?

2010-01-18 Thread Simon Brunning
2010/1/18 Kit : > Hello Everyone, I am not sure if I have posted this question in a > correct board. Can anyone please teach me: > > What is a list compression in Python? Perhaps you mean a list comprehension? If so, see . -- Cheers

Re: What is a list compression in Python?

2010-01-18 Thread superpollo
Kit ha scritto: Hello Everyone, I am not sure if I have posted this question in a correct board. Can anyone please teach me: What is a list compression in Python? Would you mind give me some list compression examples? Thanks & really appreciate that. Kit i think that's compreHENsion... htt

Re: not and is not problem

2010-01-18 Thread J
On Mon, Jan 18, 2010 at 10:43, superpollo wrote: > hi: > > #!/usr/bin/env python > data = "seq=123" > name , value = data.split("=") > print name > print value > if not name == "seq": >    print "DOES NOT PRINT OF COURSE..." > if name is not "seq": >    print "WTF! WHY DOES IT PRINT?" is will ret

What is a list compression in Python?

2010-01-18 Thread Kit
Hello Everyone, I am not sure if I have posted this question in a correct board. Can anyone please teach me: What is a list compression in Python? Would you mind give me some list compression examples? Thanks & really appreciate that. Kit -- http://mail.python.org/mailman/listinfo/python-list

Re: not and is not problem

2010-01-18 Thread Arnaud Delobelle
On 18 Jan, 15:43, superpollo wrote: > hi: > > #!/usr/bin/env python > data = "seq=123" > name , value = data.split("=") > print name > print value > if not name == "seq": >      print "DOES NOT PRINT OF COURSE..." > if name is not "seq": >      print "WTF! WHY DOES IT PRINT?" > > help please. > >

Re: substitution

2010-01-18 Thread Anthra Norell
Anthra Norell wrote: superpollo wrote: hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo --> bar baz --> quux quuux --> foo so that: fooxxxbazyyyquuux --> barxxxquuxyyyfoo bye So it goes. The more it matters, the sillier the misatakes. The method __ini

Re: not and is not problem

2010-01-18 Thread D'Arcy J.M. Cain
On Mon, 18 Jan 2010 16:43:25 +0100 superpollo wrote: > hi: > if name is not "seq": > print "WTF! WHY DOES IT PRINT?" Perhaps they aren't the same object. Some values are guaranteed to be the same (e.g. True and False) but not all. Try "!=" instead of "is not" in that experssion. -- D'Arc

Re: not and is not problem

2010-01-18 Thread Stephen Hansen
On Mon, Jan 18, 2010 at 7:43 AM, superpollo wrote: > #!/usr/bin/env python > data = "seq=123" > name , value = data.split("=") > print name > print value > if not name == "seq": >print "DOES NOT PRINT OF COURSE..." > if name is not "seq": >print "WTF! WHY DOES IT PRINT?" > Because name r

ANN: shpaml 0.94b

2010-01-18 Thread Steve Howell
Hi everybody, I would like to announce the latest version of shpaml, which is an indentation-based markup language similar to haml, but different. Shpaml allows you to author HTML-like content with an indentation- based syntax that eliminates the need to write and read close tags and angle bracket

not and is not problem

2010-01-18 Thread superpollo
hi: #!/usr/bin/env python data = "seq=123" name , value = data.split("=") print name print value if not name == "seq": print "DOES NOT PRINT OF COURSE..." if name is not "seq": print "WTF! WHY DOES IT PRINT?" help please. bye -- http://mail.python.org/mailman/listinfo/python-list

Re: Generic Python Benchmark suite?

2010-01-18 Thread Dotan Cohen
> What do you suggest? > $ man time -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python not good enough?

2010-01-18 Thread Phlip
On Jan 18, 5:59 am, Anh Hai Trinh wrote: > > Go uses := for assignment. > > Except that it doesn't. := is a declaration. Ah, and that's why Go is easy for cheap parsers to rip. Tx all! I was formerly too mortified to proceed - now I'm back in the Go camp. They fixed the hideous redundancy of J

Re: substitution

2010-01-18 Thread Nobody
On Mon, 18 Jan 2010 11:21:54 +0100, superpollo wrote: >> what is the most pythonic way to substitute substrings? > say the subs are: > > quuux --> foo > foo --> bar > baz --> quux > > then i cannot apply the subs in sequence (say, .replace() in a loop), > otherwise: > > fooxxxbazyyyquuux -->

Proper display of XMLRPCserver exceptions

2010-01-18 Thread Jean-Michel Pichavant
To all using xmlrpclib, I had trouble getting a proper display of my exceptions occuring on the server. Basically, xmlrpclib only display the exception itself without any traceback, on the client side. Something like :2"> Ok then there's a key error, but how the hell am I supposed to know w

Re: basic Class in Python

2010-01-18 Thread bartc
"Wolfgang Rohdewald" wrote in message news:mailman.1056.1263771299.28905.python-l...@python.org... On Monday 18 January 2010, BarryJOgorman wrote: TypeError: object._new_() takes no parameters def _init_(self, name, job=None, pay=0): __init__ needs two underscores left and right An

Re: substitution

2010-01-18 Thread Mel
superpollo wrote: > hi. > > what is the most pythonic way to substitute substrings? > > eg: i want to apply: > > foo --> bar > baz --> quux > quuux --> foo > > so that: > > fooxxxbazyyyquuux --> barxxxquuxyyyfoo This is simple -- maybe a bit brutal -- and if the strings get long it will be

Re: multithreading, performance, again...

2010-01-18 Thread Oktaka Com
On 30 Aralık 2009, 17:44, mk wrote: > Hello everyone, > > I have figured out (sort of) how to do profiling of multithreaded > programs with cProfile, it goes something like this: > > #!/usr/local/bin/python > > import cProfile > import threading > > class TestProf(threading.Thread): >      def __i

python gui ide under linux..like visual studio ;) ?

2010-01-18 Thread ted
Hi at all... Can someone please give me some advice, about a good IDE with control GUI under Linux ? Actually i know QT Creator by Nokia which i can use with Python (but i don't know how). And, a good library for access to database (mysql, sql server, oracle) ? Thank you very much ! bye -- htt

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 2:17 pm, Adi Eyal wrote: > > From: superpollo > > To: > > Date: Mon, 18 Jan 2010 11:15:37 +0100 > > Subject: substitution > > hi. > > > what is the most pythonic way to substitute substrings? > > > eg: i want to apply: > > > foo --> bar > > baz --> quux > > quuux --> foo > > > so that:

substitution

2010-01-18 Thread Adi Eyal
> From: superpollo > To: > Date: Mon, 18 Jan 2010 11:15:37 +0100 > Subject: substitution > hi. > > what is the most pythonic way to substitute substrings? > > eg: i want to apply: > > foo --> bar > baz --> quux > quuux --> foo > > so that: > > fooxxxbazyyyquuux --> barxxxquuxyyyfoo > > bye Using

Re: Inheriting methods but over-riding docstrings

2010-01-18 Thread Gabriel Genellina
En Sun, 17 Jan 2010 23:23:45 -0300, Steve Holden escribió: Gabriel Genellina wrote: Methods don't have docstrings; functions do. So one has to "clone" the function to set a new docstring. On behalf of all methods I would like to say "We demand the right to docstrings". print abs.__doc__

Re: Changing var names

2010-01-18 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Fri, Jan 15, 2010 at 3:15 PM, Adam Tauno Williams mailto:awill...@opengroupware.us>> wrote: On Fri, 2010-01-15 at 13:27 -0400, Victor Subervi wrote: > Hi; > Well it took me *less than a day* to fix the following problems: > -- bare excepts (accidentally

  1   2   >