Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On 1 Dec, 17:50, Mark Dickinson wrote: > On Dec 1, 2:03 pm, Mark Summerfield wrote: > > > I've produced a 4 page document that provides a very concise summary > > of Python 2<->3 differences plus the most commonly used new Python 3 > > features. > > Very nice indeed! > > My only quibble is with t

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On 1 Dec, 18:30, Lie Ryan wrote: > On 12/2/2009 1:03 AM, Mark Summerfield wrote: > > > > > I've produced a 4 page document that provides a very concise summary > > of Python 2<->3 differences plus the most commonly used new Python 3 > > features. It is aimed at existing Python 2 programmers who wa

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On 1 Dec, 21:55, Terry Reedy wrote: > Mark Summerfield wrote: > > I've produced a 4 page document that provides a very concise summary > > of Python 2<->3 differences plus the most commonly used new Python 3 > > features. It is aimed at existing Python 2 programmers who want to > > start writing P

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On 1 Dec, 23:52, John Bokma wrote: > Mark Summerfield writes: > > It is available as a free PDF download (no registration or anything) > > from InformIT's website. Here's the direct link: > >http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/... > > Thanks! > > > And of course,

Help in wxpython

2009-12-02 Thread madhura vadvalkar
Hi I am trying to write an PAINT like application where on the mouse click a circle is drawn on canvas. I am new to python and using wxpython to create this. here is the code: import wx class SketchWindow(wx.Window): def __init__ (self, parent,ID): wx.Window.__init__(self, parent

Re: getattr problem

2009-12-02 Thread Bruno Desthuilliers
Victor Subervi wrote: (NB : answering to the OP - the post didn't show up on clpy) Hi; I have the following code that execute without a problem: Fine. But it fails to execute here - ImportError on the 3rd line ("options"), NameErrors on the 4th line ("addStore") and 5th line ("optionTables

Re: High-performance Python websites

2009-12-02 Thread Bruno Desthuilliers
Rami Chowdhury a écrit : On Monday 30 November 2009 10:55:55 inhahe wrote: On Wed, Nov 25, 2009 at 7:33 PM, ShoqulKutlu wrote: Hi, Managing load of high volume of visitors is a common issue for all kind of web technologies. I mean this is not the python issue. This issue is mostly about serv

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Dickinson
On Dec 2, 8:01 am, Mark Summerfield wrote: > On 1 Dec, 17:50, Mark Dickinson wrote: > > My only quibble is with the statement on the first page that > > the 'String % operator is deprecated'.  I'm not sure that's > > true, for all values of 'deprecated'.  There don't appear > > to be any definite

Re: Recursion head scratcher

2009-12-02 Thread Dave Angel
Joel Madigan wrote: Hi everyone! Sorry this isn't strictly a Python question but my algorithms professor contends that given the standard recursive-backtracking maze solving algorithm: width=6 height=4 maze=[[1,0,1,1,0,1], [0,0,1,0,0,0], [1,0,1,0,1,0], [0,0,0,0,1,1]] visited =

Re: Help in wxpython

2009-12-02 Thread Dave Angel
madhura vadvalkar wrote: Hi I am trying to write an PAINT like application where on the mouse click a circle is drawn on canvas. I am new to python and using wxpython to create this. here is the code: import wx class SketchWindow(wx.Window): def __init__ (self, parent,ID): wx

Re: Recursion head scratcher

2009-12-02 Thread Tim Wintle
On Wed, 2009-12-02 at 02:07 -0500, Joel Madigan wrote: > > that it is possible to make it print the path to the finish in the > order the steps were taken. That is, the algorithm as written > produces: (4,0) (4,1) (3,1) (3,2) (3,3) (2,3) (1,3) (1,2) True > > Rather than (1,2) (1,3) (2,3) (3,3)

Don't Understand This Error

2009-12-02 Thread Victor Subervi
I get the following error: /var/www/html/angrynates.com/cart/chooseOptions.py 8 from login import login 9 import string 10 import options 11 from particulars import optionsTables, addStore 12 options undefined SyntaxError: invalid syntax (options.py, line 140) args = ('inv

Re: Don't Understand This Error

2009-12-02 Thread Chris Rebert
On Wed, Dec 2, 2009 at 2:33 AM, Victor Subervi wrote: > I get the following error: > >  /var/www/html/angrynates.com/cart/chooseOptions.py >     8 from login import login >     9 import string >    10 import options >    11 from particulars import optionsTables, addStore >    12 > options undefine

Multiprocessing recycle worker if max request reached

2009-12-02 Thread Maris Ruskulis
Hello! Currently I'm writing little xmlrpc server, because of one c library used there is memory leak, which couldn't be fixed. So I decide to use multiprocessing, spawn pool of workers and recycle worker if it reaches max request count. I managed to set counter for worker, but I could not fig

Re: python and vc numbers

2009-12-02 Thread Daniel Dalton
> Can you make do with the tempfile module? Or you'd need to identify > from an external process which console is locked? Perhaps, I wrote a small hack: - Manually set environment variable TTYNUMBER in .bash_profile - Then use this in the script, to establish what tty I'm working with. Thanks -

Delaunay triangulation

2009-12-02 Thread Vincent Davis
Anyone know of a python implementation of Delaunay triangulation? *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog | LinkedIn -- http://mail.python.org/mailman/listinfo/python-list

Re: xmlrpc idea for getting around the GIL

2009-12-02 Thread alex23
Patrick Stinson wrote: > Not true. We sell the industry leading sampler engine, and it has been > paying my salary for three years. It's high performance - every cycle > counts. Our sampled instruments is loaded as a plugin from third-party > applications and has been used to make movies you have

Re: Bored.

2009-12-02 Thread Necronymouse
Thanks for reaction, I will prohably choose some project as you said... -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't print Chinese to HTTP

2009-12-02 Thread Gnarlodious
On Nov 30, 5:53 am, "Martin v. Löwis" wrote: > #!/usr/bin/python > print("Content-type:text/plain;charset=utf-8\n\n") > sys.stdout.buffer.write('晉\n'.encode("utf-8")) Does this work for anyone? Because all I get is a blank page. Nothing. If I can establish what SHOULD work, maybe I can diagnose t

Re: Don't Understand This Error

2009-12-02 Thread Bruno Desthuilliers
On Wed, Dec 2, 2009 at 2:33 AM, Victor Subervi wrote: def colors(callingTable, which='', specificTables=[]): Warning : default arguments are eval'd only once, at function creation time. This is a well known gotcha that can lead to unexpected behaviours like: def foo(x, bar=[]) bar.app

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Wolodja Wentland
On Wed, Dec 02, 2009 at 00:10 -0800, Mark Summerfield wrote: > On 1 Dec, 18:30, Lie Ryan wrote: > > Also, I'm not sure what this change is referring to: > > Python 2                 Python 3 > > L = list(seq)            L = sorted(seq) > > L.sort() > > > > L.sort is still available in python, and

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Martin P. Hellwig
Mark Summerfield wrote: It is available as a free PDF download (no registration or anything) from InformIT's website. Here's the direct link: http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/python/python2python3.pdf Very handy! Am I wrong in assuming that you forgot to inc

Re: Don't Understand This Error

2009-12-02 Thread Victor Subervi
To those who caught the colon at the end of what I thought was going to be def but turned out to be something else, thank. On Wed, Dec 2, 2009 at 5:55 AM, Bruno Desthuilliers wrote: > On Wed, Dec 2, 2009 at 2:33 AM, Victor Subervi >> wrote: >> >>> >>> def colors(callingTable, which='', specific

Re: Recursion head scratcher

2009-12-02 Thread Joel Madigan
On 12/2/09, Dave Angel wrote: > Joel Madigan wrote: >> Hi everyone! >> Sorry this isn't strictly a Python question but my algorithms professor >> contends that given the standard recursive-backtracking maze solving >> algorithm: >> >> width=6 >> height=4 >> maze=[[1,0,1,1,0,1], >> [0,0,1,0,0

Question about file objects...

2009-12-02 Thread J
Something that came up in class... when you are pulling data from a file using f.next(), the file is read one line at a time. What was explained to us is that Python iterates the file based on a carriage return as the delimiter. But what if you have a file that has one line of text, but that one

Re: Delaunay triangulation

2009-12-02 Thread David Robinow
On Tue, Dec 1, 2009 at 8:31 PM, Vincent Davis wrote: > Anyone know of a python implementation of Delaunay triangulation? Matplotlib has one. There's also Delny @pypi It's been several years since I needed this. I can't remember the pros/cons. -- http://mail.python.org/mailman/listinfo/python-l

Re: Question about file objects...

2009-12-02 Thread nn
On Dec 2, 9:14 am, J wrote: > Something that came up in class... > > when you are pulling data from a file using f.next(), the file is read > one line at a time. > > What was explained to us is that Python iterates the file based on a > carriage return as the delimiter. > But what if you have a fi

Re: Question about file objects...

2009-12-02 Thread Andre Engels
On Wed, Dec 2, 2009 at 3:14 PM, J wrote: > Something that came up in class... > > when you are pulling data from a file using f.next(), the file is read > one line at a time. > > What was explained to us is that Python iterates the file based on a > carriage return as the delimiter. > But what if

pbs scripts

2009-12-02 Thread aoife
Hi,very new.hoping to incorporate python into my postgrad. Basically I have 2,000 files.I want to write a script that says: open each file in turn for each file: open this pbs script and run MUSCLE (a sequence alignment tool) on each file close this file move on to next file.

Re: Delaunay triangulation

2009-12-02 Thread km
check CGAL (cgal.org) it has python bindings Krishna On Wed, Dec 2, 2009 at 11:28 PM, David Robinow wrote: > On Tue, Dec 1, 2009 at 8:31 PM, Vincent Davis > wrote: > > Anyone know of a python implementation of Delaunay triangulation? > > Matplotlib has one. > There's also Delny @pypi > > It's

can python do this?

2009-12-02 Thread Rounak
I am a complete newbie. I want to know if the following can be done using python or should I learn some other language: (Basically, these are applescripts that I wrote while I used Mac OS) 1.Web Page Image to Wallpaper: A script that takes the current image in a browser and sets it as a wallpaper.

Re: xmlrpc idea for getting around the GIL

2009-12-02 Thread sturlamolden
On 2 Des, 02:47, Patrick Stinson wrote: > We don't need extension modules, and all we need to do is run some > fairly basic scripts that make callbacks and use some sip-wrapped > types. Sure, you use SIP but not extension modules... > - Python is not suitable for real-time work. > > Not true.

Re: can python do this?

2009-12-02 Thread Simon Brunning
2009/12/2 Rounak : > I am a complete newbie. I want to know if the following can be done > using python or should I learn some other language: > (Basically, these are applescripts that I wrote while I used Mac OS) Python can do anything Applescript can do with the appscript module - see

Re: can python do this?

2009-12-02 Thread Diez B. Roggisch
Rounak wrote: > I am a complete newbie. I want to know if the following can be done > using python or should I learn some other language: > (Basically, these are applescripts that I wrote while I used Mac OS) > 1.Web Page Image to Wallpaper: > A script that takes the current image in a browser and

Re: pbs scripts

2009-12-02 Thread Simon Brunning
2009/12/2 aoife : > Hi,very new.hoping to incorporate python into my postgrad. > > Basically I have 2,000 files.I want to write a script that says: > > open each file in turn If they are in one directory, look at the glob module. If they are in a bunch of sub-directories, see os.walk(), or

Re: can python do this?

2009-12-02 Thread Rounak
> Python can do anything Applescript can do with the appscript module - > see . And, > naturally, very much more. wait, sorry, i forgot to mention. I am now on Linux. I want to know what python can do in Linux. On Mac, I am glad to use ap

Re: can python do this?

2009-12-02 Thread Diez B. Roggisch
Rounak wrote: > >> Python can do anything Applescript can do with the appscript module - >> see . And, >> naturally, very much more. > > wait, sorry, i forgot to mention. I am now on Linux. I want to know what > python can do in Linux. On

Re: can python do this?

2009-12-02 Thread Rounak
> > http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux > the first solution in this thread requires python imaging library which I did find here: http://www.pythonware.com/products/pil/faq.htm But i would like to know if there are easier ways to install this in

Re: can python do this?

2009-12-02 Thread Grant Edwards
On 2009-12-02, Rounak wrote: > >> Python can do anything Applescript can do with the appscript module - >> see . And, >> naturally, very much more. > > wait, sorry, i forgot to mention. I am now on Linux. I want to > know what python can do

Re: can python do this?

2009-12-02 Thread Allan Davis
Try your distribution of linux package management tool. You will find PIL there -- Allan Davis Member of NetBeans Dream Team http://wiki.netbeans.org/NetBeansDreamTeam Lead Developer, nbPython http://wiki.netbeans.org/Python http://codes

Re: can python do this?

2009-12-02 Thread Diez B. Roggisch
Rounak wrote: > >> >> http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux >> > the first solution in this thread requires python imaging library which > I did find here: http://www.pythonware.com/products/pil/faq.htm > But i would like to know if there are easi

Re: can python do this?

2009-12-02 Thread Bruno Desthuilliers
Rounak a écrit : http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux the first solution in this thread requires python imaging library which I did find here: http://www.pythonware.com/products/pil/faq.htm But i would like to know if there are easier ways to in

Re: can python do this?

2009-12-02 Thread Rounak
Thanks Allan, I did find PIL in Synaptic Package Manager and installed it successfully. However, I cannot use it. The reason is: 1. I had installed python3 using sudo apt-get install python3 but python 2 still remains. And it seems Scite (my python editor) is looking for python 2. Terminal Output:

Python without wrapper script

2009-12-02 Thread eric.frederich
Is there a way to set up environment variables in python itself without having a wrapper script. The wrapper script is now something like #!/bin/bash export LD_LIBRARY_PATH="/some/thing/lib:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH="/another/thing/lib:$LD_LIBRARY_PATH" export PATH="/some/thi

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On Dec 1, 2:03 pm, Mark Summerfield wrote: > I've produced a 4 page document that provides a very concise summary > of Python 2<->3 differences plus the most commonly used new Python 3 > features. It is aimed at existing Python 2 programmers who want to > start writing Python 3 programs and want t

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On Dec 2, 8:53 am, Mark Dickinson wrote: > On Dec 2, 8:01 am, MarkSummerfield wrote: > > > On 1 Dec, 17:50, Mark Dickinson wrote: > > > My only quibble is with the statement on the first page that > > > the 'String % operator is deprecated'.  I'm not sure that's > > > true, for all values of 'dep

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On Dec 2, 11:20 am, Wolodja Wentland wrote: > On Wed, Dec 02, 2009 at 00:10 -0800, Mark Summerfield wrote: > > On 1 Dec, 18:30, Lie Ryan wrote: > > > Also, I'm not sure what this change is referring to: > > > Python 2                 Python 3 > > > L = list(seq)            L = sorted(seq) > > > L

Re: Question about file objects...

2009-12-02 Thread J
On Wed, Dec 2, 2009 at 09:27, nn wrote: >> Is there a way to read the file, one item at a time, delimited by >> commas WITHOUT having to read all 16,000 items from that one line, >> then split them out into a list or dictionary?? > File iteration is a convenience since it is the most common case.

Re: Python without wrapper script

2009-12-02 Thread Ulrich Eckhardt
eric.frederich wrote: > Is there a way to set up environment variables in python itself > without having a wrapper script. Yes, sure, you can set environment variables... > The wrapper script is now something like > > #!/bin/bash > > export LD_LIBRARY_PATH="/some/thing/lib:$LD_LIBRARY_PATH"

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On Dec 2, 11:31 am, "Martin P. Hellwig" wrote: > MarkSummerfieldwrote: > > > It is available as a free PDF download (no registration or anything) > > from InformIT's website. Here's the direct link: > >http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/... > > > Very handy! Am I

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On Dec 2, 4:22 pm, Mark Summerfield wrote: > On Dec 2, 11:31 am, "Martin P. Hellwig" > wrote: > > > MarkSummerfieldwrote: > > > > It is available as a free PDF download (no registration or anything) > > > from InformIT's website. Here's the direct link: > > >http://ptgmedia.pearsoncmg.com/imprint

Re: Python without wrapper script

2009-12-02 Thread Jean-Michel Pichavant
eric.frederich wrote: Is there a way to set up environment variables in python itself without having a wrapper script. The wrapper script is now something like #!/bin/bash export LD_LIBRARY_PATH="/some/thing/lib:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH="/another/thing/lib:$LD_LIBRARY_PATH"

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread John Posner
On Wed, 02 Dec 2009 10:55:23 -0500, Mark Summerfield wrote: On Dec 1, 2:03 pm, Mark Summerfield wrote: I've produced a 4 page document that provides a very concise summary of Python 2<->3 differences plus the most commonly used new Python 3 features. It is aimed at existing Python 2 program

Re: Delaunay triangulation

2009-12-02 Thread sturlamolden
On 2 Des, 15:28, David Robinow wrote: > On Tue, Dec 1, 2009 at 8:31 PM, Vincent Davis > wrote: > > Anyone know of a python implementation of Delaunay triangulation? > > Matplotlib has one. > There's also Delny �...@pypi > > It's been several years since I needed this. I can't remember the pros/c

Coding Cross Correlation Function in Python

2009-12-02 Thread DarthXander
I have two data sets which I wish to perform the discrete correlation function on and then plot the results for many values of t to see what if any time lag exists between the data. Thus far my code is; import csv import pylab from pylab import * from numpy import * from numpy import array HSBC=c

Re: can python do this?

2009-12-02 Thread Anssi Saari
Rounak writes: > I am a complete newbie. I want to know if the following can be done > using python or should I learn some other language: > (Basically, these are applescripts that I wrote while I used Mac OS) > 1.Web Page Image to Wallpaper: > A script that takes the current image in a browser

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Carsten Haese
John Posner wrote: > Goal: place integer 456 flush-right in a field of width 8 > > Py2: "%%%dd" % 8 % 456 > Py3: "{0:{1}d}".format(456, 8) > > With str.format(), you don't need to nest one formatting operation > within another. With string interpolation, you don't need to do that, either. >

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Dickinson
On Dec 2, 4:41 pm, "John Posner" wrote: >   Goal: place integer 456 flush-right in a field of width 8 > >    Py2: "%%%dd" % 8 % 456 >    Py3: "{0:{1}d}".format(456, 8) > > With str.format(), you don't need to nest one formatting operation within   > another. A little less mind-bending, and every l

Re: Coding Cross Correlation Function in Python

2009-12-02 Thread sturlamolden
On 2 Des, 18:50, DarthXander wrote: > However to do this 700 times seems ridiculous. How would I get python > to perform this for me for t in a range of roughly 0-700? For two 1D ndarrays, the cross-correlation is from numpy.fft import rfft, irfft from numpy import fliplr xcorr = lambda x,y :

Re: Coding Cross Correlation Function in Python

2009-12-02 Thread DarthXander
On Dec 2, 7:12 pm, sturlamolden wrote: > For two 1D ndarrays, the cross-correlation is > > from numpy.fft import rfft, irfft > from numpy import fliplr > > xcorr = lambda x,y : irfft(rfft(x)*rfft(fliplr(y))) > > Normalize as you wish, and preferably pad with zeros before invoking > xcorr. Thanks,

Noob thread lock question

2009-12-02 Thread Astley Le Jasper
I have a number of threads that write to a database. I have created a thread lock, but my question is this: - If one thread hits a lock, do a) all the other threads stop, or b) just the ones that come to the same lock? - I presume that the answer is b. In which case do the threads stop only if the

Re: Noob thread lock question

2009-12-02 Thread Diez B. Roggisch
Astley Le Jasper schrieb: I have a number of threads that write to a database. I have created a thread lock, but my question is this: - If one thread hits a lock, do a) all the other threads stop, or b) just the ones that come to the same lock? Only the ones coming the the same lock. - I pre

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread David H Wild
In article <351fcb4c-4e88-41b0-a0aa-b3d63832d...@e23g2000yqd.googlegroups.com>, Mark Summerfield wrote: > I only just found out that I was supposed to give a different URL: > http://www.informit.com/promotions/promotion.aspx?promo=137519 > This leads to a web page where you can download the doc

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread John Bokma
Mark Summerfield writes: > On 1 Dec, 23:52, John Bokma wrote: >> Mark Summerfield writes: >> > It is available as a free PDF download (no registration or anything) >> > from InformIT's website. Here's the direct link: >> >http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/...

