Regular expressions question

2008-10-02 Thread aditya shukla
Hello folks , I trying to match a pattern in a string , i am new in using re .This is what is happening When i do this p = re.compile('(\[&&NHX:)') >>> m = p.match("[&&NHX:C=0.195.0]") >>> print m <_sre.SRE_Match object at 0x013FE1E0> --- thus i am able to find the match but when i use the stri

Professional quality scripts/code

2008-10-02 Thread robean
I have been learning Python for the last 3 months or so and I have a working (but somewhat patchy) sense of the the language. I've been using a couple of the more popular Python books as well as online resources. A question for experienced Python programmers: can you recommend resources where I ca

Re: Inheritance but only partly?

2008-10-02 Thread Matimus
On Oct 2, 1:16 pm, process <[EMAIL PROTECTED]> wrote: > Let's say I have a class X which has 10 methods. > > I want class Y to inherit 5 of them. > > Can I do that? Can I do something along the lines of super(Y, exclude > method 3 4 7 9 10) ? I think the noral way of doing that is to split the ori

self signing a py2exe windows executable

2008-10-02 Thread William Heath
Hi All, I thought I sent an email to the list regarding a need I have to self sign a py2exe windows executable. Does anyone know how to do that? -Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheritance but only partly?

2008-10-02 Thread Gary Herron
Gary Herron wrote: > process wrote: > >> Let's say I have a class X which has 10 methods. >> >> I want class Y to inherit 5 of them. >> >> Can I do that? Can I do something along the lines of super(Y, exclude >> method 3 4 7 9 10) ? >> >> -- >> http://mail.python.org/mailman/listinfo/python-list

Re: Professional quality scripts/code

2008-10-02 Thread Benjamin Kaplan
On Thu, Oct 2, 2008 at 4:38 PM, robean <[EMAIL PROTECTED]> wrote: > I have been learning Python for the last 3 months or so and I have a > working (but somewhat patchy) sense of the the language. I've been > using a couple of the more popular Python books as well as online > resources. > > A quest

Re: Inheritance but only partly?

2008-10-02 Thread Aaron "Castironpi" Brady
On Oct 2, 3:16 pm, process <[EMAIL PROTECTED]> wrote: > Let's say I have a class X which has 10 methods. > > I want class Y to inherit 5 of them. > > Can I do that? Can I do something along the lines of super(Y, exclude > method 3 4 7 9 10) ? That implies that the 5 you do include don't rely on or

Re: Python equivalent of Perl e flag with regular expression

2008-10-02 Thread Mark Thomas
On Oct 2, 4:03 pm, [EMAIL PROTECTED] wrote: >     Jason> With Perl I might do something like this: >     Jason> $line =~ s/(select)/uc($1)/e; >     ... >     Jason> How would I do this with Python? > > I'm sure there are plenty of ways to skin this particular cat, but how is > 's/.../.../e' differe

Python for the Playstation 3

2008-10-02 Thread Blubaugh, David A.
To All, I was wondering if there is still a community effort to develop Python for Linux distributions for the Sony Playstation 3?? I have found a few WebPages stating this effort to port Python in such a way to take advantage of the Cell architecture within the playstation? However, all of the

Re: Professional quality scripts/code

2008-10-02 Thread Mike Driscoll
On Oct 2, 3:38 pm, robean <[EMAIL PROTECTED]> wrote: > I have been learning Python for the last 3 months or so and I have a > working (but somewhat patchy) sense of the the language. I've been > using a couple of the more popular Python books as well as online > resources. > > A question for experi

2.6 multiprocessing and pdb

2008-10-02 Thread Aaron "Castironpi" Brady
Hi, I'm trying to step through a subprocess I launch with multiprocessing. Does anyone know what hack to add? The actual call comes in forking.Popen.__init__, Windows version, forking.py, line 222: hp, ht, pid, tid = _subprocess.CreateProcess( _python_exe, cmd, None,

Re: questions from a lost sheep

2008-10-02 Thread johannes raggam
On Thu, 2008-10-02 at 15:18 -0500, [EMAIL PROTECTED] wrote: > Joe> I've started to think fondly of the rock-solid stability of Python, > Joe> and have been wondering if perhaps aggressive unit testing could > Joe> mitigate most of the problems of weak typing. > > Note: Python is not weakl

Re: javascript to python

