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

2010-01-19 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

EPD 6.0 and IPython Webinar Friday

2010-01-19 Thread Amenity Applewhite
Email not displaying correctly? View it in your browser. Happy 2010! To start the year off, we've released a new version of EPD and lined up a solid set of training options. Scientific Computing with Python Webinar This Friday, Travis Oliphant will then provide an introduction to

EPD 6.0 and IPython Webinar Friday

2010-01-19 Thread Amenity Applewhite
Email not displaying correctly? View it in your browser. Happy 2010! To start the year off, we've released a new version of EPD and lined up a solid set of training options. Scientific Computing with Python Webinar This Friday, Travis Oliphant will then provide an introduction to

[ANN] Data Plotting Library DISLIN 10.0

2010-01-19 Thread Helmut Michels
Dear Python users, I am pleased to announce version 10.0 of the data plotting software DISLIN. DISLIN is a high-level and easy to use plotting library for displaying data as curves, bar graphs, pie charts, 3D-colour plots, surfaces, contours and maps. Several output formats are supported such

Re: Generic Python Benchmark suite?

2010-01-19 Thread M.-A. Lemburg
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). I am happy with something that gives me a relative number eg: ULS

Re: basic Class in Python

2010-01-19 Thread Richard Brodie
bartc ba...@freeuk.com wrote in message news:xl_4n.28001$ym4.5...@text.news.virginmedia.com... Any particular reason why two, and not one (or three)? In some fonts it's difficult to tell how many as they run together. It follows the C convention for reserved identifers. --

Re: syntax

2010-01-19 Thread Gib Bogle
Looks like homework. -- http://mail.python.org/mailman/listinfo/python-list

Re: searching and storing large quantities of xml!

2010-01-19 Thread Stefan Behnel
dads, 18.01.2010 22:39: There was one thing that I forgot about - when ElementTree fails to parse due to an element not being closed why doesn't it close the file like object. Because it didn't open it? Stefan -- http://mail.python.org/mailman/listinfo/python-list

thread return code

2010-01-19 Thread Rajat
Hi, I'm using threading module in Python 2.6.4. I'm using thread's join() method. On the new thread I'm running a function which returns a code at the end. Is there a way I access that code in the parent thread after thread finishes? Simply, does join() could get me that code? Regards, Rajat

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

2010-01-19 Thread ted
Il 18/01/2010 21:59, Mike Driscoll ha scritto: On Jan 18, 8:32 am, ted t...@sjksdjk.it 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

Re: thread return code

2010-01-19 Thread Alf P. Steinbach
* Rajat: Hi, I'm using threading module in Python 2.6.4. I'm using thread's join() method. On the new thread I'm running a function which returns a code at the end. Is there a way I access that code in the parent thread after thread finishes? Simply, does join() could get me that code?

what test runner should I use?

2010-01-19 Thread Chris Withers
Hi All, I'm wondering what test runner I should use. Here's my list of requirements: - cross platform (I develop for and on Windows, Linux and Mac) - should not prevent tests from running with other test runners (so no plugins/layers/etc that only work with one specific test runner) -

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

2010-01-19 Thread Alf P. Steinbach
* 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

[ANN] Data Plotting Library DISLIN 10.0

2010-01-19 Thread Helmut Michels
Dear Pytnon users, I am pleased to announce version 10.0 of the data plotting software DISLIN. DISLIN is a high-level and easy to use plotting library for displaying data as curves, bar graphs, pie charts, 3D-colour plots, surfaces, contours and maps. Several output formats are supported such

Is HTML report of tests run using PyUnit (unittest) possible?

2010-01-19 Thread fossist
I am using PyUnit (unittest module) for loading test cases from our modules and executing them. Is it possible to export the test results as HTML report? Currently the results appear as text on standard output while the tests execute. But is there something out of the box available in PyUnit to

Re: Inheriting methods but over-riding docstrings