Re: How to set object parameters nicely?

2009-12-02 Thread allen.fowler
> >>> Is there a better way to do this? > >> class MyOb(object): > >>      def __init__(self, **kwargs): > >>          self.__dict__.update(kwargs) > > >> ob1 = MyOb(p1="Tom", p3="New York") > >> ob2 = MyOb(p1="Joe", p2="j...@host", p3="New Jersey") > > > I've tried this, but have found two issues:

Insane Problem

2009-12-02 Thread Victor Subervi
Hi; I have spent 2-3 hours trying to track this bug. Here's the code snippet: form = cgi.FieldStorage() fn = getattr(options, 'products') ourOptionsNames = [] optionsNames, doNotUse = fn('names') for name in optionsNames: test = table + '-' + name print test check = form.get

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Mark Summerfield
On 2 Dec, 19:28, David H Wild wrote: > In article > <351fcb4c-4e88-41b0-a0aa-b3d63832d...@e23g2000yqd.googlegroups.com>, >    Mark Summerfield wrote: > > > I only just found out that I was supposed to give a different URL: > >http://www.informit.com/promotions/promotion.aspx?promo=137519 > > This

ANN: Twisted 9.0.0

2009-12-02 Thread Christopher Armstrong
= Twisted 9.0.0 = I'm happy to announce Twisted 9, the first (and last) release of Twisted in 2009. The previous release was Twisted 8.2 in December of 2008. Given that, a lot has changed! This release supports Python 2.3 through Python 2.6, though it is the last one that will support Python 2.3.