2008-10-02 Thread Bruno Desthuilliers
lkcl a écrit : On Oct 2, 5:54 pm, Joe Hrbek <[EMAIL PROTECTED]> wrote: Could someone help me translate to something that would close to it in python? The anonymous functions are giving me problems. class dataListener: def __init__(self): data = "" def onStartRequest(self, req

Tuple parameter unpacking in 3.x

2008-10-02 Thread Martin Geisler
Hi, I just tried running my code using "python2.6 -3" and got a bunch of SyntaxWarning: tuple parameter unpacking has been removed in 3.x warnings. I've read PEP-3113: http://www.python.org/dev/peps/pep-3113/ but I'm still baffled as to why you guys could remove such a wonderful feature?!

How to send Data Transfer Objects across the network?

2008-10-02 Thread Daniel
Hello, I've been building a system that has need to send object data across the network. The approach I've taken has been to build Data Transfer Objects, which just contain the attributes of the objects, and to pickle them and send them over a socket connection. As I get deeper this is a bit pro

Re: Regular expressions question

2008-10-02 Thread Vlastimil Brom
2008/10/2 aditya shukla <[EMAIL PROTECTED]> > Hello folks , > > I trying to match a pattern in a string , i am new in using re .This is > what is happening > > When i do this > > p = re.compile('(\[&&NHX:)') > >>> m = p.match("[&&NHX:C=0.195.0]") > >>> print m > <_sre.SRE_Match object at 0x013FE1E

Re: How to send Data Transfer Objects across the network?

2008-10-02 Thread Bruno Desthuilliers
Daniel a écrit : Hello, I've been building a system that has need to send object data across the network. The approach I've taken has been to build Data Transfer Objects, which just contain the attributes of the objects, and to pickle them and send them over a socket connection. As I get deepe

Re: Inheritance but only partly?

2008-10-02 Thread bearophileHUGS
Gary Herron: > You can also redefine the ones you don't want inherited: > class A: > def DontInheritMe(self, ...): >... > Class B(A): > def DontInheritMe(self, ...): >raise NotImplementedError // Or some such I have never used something like this, but the OP may use a maski

del and sets proposal

2008-10-02 Thread Larry Bates
You can do the following: a = [1,2,3,4,5] del a[0] and a = {1:'1', 2: '2', 3: '3', 4:'4', 5:'5'} del a[1] why doesn't it work the same for sets (particularly since sets are based on a dictionary)? a = set([1,2,3,4,5]) del a[1] Yes I know that sets have a remove method (like lists), but sin

Re: What is not objects in Python?

2008-10-02 Thread William McBrine
On Wed, 01 Oct 2008 17:56:34 +0200, Boris Borcic wrote: > 42, for instance. > > Proof : > > >>> 42 is not object > True > > QED >>> isinstance(42, object) True -- 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 -- pass it on -- http://mail.python.org/mailman/listinfo/python-list

Suppressing Python wanings globally

2008-10-02 Thread Paul Moore
How can I suppress a Python warning globally (i.e., for all instances of Python I run)? I have a test suite that runs Python via sys.executable, so the -W flag won't work. A wrapper script doesn't work, as sys.executable doesn't point to that. And PYTHONSTARTUP is only for interactive use, so that'

Re: How to send Data Transfer Objects across the network?

2008-10-02 Thread Jean-Paul Calderone
On Thu, 2 Oct 2008 14:45:12 -0700 (PDT), Daniel <[EMAIL PROTECTED]> wrote: Hello, I've been building a system that has need to send object data across the network. The approach I've taken has been to build Data Transfer Objects, which just contain the attributes of the objects, and to pickle th

Re: del and sets proposal

2008-10-02 Thread Chris Rebert
On Thu, Oct 2, 2008 at 3:20 PM, Larry Bates <[EMAIL PROTECTED]> wrote: > You can do the following: > > a = [1,2,3,4,5] > del a[0] > > and > > a = {1:'1', 2: '2', 3: '3', 4:'4', 5:'5'} > del a[1] > > why doesn't it work the same for sets (particularly since sets are based on > a dictionary)? > > a =

Re: Suppressing Python wanings globally

2008-10-02 Thread Jean-Paul Calderone
On Thu, 2 Oct 2008 23:39:29 +0100, Paul Moore <[EMAIL PROTECTED]> wrote: How can I suppress a Python warning globally (i.e., for all instances of Python I run)? I have a test suite that runs Python via sys.executable, so the -W flag won't work. A wrapper script doesn't work, as sys.executable doe

Re: Suppressing Python wanings globally

2008-10-02 Thread Paul Moore
2008/10/2 Jean-Paul Calderone <[EMAIL PROTECTED]>: > On Thu, 2 Oct 2008 23:39:29 +0100, Paul Moore <[EMAIL PROTECTED]> wrote: >> >> How can I suppress a Python warning globally (i.e., for all instances >> of Python I run)? I have a test suite that runs Python via >> sys.executable, so the -W flag w

Re: Python 2.6, GUI not working on vista?

2008-10-02 Thread Mensanator
On Oct 2, 1:27 pm, process <[EMAIL PROTECTED]> wrote: > i just downloaded 2.6 and when running the gui nothing happens. I assume you mean IDLE won't run. > > anyone else with the same problem? Yes. Here's how I fixed it: First of all, there's a note on the Python page that says Vista Note Adm

help using py2app

2008-10-02 Thread Joe Strout
I'm trying to use py2app to convert the pySketch wxPython example into a stand-alone OS X app. I've found the documentation at , but it wasn't terribly enlightening for me. My setup.py looks like this: #!/usr/bin/env python """ setup.py - script fo

Stopping a Thread with Time Slicing

2008-10-02 Thread Steve
Hi All, I've been trying to come up with a good way to run a certain process at a timed interval (say every 5 mins) using the SLEEP command and a semaphore flag. The basic thread loop was always sitting in the sleep command and not able to be interrupted. When the time came to set the semaphore fl

Re: Tuple parameter unpacking in 3.x

2008-10-02 Thread bearophileHUGS
Martin Geisler: > ci.addCallback(lambda (ai, bi): ai * bi) > or > map(lambda (i, s): (field(i + 1), s), enumerate(si)) > Rewriting these to > ci.addCallback(lambda abi: abi[0] * abi[1]) > and > map(lambda is: (field(is[0] + 1), is[1]), enumerate(si)) > makes the code much uglier! And slight

Re: help using py2app

2008-10-02 Thread Carl
Joe Strout wrote: I'm trying to use py2app to convert the pySketch wxPython example into a stand-alone OS X app. I've found the documentation at , but it wasn't terribly enlightening for me. My setup.py looks like this: #!/usr/bin/env python """ setu

Re: Stopping a Thread with Time Slicing

2008-10-02 Thread Todd Whiteman
Steve wrote: Hi All, I've been trying to come up with a good way to run a certain process at a timed interval (say every 5 mins) using the SLEEP command and a semaphore flag. The basic thread loop was always sitting in the sleep command and not able to be interrupted. When the time came to set t

Re: del and sets proposal

2008-10-02 Thread Jon Clements
On Oct 2, 11:20 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > You can do the following: > > a = [1,2,3,4,5] > del a[0] > > and > > a = {1:'1', 2: '2', 3: '3', 4:'4', 5:'5'} > del a[1] > > why doesn't it work the same for sets (particularly since sets are based on a > dictionary)? > > a = set([1,2,3,

Re: Python arrays and sting formatting options

2008-10-02 Thread Marc 'BlackJack' Rintsch
On Thu, 02 Oct 2008 14:51:29 +, Steven D'Aprano wrote: > On Wed, 01 Oct 2008 10:38:12 +, Marc 'BlackJack' Rintsch wrote: > >> Even if newbies don't understand all the details they should be >> introduced to ``with`` right away IMHO. Because if you explain all the >> details, even if they

Re: del and sets proposal

2008-10-02 Thread Marc 'BlackJack' Rintsch
On Thu, 02 Oct 2008 16:48:42 -0700, Jon Clements wrote: > It's also worth noting that removing an object from a container > (.remove) is different than proposing the object goes to GC (del...) ``del`` doesn't propose that the object goes to GC, at least not more then a `remove()` method does. J

Re: del and sets proposal

2008-10-02 Thread bearophileHUGS
Chris Rebert: > No, sets are a datatype unto themselves. They are based on > dictionaries internally (at least in CPython), but that's an > implemention detail to be hidden, not emphasized. Later Hettinger has simplified their code, making them use less memory (and be a little faster too, I think)

Re: del and sets proposal

2008-10-02 Thread Marc 'BlackJack' Rintsch
On Thu, 02 Oct 2008 15:39:55 -0700, Chris Rebert wrote: > On Thu, Oct 2, 2008 at 3:20 PM, Larry Bates <[EMAIL PROTECTED]> > wrote: >> a = set([1,2,3,4,5]) >> del a[1] > > Sets don't support subscripting, so if you can't go 'a_set[something]', > why would you expect to be able to be able to 'del'

Re: call of duty 4 crack multiplayer

2008-10-02 Thread Heiko Kröner
-- http://mail.python.org/mailman/listinfo/python-list

Re: windows help files ?

2008-10-02 Thread Martin v. Löwis
> 1. how can I launch the windows help file (CHM), from python with a > keyword as argument ? Run hh.exe. If you want it to navigate to specific page, also pass that page on the command line (finding out the exact syntax is left as an exercise) > 2. now when my program should also run under Linu

Re: Advice for a replacement for plone.

2008-10-02 Thread Dmitry S. Makovey
disclaimer: I'm not affiliated with any company selling Plone services ;) I also have nothing against Django and such. Ken Seehart wrote: > I want a new python based CMS. ... One that won't keep me up all night > > > I've been fooling around with zope and plone, and I like plone for some

Python import path issue. Suggestions and ideas?

2008-10-02 Thread Ritesh Nadhani
Hello All So my sourcecode has the following structure: / - app.py - commonlib.py - app.cnf - module/ - module/submodule/ - module/submodule/app2.py Commonlib is generally used for one method: def GetConfValue(section, item): config = ConfigParser.ConfigParser() config.read( "app.cnf" )

Pydev 1.3.22 Released

2008-10-02 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.3.22 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: --

Spawing a daemon from my app and closing only when the daemon is done its job

2008-10-02 Thread Ritesh Nadhani
Hello So I have a wxPython GUI app. I have two independent modules which are command line are more of a daemon app which does separate but related processing for the whole system. Now, I am able to spawn the daemons and even close it when my wxPython app closes. But what I want is that if the da

Re: Python arrays and sting formatting options

2008-10-02 Thread bearophileHUGS
Steven D'Aprano: > With Python 3.0, GvR had the > opportunity to strip Python of all the features that makes Python easy to > learn, and he didn't. Python still has features that are easy for > newbies, and features that are powerful for experienced coders, and that > friendliness for newbies isn't

Re: RELEASED Python 2.6 final

2008-10-02 Thread Terry Reedy
nneonneo wrote: Hmm, I was looking forward to trying this out, but the Windows installer link (http://www.python.org/ftp/python/2.6/python-2.6.msi) is presently broken (as is the link for the 64-bit Windows version). While I'm at it, I might also point out that http://www.python.org/download/wi

Re: docs.python.org inaccessible

2008-10-02 Thread Terry Reedy
Lawrence D'Oliveiro wrote: Been getting 403 errors all afternoon. At one time I used to assiduously download PDF files of all the documentation I wanted to refer to. These days I've grown accustomed to just having a bunch of Web browser windows semi-permanently open. Until a rude shock like this

Re: python-2.6

2008-10-02 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Hi all. I've installed on may MacOS X 10.4.11 (PPC) Python-2.5.2, numpy and scipy. Now I'm interested to insall Python-2.6. My question is: What will happen to may scientific modules if now I jump fro 2.5.2 to 2.6? I've to reinstall numpy and scipy? Keep your 2.5.2 ins

Re: why? __builtins__ key added from eval

2008-10-02 Thread Terry Reedy
Lie Ryan wrote: On Tue, 30 Sep 2008 16:04:34 -0500, William Purcell wrote: You could remove the builtin if you don't think it is necessary for you. Or you could do "dictionary comprehension" that collects only names you require (actually use generator comprehension then do a dict() conversio

Re: Python for the Playstation 3

2008-10-02 Thread Terry Reedy
Blubaugh, David A. wrote: I was wondering if there is still a community effort to develop Python for Linux distributions for the Sony Playstation 3?? I have found a few WebPages stating this effort to port Python in such a way to take advantage of the Cell architecture within the playstation?

Fun with reverse sorts

2008-10-02 Thread David Di Biase
Hi there, I'm sorting an expansive list descending according to a list of tuples. Basically it has to sort the last value in the tuple (3) but if they are the same then it should resort to using the second last value (2). Now according to my very limited testing I've somewhat figured out that this

Re: del and sets proposal

2008-10-02 Thread Larry Bates
Chris Hebert wrote: On Thu, Oct 2, 2008 at 3:20 PM, Larry Bates <[EMAIL PROTECTED]> wrote: You can do the following: a = [1,2,3,4,5] del a[0] and a = {1:'1', 2: '2', 3: '3', 4:'4', 5:'5'} del a[1] why doesn't it work the same for sets (particularly since sets are based on a dictionary)? a =

Re: How to send Data Transfer Objects across the network?

2008-10-02 Thread Larry Bates
Daniel wrote: Hello, I've been building a system that has need to send object data across the network. The approach I've taken has been to build Data Transfer Objects, which just contain the attributes of the objects, and to pickle them and send them over a socket connection. As I get deeper t

Re: Fun with reverse sorts

2008-10-02 Thread Chris Rebert
On Thu, Oct 2, 2008 at 8:07 PM, David Di Biase <[EMAIL PROTECTED]> wrote: > Hi there, > > I'm sorting an expansive list descending according to a list of tuples. > Basically it has to sort the last value in the tuple (3) but if they are the > same then it should resort to using the second last valu

Re: questions from a lost sheep

2008-10-02 Thread Larry Bates
johannes raggam wrote: On Thu, 2008-10-02 at 15:18 -0500, [EMAIL PROTECTED] wrote: Joe> I've started to think fondly of the rock-solid stability of Python, Joe> and have been wondering if perhaps aggressive unit testing could Joe> mitigate most of the problems of weak typing. Note: Pyt

Re: Fun with reverse sorts

2008-10-02 Thread David Di Biase
I did see that actually, I thought it was only applied to specifying default parameters and wasn't sure if it ALSO applied to putting it into a function. In a way however, I see what you're getting at - it's basically the same thing you're just specifying a default value the same way... Ok problem

Re: using SSh problem!

2008-10-02 Thread Larry Bates
sa6113 wrote: I want to connect form a windows machine to a Linux one using SSH (I use Paramiko) and simply copy a file to Linux machine. Would you please help me how should I start? Is there any useful code? I find that one of the easiest ways of doing this is to install Cygwin on the windows

Re: problem with sockets code

2008-10-02 Thread James Mills
On Fri, Oct 3, 2008 at 2:13 AM, Daniel <[EMAIL PROTECTED]> wrote: > Hello, > > I can't seem to get my sockets code to work right. Here is what I > have inside my RequestHandler handle() function: > >total_data=[] > >data = True >logger_server.debug(self.__class__.__name__ +

Re: Python style: exceptions vs. sys.exit()

2008-10-02 Thread greg
Lawrence D'Oliveiro wrote: In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > (2) Even when the source is available, it is sometimes a legal trap to > read it with respect to patents and copyright. That's not how patents work. I don't think that's how copyrights work either. As far as I

Re: Sample code required to validate a xml file against XSD

2008-10-02 Thread Frank Millman
On Oct 2, 3:32 pm, hrishy <[EMAIL PROTECTED]> wrote: > Hi > > Does anybody have a python xample program to validate a xml file against a > XSD. > > regards > Hrisy I have used minixsv successfully in a test environment - http://www.familieleuthe.de/MiniXsv.html Here is some sample code - #

Re: docs.python.org inaccessible

2008-10-02 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Terry Reedy wrote: > Seems to be working now, at least if you start at the top with > http://docs.python.org/ Yeah, I can get into it, thanks. Now to get used to the new layout... -- http://mail.python.org/mailman/listinfo/python-list

Re: Event-driven framework (other than Twisted)?

2008-10-02 Thread James Mills
On 10/2/08, Phillip B Oldham <[EMAIL PROTECTED]> wrote: > On Oct 2, 1:28 am, "James Mills" <[EMAIL PROTECTED]> wrote: > > Phillip, I have been developing a rather unique > > event-driven and component architecture library > > for quite some time that is (not twisted). Actually > > it's nothing

Re: Python is slow?

2008-10-02 Thread greg
Steven D'Aprano wrote: We agree that the restriction is artificial, and I think irrational I think it's irrational for another reason, too -- it's actually vacuous. There's nothing to prevent you creating a set of patches that simply say "Delete all of the original source and replace it with t

Re: questions from a lost sheep

2008-10-02 Thread Michele Simionato
On Oct 2, 11:08 pm, johannes raggam <[EMAIL PROTECTED]> wrote: > statically typed language: A language in which types are fixed at > compile time. Most statically typed languages enforce this by requiring > you to declare all variables with their datatypes before using them. > Java and C are static

Re: python-2.6

2008-10-02 Thread luca . ciciriello
Strange things happens. I've download the installer package for Mac of Python 2.6 and I've launched it. When finished, I've launched from a terminal the command "Python" and all worked fine The response was "Python 2.6 etc...". Now I've launched IDLE. Nothing. IDLE icon blinked a couple of time in

Conditionally subclassing based on Import

2008-10-02 Thread David Pratt
Hi, just want to conditionally base a class on another if it can be imported, otherwise base it on object. Does the following look ok for this? try: import foo.bar except ImportError: MyBase = foo.bar.Baz else: MyBase = object class Something(MyBase): -- http://mail.python.or

<    1   2