2010-01-19 Thread Michele Simionato
On Jan 16, 6:55 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: I have a series of subclasses that inherit methods from a base class, but I'd like them to have their own individual docstrings. The following is not tested more than you see and will not work for builtin methods,

Re: Generic Python Benchmark suite?

2010-01-19 Thread Antoine Pitrou
Le Mon, 18 Jan 2010 21:05:26 -0800, Anand Vaidya a écrit : @Antoine, Terry, Thanks for the suggestions. I will investigate those. I just ran the pybench, doesn't run on 3.x, 2to3 fails. You just have to use the pybench version that is bundled with 3.x (in the Tools directory). --

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

2010-01-19 Thread Peter Otten
Dr. Benjamin David Clarke wrote: 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

Re: [ANN] Data Plotting Library DISLIN 10.0

2010-01-19 Thread superpollo
Helmut Michels ha scritto: Dear Pytnon users, I am pleased to announce version 10.0 of the data plotting software DISLIN. why dont you make it free software (i mean. GPL'ed) bye -- http://mail.python.org/mailman/listinfo/python-list

Re: python replace/sub/wildcard/regex issue

2010-01-19 Thread dippim
On Jan 18, 11:04 pm, tom badoug...@gmail.com 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

Re: using super

2010-01-19 Thread Jean-Michel Pichavant
Gabriel Genellina wrote: I see. 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 ? For a longer explanation, see: James Knight: Python's Super Considered Harmful

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

2010-01-19 Thread Gnarlodious
On Jan 18, 4:21 pm, John Bokma j...@castleamber.com wrote: Gnarlodious gnarlodi...@gmail.com 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]

Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
Yesterday I stumbled across some old code in a project I was working on. It does something like this: mystring = '\n'.join( [ line for line in lines if some conditions depending on line ] ) where lines is a simple list of strings. I realized that the code had been written before you could put

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

2010-01-19 Thread ryniek90
Il 18/01/2010 21:59, Mike Driscoll ha scritto: On Jan 18, 8:32 am, tedt...@sjksdjk.it 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

Py 3: How to switch application to Unicode strings?