Re: Python without wrapper script

2009-12-02 Thread Hans Mulder
Ulrich Eckhardt wrote: eric.frederich wrote: Is there a way to set up environment variables in python itself without having a wrapper script. Yes, sure, you can set environment variables... The wrapper script is now something like #!/bin/bash export LD_LIBRARY_PATH="/some/thing/lib:$LD

Re: Noob thread lock question

2009-12-02 Thread John Nagle
Diez B. Roggisch wrote: Astley Le Jasper schrieb: I have a number of threads that write to a database. I have created a thread lock, but my question is this: - If one thread hits a lock, do a) all the other threads stop, or b) just the ones that come to the same lock? Only the ones coming the

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread MRAB
Mark Summerfield wrote: On 2 Dec, 19:28, David H Wild wrote: In article <351fcb4c-4e88-41b0-a0aa-b3d63832d...@e23g2000yqd.googlegroups.com>, Mark Summerfield wrote: I only just found out that I was supposed to give a different URL: http://www.informit.com/promotions/promotion.aspx?promo=1

Re: Insane Problem

2009-12-02 Thread MRAB
Victor Subervi wrote: Hi; I have spent 2-3 hours trying to track this bug. Here's the code snippet: form = cgi.FieldStorage() fn = getattr(options, 'products') ourOptionsNames = [] optionsNames, doNotUse = fn('names') for name in optionsNames: test = table + '-' + name print t

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread John Posner
On Wed, 02 Dec 2009 13:34:11 -0500, Carsten Haese wrote: With string interpolation, you don't need to do that, either. '%*d' % (8,456) ' 456' Thanks, Carsten and Mark D. -- I'd forgotten about the use of "*" in minimum-field-width specs and precision specs (doh). How about this:

Cron Job Output

2009-12-02 Thread baytes
I have cron checking services every 5-10 minutes, and if a service goes up or down it writes to a file, Im trying to write a script that will check that file for updates and print the results. this will tie into a module for phenny where the bot will be able to print the contents of the updated fil

Re: python bijection

2009-12-02 Thread Joshua Bronson
On Dec 1, 8:17 pm, a...@pythoncraft.com (Aahz) wrote: > In article > <85100df7-a8b0-47e9-a854-ba8a8a2f3...@r31g2000vbi.googlegroups.com>, > Joshua Bronson   wrote: > >I noticed the phonebook example in your ActiveState recipe and thought > >you might consider changing it to something like husbands

Re: How to set object parameters nicely?

2009-12-02 Thread Carl Banks
On Dec 2, 12:13 pm, "allen.fowler" wrote: > > >>> Is there a better way to do this? > > >> class MyOb(object): > > >>      def __init__(self, **kwargs): > > >>          self.__dict__.update(kwargs) > > > >> ob1 = MyOb(p1="Tom", p3="New York") > > >> ob2 = MyOb(p1="Joe", p2="j...@host", p3="New Jer

Re: python bijection

2009-12-02 Thread Joshua Bronson
On Dec 1, 9:03 pm, Chris Rebert wrote: > Reminds me of this quite funny blog post: > "Gay marriage: the database engineering perspective" > http://qntm.org/?gay amazing -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about file objects...

2009-12-02 Thread Terry Reedy
J wrote: On Wed, Dec 2, 2009 at 09:27, nn wrote: Is there a way to read the file, one item at a time, delimited by commas WITHOUT having to read all 16,000 items from that one line, then split them out into a list or dictionary?? File iteration is a convenience since it is the most common ca

Re: Cron Job Output

2009-12-02 Thread LoD MoD
You might try something like this http://code.activestate.com/recipes/157035/ On Wed, Dec 2, 2009 at 3:05 PM, baytes wrote: > I have cron checking services every 5-10 minutes, and if a service > goes up or down it writes to a file, Im trying to write a script that > will check that file for upda

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Terry Reedy
Mark Summerfield wrote: Well it seems clear to me that the BDFL wants to kill of % formatting, but wasn't able to for Python 3... Definitely. I thought of adding autonumbering of fields (in 3.1) in response to his inquiry about the barriers to moving to .format. That solved 'simplicity of de

Re: ANN: Twisted 9.0.0

2009-12-02 Thread Terry Reedy
Christopher Armstrong wrote: = Twisted 9.0.0 = I'm happy to announce Twisted 9, the first (and last) release of Twisted in 2009. The previous release was Twisted 8.2 in December of 2008. Given that, a lot has changed! This release supports Python 2.3 through Python 2.6, though it is the last on

Re: python bijection

2009-12-02 Thread Aahz
In article <9a6902a1-327e-435e-8c9a-b69028994...@u20g2000vbq.googlegroups.com>, Joshua Bronson wrote: > >At any rate, apologies to the community for my heteronormative >example. It was merely pedagogical and reflects nothing about my >personal views! If you have any further concerns, please send

Re: How to set object parameters nicely?

2009-12-02 Thread allen.fowler
On Dec 2, 6:36 pm, Carl Banks wrote: > For the record, I don't really agree that a lot of parameters is code > smell.  It's maybe a red flag that you are doing too much in one > function and/or class, but nothing inherently shady. > > One thing to ask yourself: are there a lot of combinations of

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-02 Thread Antoine Pitrou
Le Tue, 01 Dec 2009 06:03:36 -0800, Mark Summerfield a écrit : > I've produced a 4 page document that provides a very concise summary of > Python 2<->3 differences plus the most commonly used new Python 3 > features. It is aimed at existing Python 2 programmers who want to start > writing Python 3

How to implement Varient/Tagged Unions/Pattern Matching in Python?

2009-12-02 Thread metal
I want to get pattern matching like OCaml in python(ref:http:// en.wikipedia.org/wiki/Tagged_union) I consider the syntax: def decl(): def Plus(expr, expr): pass def Minus(expr, expr): pass def Times(expr, expr): pass def Divide(expr, expr): pass def Value(

Re: ANN: Twisted 9.0.0

2009-12-02 Thread exarkun
On 12:18 am, tjre...@udel.edu wrote: Christopher Armstrong wrote: = Twisted 9.0.0 = I'm happy to announce Twisted 9, the first (and last) release of Twisted in 2009. The previous release was Twisted 8.2 in December of 2008. Given that, a lot has changed! This release supports Python 2.3 throug

prolog with python

2009-12-02 Thread William Heath
Hi All, I have the following prolog program that I would really like to be able to run in python in some elegant way: q00(X01, R):- write('Are you over 80?'), read(INPUT), write(''), q11(INPUT, R). q11(X11, R):- X11=y, write(' You are passed the hardest year'), !. q00(X01, R):- write('You are

Re: prolog with python

2009-12-02 Thread Chris Rebert
On Wed, Dec 2, 2009 at 6:47 PM, William Heath wrote: > Hi All, > > I have the following prolog program that I would really like to be able to > run in python in some elegant way: >From googling: http://pyke.sourceforge.net/ http://code.activestate.com/recipes/303057/ Cheers, Chris -- http://blo

Re: [Twisted-Python] ANN: Twisted 9.0.0

2009-12-02 Thread Tim Allen
exar...@twistedmatrix.com wrote: > A message with some ticket links from a thread on the twisted-python > mailing list: http://bit.ly/8csFSa Some of those tickets seem out of date; a better plan would be to query for tickets with the "py3k" keyword: http://twistedmatrix.com/trac/search?q=py3

Re: Question on Python as career

2009-12-02 Thread Roy Smith
joy99 wrote: > Dear Group, > > I am a researcher in India's one of the premier institutes.(Indian > Institute of Science,Bangalore). > [...] > I have developed them either in Python2.5 and Python2.6. > > After I complete my Post Doctoral which may be only 2-3 months away, > with this knowledge

Beginner Q. interrogate html object OR file search?

2009-12-02 Thread Mark G
Hi all, I am new to python and don't yet know the libraries well. What would be the best way to approach this problem: I have a html file parsing script - the file sits on my harddrive. I want to extract the date modified from the meta-data. Should I read through lines of the file doing a string.f

Re: Help in wxpython

2009-12-02 Thread Krishnakant
On Wed, 2009-12-02 at 00:20 -0800, madhura vadvalkar wrote: > Hi > > I am trying to write an PAINT like application where on the mouse > click a circle is drawn on canvas. I am new to python and using > wxpython to create this. > > here is the code: > > import wx > > class SketchWindow(wx.Wind

Re: Delaunay triangulation

2009-12-02 Thread Vincent Davis
Thanks for all the replies I will look at each. *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog | LinkedIn On Wed, Dec 2, 2009 at 10:20 AM, sturlamolden wrote: > On 2 Des, 15:28, David Robinow wrote: > > On T

Declaring a class level nested class?

2009-12-02 Thread cmckenzie
Hi. I'm new to Python, but I've managed to make some nice progress up to this point. After some code refactoring, I ran into a class design problem and I was wondering what the experts thought. It goes something like this: class module: nestedClass def __init__(): self.nestedClass =

Re: Declaring a class level nested class?

2009-12-02 Thread Chris Rebert
On Wed, Dec 2, 2009 at 8:55 PM, cmckenzie wrote: > Hi. > > I'm new to Python, but I've managed to make some nice progress up to > this point. After some code refactoring, I ran into a class design > problem and I was wondering what the experts thought. It goes > something like this: > > class modu

Re: Declaring a class level nested class?

2009-12-02 Thread inhahe
it seems to me like it should work just fine if you just take out the second line where it just says nestedClass On Wed, Dec 2, 2009 at 11:55 PM, cmckenzie wrote: > Hi. > > I'm new to Python, but I've managed to make some nice progress up to > this point. After some code refactoring, I ran into a

Re: Beginner Q. interrogate html object OR file search?

2009-12-02 Thread inhahe
or i guess you could go the middle-way and just use regex. people generally say don't use regex for html (regex can't do the nesting), but it's what i would do in this case. though i don't exactly understand the question, re the html file parsing script you say you have already, or how the date is

Re: Beginner Q. interrogate html object OR file search?

2009-12-02 Thread Mark G
On Dec 3, 4:19 pm, inhahe wrote: > or i guess you could go the middle-way and just use regex. > people generally say don't use regex for html (regex can't do the > nesting), but it's what i would do in this case. > though i don't exactly understand the question, re the html file > parsing script y

Re: Beginner Q. interrogate html object OR file search?

2009-12-02 Thread Stephen Hansen
On Wed, Dec 2, 2009 at 7:24 PM, Mark G wrote: > Hi all, > > I am new to python and don't yet know the libraries well. What would > be the best way to approach this problem: I have a html file parsing > script - the file sits on my harddrive. I want to extract the date > modified from the meta-dat

Re: how to debug extended module?

2009-12-02 Thread junyoung
On 12월2일, 오전9시54분, junyoung wrote: > On 12월1일, 오후6시14분, "Diez B. Roggisch" wrote: > > > > > > > junyoung schrieb: > > > > Hi, I am a newbie who want to implement a extend module to use native > > > python language with my own shared library. > > > If it's a C shared library, don't bother extendin

  1   2   >