2010-01-19 Thread Gnarlodious
I am using Python 3, getting an error from SQLite: sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Alf P. Steinbach
* Gerald Britton: Yesterday I stumbled across some old code in a project I was working on. It does something like this: mystring = '\n'.join( [ line for line in lines if some conditions depending on line ] ) where lines is a simple list of strings. I realized that the code had been written

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
Thanks! Good explanation. On Tue, Jan 19, 2010 at 10:57 AM, Alf P. Steinbach al...@start.no wrote: * Gerald Britton: Yesterday I stumbled across some old code in a project I was working on.  It does something like this: mystring = '\n'.join( [ line for line in lines if some conditions

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Stephen Hansen
On Tue, Jan 19, 2010 at 7:30 AM, Gerald Britton gerald.brit...@gmail.comwrote: [snip] mystring = '\n'.join( line for line in lines if some conditions depending on line ) Note, this is not a list comprehension, but a generator comprehension. A list comprehension is used to build, in one

multiprocessing problems

2010-01-19 Thread DoxaLogos
Hi, I decided to play around with the multiprocessing module, and I'm having some strange side effects that I can't explain. It makes me wonder if I'm just overlooking something obvious or not. Basically, I have a script parses through a lot of files doing search and replace on key strings

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

2010-01-19 Thread nn
On Jan 19, 8:03 am, Gnarlodious gnarlodi...@gmail.com wrote: On Jan 18, 4:21 pm, John Bokma j...@castleamber.com wrote: Gnarlodious gnarlodi...@gmail.com writes: I am running a script in a browser that finds the file in subfolder Data: Content=Plist('Data/Content.plist') However,

Closing a Curses Window???

2010-01-19 Thread Adam Tauno Williams
I'm uses the curses module of Python to create a TUI. I can create windows, and subwindows, but I can't find anything on deleting or disposing of a a subwindow. http://docs.python.org/library/curses.html http://www.amk.ca/python/howto/curses/curses.html How do I get rid of a subwindow? --

Re: can i examine the svn rev used to build a python 3 executable?

2010-01-19 Thread Robert P. J. Day
On Tue, 19 Jan 2010, Robert P. J. Day wrote: i'm currently checking out python3 from the svn repo, configuring, building and installing under /usr/local/bin on my fedora 12 system, all good. i'm curious, though -- is there a query i can make of that executable that would tell me what

use of super

2010-01-19 Thread harryos
hi I was going thru the weblog appln in practical django book by bennet .I came across this class Entry(Model): def save(self): dosomething() super(Entry,self).save() I couldn't make out why Entry and self are passed as arguments to super ().Can someone

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
Interestingly, I scaled it up to a million list items with more or less the same results. It's helpful to see that your results are different. That leads me to suspect that mine are somehow related to my own environment. Still I think the key is the overhead in calling next() for each item in

Re: multiprocessing problems

2010-01-19 Thread Adam Tauno Williams
I decided to play around with the multiprocessing module, and I'm having some strange side effects that I can't explain. It makes me wonder if I'm just overlooking something obvious or not. Basically, I have a script parses through a lot of files doing search and replace on key strings

can i examine the svn rev used to build a python 3 executable?

2010-01-19 Thread Robert P. J. Day
i'm currently checking out python3 from the svn repo, configuring, building and installing under /usr/local/bin on my fedora 12 system, all good. i'm curious, though -- is there a query i can make of that executable that would tell me what svn rev it was built from? i'm guessing not, but i

Re: multiprocessing problems

2010-01-19 Thread DoxaLogos
On Jan 19, 10:26 am, Adam Tauno Williams awill...@opengroupware.us wrote: I decided to play around with the multiprocessing module, and I'm having some strange side effects that I can't explain.  It makes me wonder if I'm just overlooking something obvious or not.  Basically, I have a

Create list/dict from string

2010-01-19 Thread SoxFan44
I was wondering if there was a way to create a list (which in this case would contain several dicts) based on a string passed in by the user. Security is not an issue. Basically I want to be able to have the user pass in using optparse: --actions=[{action_name: action_1, val: asdf, val2: asdf},

Re: Arrrrgh! Another module broken

2010-01-19 Thread nn
On Jan 18, 11:37 am, Grant Edwards inva...@invalid.invalid wrote: On 2010-01-18, Jive Dadson notonthe...@noisp.com 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.

how to sort two dimensional array

2010-01-19 Thread robert somerville
Hi; i am having trouble trying to sort the rows of a 2 dimensional array by the values in the first column .. does anybody know how or have an example of how to do this ??? while leaving the remain columns remain relative to the leading column from numpy import * a=array( [ [4, 4, 3], [4, 5,

how to sort two dimensional array ??

2010-01-19 Thread robert somerville
Hi; i am having trouble trying to sort the rows of a 2 dimensional array by the values in the first column .. does anybody know how or have an example of how to do this ??? while leaving the remain columns remain relative to the leading column from numpy import * a=array( [ [4, 4, 3], [4, 5,

Re: use of super

2010-01-19 Thread Simon Brunning
2010/1/19 harryos oswald.ha...@gmail.com: I was going thru the weblog appln in practical django book by bennet .I came across this class Entry(Model):        def save(self):                dosomething()                super(Entry,self).save() I couldn't make out why Entry and self are

Re: Create list/dict from string

2010-01-19 Thread Peter Otten
SoxFan44 wrote: I was wondering if there was a way to create a list (which in this case would contain several dicts) based on a string passed in by the user. Security is not an issue. Basically I want to be able to have the user pass in using optparse: --actions=[{action_name: action_1,

Re: Is HTML report of tests run using PyUnit (unittest) possible?

2010-01-19 Thread Phlip
On Jan 19, 3:16 am, fossist foss...@gmail.com wrote: I am using PyUnit (unittest module) for loading test cases from our modules and executing them. Is it possible to export the test results as HTML report? Currently the results appear as text on standard output while the tests execute. But

how to sort two dimensional array ??

2010-01-19 Thread Robert Somerville
Hi; i am having trouble trying to sort the rows of a 2 dimensional array by the values in the first column .. does anybody know how or have an example of how to do this ??? while leaving the remain columns remain relative to the leading column from numpy import * a=array( [ [4, 4, 3], [4,

Iterate over group names in a regex match?

2010-01-19 Thread Brian D
Here's a simple named group matching pattern: s = 1,2,3 p = re.compile(r(?Pone\d),(?Ptwo\d),(?Pthree\d)) m = re.match(p, s) m _sre.SRE_Match object at 0x011BE610 print m.groups() ('1', '2', '3') Is it possible to call the group names, so that I can iterate over them? The result I'm looking

Re: Python IDE for MacOS-X

2010-01-19 Thread Phlip
On Jan 18, 11:09 pm, Jean Guillaume Pyraksos wis...@hotmail.com wrote: What's the best one to use with beginners ? Something with integrated syntax editor, browser of doc... Thanks, Before this message goes stale, there's TextMate (which I have too much experience with to consider redeemable

Re: Create list/dict from string

2010-01-19 Thread Gerald Britton
Can't you just use the dict() built-in function like this: dict({action_name: action_1, val: asdf}) Of course if the list is not properly formed, this will fail. But I guess you have thought of that already. On Tue, Jan 19, 2010 at 11:33 AM, SoxFan44 gregchag...@gmail.com wrote: I was

Re: Create list/dict from string

2010-01-19 Thread Simon Brunning
2010/1/19 Peter Otten __pete...@web.de: Both eval() and json.loads() will do. eval() is dangerous as it allows the user to run arbitrary python code. Something like http://code.activestate.com/recipes/364469/ might be worth a look too. -- Cheers, Simon B. --

Re: Iterate over group names in a regex match?

2010-01-19 Thread djc
Brian D wrote: Here's a simple named group matching pattern: s = 1,2,3 p = re.compile(r(?Pone\d),(?Ptwo\d),(?Pthree\d)) m = re.match(p, s) m _sre.SRE_Match object at 0x011BE610 print m.groups() ('1', '2', '3') Is it possible to call the group names, so that I can iterate over them?

Re: Iterate over group names in a regex match?

2010-01-19 Thread Alf P. Steinbach
* Brian D: Here's a simple named group matching pattern: s = 1,2,3 p = re.compile(r(?Pone\d),(?Ptwo\d),(?Pthree\d)) m = re.match(p, s) m _sre.SRE_Match object at 0x011BE610 print m.groups() ('1', '2', '3') Is it possible to call the group names, so that I can iterate over them? The result

Re: use of super

2010-01-19 Thread harryos
thanks Simon..I should have checked it -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterate over group names in a regex match?

2010-01-19 Thread Peter Otten
Brian D wrote: Here's a simple named group matching pattern: s = 1,2,3 p = re.compile(r(?Pone\d),(?Ptwo\d),(?Pthree\d)) m = re.match(p, s) m _sre.SRE_Match object at 0x011BE610 print m.groups() ('1', '2', '3') Is it possible to call the group names, so that I can iterate over them?

[ANN] Python-es mailing list changes home

2010-01-19 Thread Chema Cortes
=== Python-es mailing list changes home === Due to technical problems with the site that usually ran the Python-es mailing list (Python list for the Spanish speaking community), we are setting up a new one under the python.org umbrella. Hence, the new list will become python...@python.org (the

Re: how to sort two dimensional array ??

2010-01-19 Thread Robert Kern
On 2010-01-19 11:00 AM, Robert Somerville wrote: Hi; i am having trouble trying to sort the rows of a 2 dimensional array by the values in the first column .. does anybody know how or have an example of how to do this ??? while leaving the remain columns remain relative to the leading column

Re: how to sort two dimensional array ??

2010-01-19 Thread Stephen Hansen
On Tue, Jan 19, 2010 at 9:00 AM, Robert Somerville rsomervi...@sjgeophysics.com wrote: Hi; Hi, why did you post this three times? i am having trouble trying to sort the rows of a 2 dimensional array by the values in the first column .. does anybody know how or have an example of how to

Re: Iterate over group names in a regex match?

2010-01-19 Thread Brian D
On Jan 19, 11:28 am, Peter Otten __pete...@web.de wrote: Brian D wrote: Here's a simple named group matching pattern: s = 1,2,3 p = re.compile(r(?Pone\d),(?Ptwo\d),(?Pthree\d)) m = re.match(p, s) m _sre.SRE_Match object at 0x011BE610 print m.groups() ('1', '2', '3') Is it

Re: Iterate over group names in a regex match?

2010-01-19 Thread Brian D
On Jan 19, 11:51 am, Brian D brianden...@gmail.com wrote: On Jan 19, 11:28 am, Peter Otten __pete...@web.de wrote: Brian D wrote: Here's a simple named group matching pattern: s = 1,2,3 p = re.compile(r(?Pone\d),(?Ptwo\d),(?Pthree\d)) m = re.match(p, s) m _sre.SRE_Match

Re: Iterate over group names in a regex match?

2010-01-19 Thread MRAB
Brian D wrote: Here's a simple named group matching pattern: s = 1,2,3 p = re.compile(r(?Pone\d),(?Ptwo\d),(?Pthree\d)) m = re.match(p, s) m _sre.SRE_Match object at 0x011BE610 print m.groups() ('1', '2', '3') Is it possible to call the group names, so that I can iterate over them? The

Re: substitution

2010-01-19 Thread Wyrmskull
Peter Otten wrote: def replace_many(s, pairs): if len(pairs): a, b = pairs[0] rest = pairs[1:] return b.join(replace_many(t, rest) for t in s.split(a)) else: return s - Proves wrong, this way x - y - z. You call replace_many again on the

Re: substitution

2010-01-19 Thread Peter Otten
Wyrmskull wrote: Peter Otten wrote: def replace_many(s, pairs): if len(pairs): a, b = pairs[0] rest = pairs[1:] return b.join(replace_many(t, rest) for t in s.split(a)) else: return s Proves wrong, this way x - y - z. You call replace_many again

Re: substitution

2010-01-19 Thread Wyrmskull
Cleaned. You can remove the 'else's if you want, because 'return' breaks the instruction flow. Should also work with other sequence types. def mySubst(reps,seq): if reps: a,b,c = string.partition(reps[0][0]) if b: return mySubst(reps,a) +

Re: substitution

2010-01-19 Thread Wyrmskull
Nvm, my bad, I misunderstood the split instruction. No difference :) --- Wyrmskull P.S Sorry about the P.M., I misclicked on a GUI -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE for MacOS-X

2010-01-19 Thread Günther Dietrich
Jean Guillaume Pyraksos wis...@hotmail.com wrote: What's the best one to use with beginners ? Something with integrated syntax editor, browser of doc... Thanks, I started with 'EasyEclipse for Python', but soon changed to Eclipse with PyDev, MercurialEclipse and AnyEditTools plugins installed

Re: Python IDE for MacOS-X

2010-01-19 Thread Chris Colbert
On Tue, Jan 19, 2010 at 2:09 AM, Jean Guillaume Pyraksos wis...@hotmail.com wrote: 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 I whole-heartedly recommend

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

2010-01-19 Thread Gnarlodious
OK I guess that is normal, I fixed it with this: path=os.path.dirname(__file__)+/Data/ -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Wolfram Hinderer
On 19 Jan., 16:30, Gerald Britton gerald.brit...@gmail.com wrote: Timer(' '.join([x for x in l]), 'l = map(str,range(10))').timeit() 2.9967339038848877 Timer(' '.join(x for x in l), 'l = map(str,range(10))').timeit() 7.2045478820800781 [...] 2. Why should the pure list comprehension be

Re: Py 3: How to switch application to Unicode strings?

2010-01-19 Thread Stephen Hansen
On Tue, Jan 19, 2010 at 7:50 AM, Gnarlodious gnarlodi...@gmail.com wrote: I am using Python 3, getting an error from SQLite: sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
[snip] Yes, list building from a generator expression *is* expensive. And join has to do it, because it has to iterate twice over the iterable passed in: once for calculating the memory needed for the joined string, and once more to actually do the join (this is implementation dependent, of

Re: enhancing 'list'

2010-01-19 Thread Steve Holden
samwyse wrote: On Jan 18, 1:56 am, Terry Reedy tjre...@udel.edu wrote: On 1/17/2010 5:37 PM, samwyse wrote: Consider this a wish list. I know I'm unlikely to get any of these in time for for my birthday, but still I felt the need to toss it out and see what happens. Lately, I've

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Arnaud Delobelle
Gerald Britton gerald.brit...@gmail.com writes: [snip] Yes, list building from a generator expression *is* expensive. And join has to do it, because it has to iterate twice over the iterable passed in: once for calculating the memory needed for the joined string, and once more to actually

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Wolfram Hinderer
On 19 Jan., 21:06, Gerald Britton gerald.brit...@gmail.com wrote: [snip] Yes, list building from a generator expression *is* expensive. And join has to do it, because it has to iterate twice over the iterable passed in: once for calculating the memory needed for the joined string, and

Re: integer and string compare, is that correct?

2010-01-19 Thread Aahz
In article hickp8$cfg$0...@news.t-online.com, Peter Otten __pete...@web.de wrote: The use cases for an order that works across types like int and str are weak to non-existent. Implementing it was considered a mistake and has been fixed in Python 3: That is not precisely correct from my POV.

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Gerald Britton
That's surprising. I wouldn't implement it that way at all. I'd use a dynamically-expanding buffer as I suggested. That way you get a single pass and don't have to calculate anything before you begin. In the best case, you'd use half the memory (the result just fits in the buffer after its last

Re: Recommended new way for config files

2010-01-19 Thread Jonathan Gardner
On Jan 8, 2:54 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Chris Rebert c...@rebertia.com writes: JSON is one option:http://docs.python.org/library/json.html YAML URL:http://en.wikipedia.org/wiki/YAML is another contender. Compared to JSON, it is yet to gain as much mind-share, but even

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

2010-01-19 Thread Dr. Benjamin David Clarke
On Jan 19, 7:00 am, Peter Otten __pete...@web.de wrote: Dr. Benjamin David Clarke wrote: 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

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Raymond Hettinger
[Wolfram Hinderer] Yes, list building from a generator expression *is* expensive. And join has to do it, because it has to iterate twice over the iterable passed in: once for calculating the memory needed for the joined string, and once more to actually do the join (this is implementation

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Arnaud Delobelle
Gerald Britton gerald.brit...@gmail.com writes: That's surprising. I wouldn't implement it that way at all. I'd use a dynamically-expanding buffer as I suggested. That way you get a single pass and don't have to calculate anything before you begin. In the best case, you'd use half the

Re: can i examine the svn rev used to build a python 3 executable?

2010-01-19 Thread Martin v. Loewis
never mind. just discovered that while python3 -V won't do it, executing it gives me: $ python3 Python 3.2a0 (py3k:77609, Jan 19 2010, 04:10:16) ... and it's that 77609 rev number i was after. If you want that in a command line fashion, do python -c 'import

Re: thread return code

2010-01-19 Thread Peter
On Jan 19, 9:25 pm, Alf P. Steinbach al...@start.no wrote: * Rajat: Hi, I'm using threading module in Python 2.6.4. I'm using thread's join() method. On the new thread I'm running a function which returns a code at the end. Is there a way I access that code in the parent thread after

Pydev 1.5.4 Released

2010-01-19 Thread Fabio Zadrozny
Hi All, Pydev 1.5.4 has been released Details on Pydev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- * Actions: o Go to matching bracket (Ctrl + Shift + P) o Copy the qualified name of the current context

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Steven D'Aprano
On Tue, 19 Jan 2010 11:26:43 -0500, Gerald Britton wrote: Interestingly, I scaled it up to a million list items with more or less the same results. A million items is not a lot of data. Depending on the size of each object, that might be as little as 4 MB of data: L = ['' for _ in

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Steven D'Aprano
On Tue, 19 Jan 2010 16:20:42 -0500, Gerald Britton wrote: That's surprising. I wouldn't implement it that way at all. I'd use a dynamically-expanding buffer as I suggested. That way you get a single pass and don't have to calculate anything before you begin. In the best case, you'd use

Re: Py 3: How to switch application to Unicode strings?

2010-01-19 Thread Mark Tolonen
Stephen Hansen apt.shan...@gmail.com wrote in message news:7a9c25c21001191156j46a7fdadt58b728477b85e...@mail.gmail.com... On Tue, Jan 19, 2010 at 7:50 AM, Gnarlodious gnarlodi...@gmail.com wrote: I am using Python 3, getting an error from SQLite: sqlite3.ProgrammingError: You must not use

Re: Py 3: How to switch application to Unicode strings?

2010-01-19 Thread Gnarlodious
Well, Python 3 is supposed to be all Unicode by default. I shouldn't even need to say # coding:UTF-8 And, the file is saved as Unicode. There are many mentions of this error found by Google, but none seen to clearly say what the problem is or how to fix it. FYI, the problem line says:

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Alf P. Steinbach
* Steven D'Aprano: On Tue, 19 Jan 2010 16:20:42 -0500, Gerald Britton wrote: That's surprising. I wouldn't implement it that way at all. I'd use a dynamically-expanding buffer as I suggested. That way you get a single pass and don't have to calculate anything before you begin. In the best

Re: Py 3: How to switch application to Unicode strings?

2010-01-19 Thread Stephen Hansen
On Tue, Jan 19, 2010 at 8:16 PM, Gnarlodious gnarlodi...@gmail.com wrote: Well, Python 3 is supposed to be all Unicode by default. I shouldn't even need to say # coding:UTF-8 And, the file is saved as Unicode. There are many mentions of this error found by Google, but none seen to clearly

Re: Python IDE for MacOS-X

2010-01-19 Thread Tim Arnold
Jean Guillaume Pyraksos wis...@hotmail.com wrote in message news:wissme-9248e1.08090319012...@news.free.fr... What's the best one to use with beginners ? Something with integrated syntax editor, browser of doc... Thanks, JG eclipse + pydev works well for me. --Tim Arnold --

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Steven D'Aprano
On Wed, 20 Jan 2010 05:25:22 +0100, Alf P. Steinbach wrote: * Steven D'Aprano: On Tue, 19 Jan 2010 16:20:42 -0500, Gerald Britton wrote: That's surprising. I wouldn't implement it that way at all. I'd use a dynamically-expanding buffer as I suggested. That way you get a single pass and

Re: What is a list compression in Python?

2010-01-19 Thread Rainer Grimm
Hallo, you can also look at list comprehension as syntactic sugar for the functions map and filter. The two functions from the functional world can be expressed in a comprehensive way with list comprehension. [x**2 for x in range(10) ] == map ( lambda x: x*x, range(10)) True [ x for x in

Re: setattr() oddness

2010-01-19 Thread Dieter Maurer
Steven D'Aprano ste...@remove.this.cybersource.com.au writes on 18 Jan 2010 06:47:59 GMT: On Mon, 18 Jan 2010 07:25:58 +0100, Dieter Maurer wrote: Lie Ryan lie.1...@gmail.com writes on Sat, 16 Jan 2010 19:37:29 +1100: On 01/16/10 10:10, Sean DiZazzo wrote: Interesting. I can understand

Re: Py 3: How to switch application to Unicode strings?

2010-01-19 Thread Arnaud Delobelle
Gnarlodious gnarlodi...@gmail.com writes: Well, Python 3 is supposed to be all Unicode by default. I shouldn't even need to say # coding:UTF-8 And, the file is saved as Unicode. When a filed is saved, shouldn't it be in a specific encoding? I don't see how you can save your file 'as

Re: What is a list compression in Python?

2010-01-19 Thread Stephen Hansen
On Tue, Jan 19, 2010 at 10:39 PM, Rainer Grimm r.gr...@science-computing.de wrote: Hallo, you can also look at list comprehension as syntactic sugar for the functions map and filter. The two functions from the functional world can be expressed in a comprehensive way with list comprehension.

Re: What is a list compression in Python?

2010-01-19 Thread Stephen Hansen
On Tue, Jan 19, 2010 at 11:32 PM, Stephen Hansen apt.shan...@gmail.comwrote: I really don't think you can call comprehensions as mere syntactic sugar, Err, I misspoke. I don't really think you can call comprehensions mere syntactic sugar /for map and filter/. It IS mere syntactic sugar for

Best way to convert sequence of bytes to long integer

2010-01-19 Thread Steven D'Aprano
I have a byte string (Python 2.x string), e.g.: s = g%$f yg\n1\05 assert len(s) == 10 I wish to convert it to a long integer, treating it as base-256. Currently I'm using: def makelong(s): n = 0 for c in s: n *= 256 n += ord(c) return n which gives: makelong(s)

Re: Performance of lists vs. list comprehensions

2010-01-19 Thread Stefan Behnel
Steven D'Aprano, 20.01.2010 07:12: On Wed, 20 Jan 2010 05:25:22 +0100, Alf P. Steinbach wrote: That is a good argument for not doing the expanding buffer thing. But such buffers may be generally present anyway, resulting from optimization of +. As near as I can determine, the CPython

Re: Py 3: How to switch application to Unicode strings?

2010-01-19 Thread Mark Tolonen
Gnarlodious gnarlodi...@gmail.com wrote in message news:646ab38b-0710-4d31-b9e1-8a6ee7bfa...@21g2000yqj.googlegroups.com... Well, Python 3 is supposed to be all Unicode by default. I shouldn't even need to say # coding:UTF-8 Yes, in Python 3, an absence of a 'coding' line assumes UTF-8.

[issue7472] email.encoders.encode_7or8bit(): typo iso-2202. iso-2022 is correct.

2010-01-19 Thread Yukihiro Nakadaira
Yukihiro Nakadaira yukihiro.nakada...@gmail.com added the comment: In other words, I think the correct thing to do is to delete that if test. I think so too. Do you have a case where the code produces incorrect behavior that your patch turns into correct behavior? No, I don't. I just

[issue7738] IDLE hang when tooltip comes up in Linux

2010-01-19 Thread Kent Yip
New submission from Kent Yip yes...@gmail.com: IDLE will hang when a tooltip shows in a Linux system (Ubuntu). do this: t = (1,2,3) len(t) it will hang after the closing ')', when you press return nothing will happen or when you press any keys, it won't show up. However, you can work

[issue7739] time.strftime may hung while trying to open /etc/localtime but does not release GIL

2010-01-19 Thread Doron Tal
New submission from Doron Tal doron.tal.l...@gmail.com: I've encountered a hung of python process for more than a second. It appears that the stall happens due to time.strftime call, which internally opens a file ('/etc/localtime'). I think it is best if the GIL would have been released to

  1   2   >