Re: splitting an XML file on the basis on basis of XML tags

2008-04-02 Thread Steve Holden
bijeshn wrote: > On Apr 2, 5:37 pm, Chris <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> Hi all, >>> i have an XML file with the following structure:: >>> >>> -| >>> | >>> | >>> . | >>> . | > constitutes one record.

Re: Where can I find :

2008-04-02 Thread alex23
On Apr 2, 10:08 pm, [EMAIL PROTECTED] wrote: > On Mar 30, 1:22 am, [EMAIL PROTECTED] wrote: > > [the usual masturbatory castironpi ramble] > > What? Yeah, that's what pretty much everyone says regarding his posts. Very very little signal amongst that noise. -- http://mail.python.org/mailman/list

Re: Parsing HTML?

2008-04-02 Thread benash
BeautifulSoup does what I need it to. Though, I was hoping to find something that would let me work with the DOM the way JavaScript can work with web browsers' implementations of the DOM. Specifically, I'd like to be able to access the innerHTML element of a DOM element. Python's built-in HTMLPar

Re: splitting an XML file on the basis on basis of XML tags

2008-04-02 Thread bijeshn
On Apr 2, 5:37 pm, Chris <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi all, > > >          i have an XML file with the following structure:: > > > > > -| > >     | > >     | > > .           | > > .           |         > constitutes one record. > > .        

Re: Parsing HTML?

2008-04-02 Thread Daniel Fetchinson
> I'm trying to parse an HTML file. I want to retrieve all of the text > inside a certain tag that I find with XPath. The DOM seems to make > this available with the innerHTML element, but I haven't found a way > to do it in Python. Have you tried http://www.google.com/search?q=python+html+parse

Re: Strange MySQL Problem...

2008-04-02 Thread John Nagle
Gabriel Genellina wrote: > En Wed, 02 Apr 2008 16:36:43 -0300, Victor Subervi > <[EMAIL PROTECTED]> escribió: > >> I have this code which works fine: > > "works fine"? Please check again... > The same remarks I've posted earlier apply here. In addition, you're not committing the database up

Re: Rationale for read-only property of co_code

2008-04-02 Thread John Nagle
Dan Upton wrote: >> The thing I've been wondering is why _is_ it read-only? In what >> circumstances having write access to co_code would break the language >> or do some other nasty stuff? >> >> João Neves > > I can't speak to Python's implementation in particular, but > self-modifying code i

Re: Why prefer != over <> for Python 3.0?

2008-04-02 Thread Tim Roberts
[EMAIL PROTECTED] (John J. Lee) wrote: > >How did programmers manage back then in 32k? Less software >development, more jigsaw puzzle. Yes, indeed. In response to a challenge posted on one of the x86 assembler newsgroups about two years ago, one intrepid Russian programmer produced a generic Sud

Re: Python in High School

2008-04-02 Thread Nick J Chackowsky
sprad wrote: > I'm a high school computer teacher, and I'm starting a series of > programming courses next year (disguised as "game development" classes > to capture more interest). The first year will be a gentle > introduction to programming, leading to two more years of advanced > topics. > I

Parsing HTML?

2008-04-02 Thread Benjamin
I'm trying to parse an HTML file. I want to retrieve all of the text inside a certain tag that I find with XPath. The DOM seems to make this available with the innerHTML element, but I haven't found a way to do it in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: class / module introspection?

2008-04-02 Thread Brian Munroe
On Apr 2, 2:26 pm, 7stud <[EMAIL PROTECTED]> wrote: > > You don't need that helper function, which is a little tricky to > follow: > Well, I appreciate the code sharing you did, but the helper function is nice and compact, and I didn't have much trouble following it. I ended up doing the followi

Re: Python queue madness

2008-04-02 Thread Gabriel Genellina
En Wed, 02 Apr 2008 10:52:08 -0300, nnp <[EMAIL PROTECTED]> escribió: > Basically I have a system where component 1, 2 and 3 communicate with > each > other using two Python Queues, we'll call them R and W. Here is what is > happening > > 1 writes data to W and reads from R > 2 reads data from W

Chopard Happy Sport Diamond Steel Black Ladies Watch 27/8361-23

2008-04-02 Thread jewelry087
Chopard Happy Sport Diamond Steel Black Ladies Watch 27/8361-23 Chopard Happy Sport Diamond Steel Black Ladies Watch 27/8361-23 Link : http://www.aaa-replica-watch.com/Chopard_27_8361_23.html Buy the cheapest Chopard Happy Sport Diamond Steel Black Ladies Watch 27/8361-23 in toppest Replica . www

Re: Prototype OO

2008-04-02 Thread castironpi
On Apr 2, 5:41 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 2 avr, 22:23, Paul Rubin wrote: > > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > Fine. But totally irrelevant here - this is comp.lang.python, not > > > comp.lang.c, and we *do not* (I repea

Re: Python in High School

2008-04-02 Thread Jan Claeys
Op Wed, 02 Apr 2008 17:02:45 -0400, schreef Dan Upton: > Side rant: I think Java's just fine, as long as it's taught properly. > I'd done a little bit of C and C++ programming when I was in high > school, trying to teach myself from a book, but I never really got > pointers or objects. Going bac

Re: Rationale for read-only property of co_code

2008-04-02 Thread Scott David Daniels
João Neves wrote: > On 2 Abr, 21:38, "Chris Mellon" <[EMAIL PROTECTED]> wrote: >> On Wed, Apr 2, 2008 at 2:33 PM, João Neves <[EMAIL PROTECTED]> wrote: >>> On Apr 2, 5:41 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: >>> > > The thing I've been wondering is why _is_ it read-only? In what >>> > > c

Re: Directed Graph Traversal

2008-04-02 Thread Scott David Daniels
bukzor wrote: > Can someone point me in the direction of a good solution of this? I'm > using it to construct a SQL query compiler, > Given a directed graph and a list of points in the graph, what is the > minimal subgraph that contains them all? It is preferable that the > subgraph is a tree.

Re: Strange MySQL Problem...

2008-04-02 Thread Gabriel Genellina
En Wed, 02 Apr 2008 16:36:43 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: > I have this code which works fine: "works fine"? Please check again... The same remarks I've posted earlier apply here. > print 'Content-Type: image/jpeg\r\n' > print '\nHi!\n' Don't you see a conflict among th

Re: Python in High School

2008-04-02 Thread Scott David Daniels
Laurent Pointal wrote: > Le Tue, 01 Apr 2008 12:35:46 -0700, Paddy a écrit : > And if you want to do easy and simple 3D graphics programming, look at > VPython > > http://www.vpython.org/ I offer a _strong_ second -- Nowhere in computing have I seen it easier to create stereoscopic views of 3-D

Re: Recursive function won't compile

2008-04-02 Thread Keith Thompson
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> #include >> #include >> >> def RecursiveFact(n): >> if(n>1): >> return n*RecursiveFact(n-1) >> else: >> return 1 >> >> fact = RecursiveFact(31) >> print fact >> >> fact = "End of program" >> print fact >> >> >> ..but y

Re: generator functions: why won't this work?

2008-04-02 Thread Mel
[EMAIL PROTECTED] wrote: > On Apr 2, 3:57 pm, Mel <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >> >> I'd just like to test my >> >>> understanding of this. Suppose I create the following generator >>> object: >>> g = getNextScalar(1, 2, (3, 4), 5) >>> when the iterator reaches the tuple a

Re: Classes in modules

2008-04-02 Thread Benjamin
On Apr 2, 8:05 pm, [EMAIL PROTECTED] wrote: > I'm trying to get this source code split into multiple files: > > http://pygermanwhist.googlecode.com/files/pygermanwhist.12.py > > I've been trying to make so that I have one class per file for easier > readability. My problem is that the interpreter

Re: Rationale for read-only property of co_code

2008-04-02 Thread Gabriel Genellina
En Wed, 02 Apr 2008 17:54:33 -0300, João Neves <[EMAIL PROTECTED]> escribió: > On 2 Abr, 21:38, "Chris Mellon" <[EMAIL PROTECTED]> wrote: >> There is no need to overwrite co_code. Create a new code object with >> your desired bytecode and use that instead. > > Yes, it may work (haven't tested -

Re: non-terminating regex match

2008-04-02 Thread Maurizio Vitale
MRAB <[EMAIL PROTECTED]> writes: > > I think the problem is with this bit: '(?:(?:::)?\w+)*'. The '::' is > optional and also in a repeated group, so if it tries to match, say, > 'abc' it can try and then backtrack all of these possibilities: abc, > ab c, a bc, a b c. The longer the string, the mo

Re: Pexpect question.

2008-04-02 Thread Paul Lemelle
Jorgen, Thanks for your reply. The ssh function is just a small part of what I would like to accomplish. And yes, chk is undefined, I was trying to figure out why control was not being returned from the sshcon funciton. I looked for pexpect doucment on http://www.noah.org/wiki/Pexpect, but th

Re: Why prefer != over <> for Python 3.0?

2008-04-02 Thread Paul Rubin
"Hendrik van Rooyen" <[EMAIL PROTECTED]> writes: > Some of the other veterans may want to add to this list. Overlays, lots and lots of them, in multiple levels intricately arranged. -- http://mail.python.org/mailman/listinfo/python-list

Re: Summary of threading for experienced non-Python programmers?

2008-04-02 Thread Paul Rubin
sturlamolden <[EMAIL PROTECTED]> writes: > Python's standard library should have an asynch module that uses aio > on Linux and i/o completion ports on Windows. It should work with > files and tcp sockets alike. Lately I'm hearing that Linux's aio implementation doesn't work very well yet. It is f

Classes in modules

2008-04-02 Thread hexusnexus
I'm trying to get this source code split into multiple files: http://pygermanwhist.googlecode.com/files/pygermanwhist.12.py I've been trying to make so that I have one class per file for easier readability. My problem is that the interpreter keeps saying that it can't find methods and so forth

Re: Strange MySQL Problem...

2008-04-02 Thread Steve Holden
Victor Subervi wrote: > Hi; > I have this code which works fine: > > #!/usr/local/bin/python > import _mysql > import MySQLdb, cPickle > host = 'mysqldb2.ehost-services.com ' > user = 'user' > passwd = 'pass' > db = 'bre' > print 'Content-Type: image/jpeg\r\n'

Re: Nested try...except

2008-04-02 Thread Carl Banks
On Apr 2, 9:06 am, [EMAIL PROTECTED] wrote: > Hi, > > I found the following code on the net - > > http://mail-archives.apache.org/mod_mbox/httpd-python-cvs/200509.mbox/[EMAIL > PROTECTED] > > def count(self): > -db = sqlite.connect(self.filename, > isolation_level=ISOLATION_LEVEL) > -

Re: function call - default value & collecting arguments

2008-04-02 Thread OKB (not okblacke)
Primoz Skale wrote: > OK, everything allright till so fair. But! :) Now define third > function as: > > def f(*a): >print a[0] > > In this case, function only prints first argument in the tuple: > >>>f(1,2,3) > 1 >>>f(3) > 3 >>>f()#no arguments passed > Traceback (most recent call last

Problems building a binary extension

2008-04-02 Thread llothar
I works well on Linux. But on FreeBSD when i use ../bin/python setup.py build_ext --inplace to select my own build python interpreter it is not using the correct library paths and therefore complains that it can't find the - lpython2.5 library. Using python-config i also don't see that the lib

Re: Nested try...except

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 15:22, [EMAIL PROTECTED] wrote: > On 2 Apr, 15:15, [EMAIL PROTECTED] wrote: > > > > > On 2 Apr, 15:12, [EMAIL PROTECTED] wrote: > > > > On Apr 2, 3:06 pm, [EMAIL PROTECTED] wrote: > > > > > Hi, > > > > > I found the following code on the net - > > > > > http://mail-archives.apache.org/mod

Re: Recursive function won't compile

2008-04-02 Thread George Sakkis
On Apr 2, 5:00 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > #include > > #include > > > def RecursiveFact(n): > > if(n>1): > > return n*RecursiveFact(n-1) > > else: > > return 1 > > > fact = RecursiveFact(31) > > print fact > > >

Module not found in script that was found in command-line interpreter. Possible Path issue?

2008-04-02 Thread Jacob Davis
Hi. I just installed the MySQLdb module and I have been able to get it to run in my command line interpreter. I am running Mac Leopard, and Python 2.5. I have tested importing and actually connecting and using a MySQL database, although it issues some warning: SnakeBite:MySQL-python-1.2

Re: Summary of threading for experienced non-Python programmers?

2008-04-02 Thread sturlamolden
On Apr 2, 1:26 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > It did *not* say that it supports every existing, more powerful and > generally better asynchronous mechanism supported by any OS out there. > Even though it would certainly be nice if it did :) Python's standard library should ha

Re: Nested try...except

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 15:12, [EMAIL PROTECTED] wrote: > On Apr 2, 3:06 pm, [EMAIL PROTECTED] wrote: > > > > > Hi, > > > I found the following code on the net - > > > http://mail-archives.apache.org/mod_mbox/httpd-python-cvs/200509.mbox/[EMAIL > > PROTECTED] > > > def count(self): > > -db = sqlite.

Re: Nested try...except

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 18:25, Nanjundi <[EMAIL PROTECTED]> wrote: > On Apr 2, 9:22 am, [EMAIL PROTECTED] wrote: > > > > > On 2 Apr, 15:15, [EMAIL PROTECTED] wrote: > > > > On 2 Apr, 15:12, [EMAIL PROTECTED] wrote: > > > > > On Apr 2, 3:06 pm, [EMAIL PROTECTED] wrote: > > > > > > Hi, > > > > > > I found the foll

Re: function call - default value & collecting arguments

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 22:32, "Primoz Skale" <[EMAIL PROTECTED]> wrote: > >> I also understand (fairly) how to collect arguments. For example, let's > >> define another function: > > >> def f(*a): > >>print a > > > This means that f takes any number of optional positional arguments. > > If nothing is passed

Re: class / module introspection?

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 22:04, Brian Munroe <[EMAIL PROTECTED]> wrote: > On Apr 2, 12:33 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > > Why not do the import here, so you store a real module instead of a > > name ? > > Right now I'm still in the prototyping phase and haven't really > thought everyt

Re: Prototype OO

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 22:23, Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > Fine. But totally irrelevant here - this is comp.lang.python, not > > comp.lang.c, and we *do not* (I repeat : we *do not*) face the same > > safety and security problems as those exi

Re: Python in High School

2008-04-02 Thread John Henry
On Apr 2, 1:32 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > John Henry wrote: > > On Apr 1, 11:10 am, sprad <[EMAIL PROTECTED]> wrote: > > >> On Apr 1, 11:41 am, mdomans <[EMAIL PROTECTED]> wrote: > > >>> Python needs no evangelizing but I can tell you that it is a powerfull > >>> tool. I prefer t

Re: Understanding bmp image files

2008-04-02 Thread Paul McGuire
On Apr 2, 2:22 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "pranav" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | Hello, > | I want to read a BMP file, do some processing and then write it in a > | new file. The problem is in the third step. For reading the file, i > | have

Re: generator functions: why won't this work?

2008-04-02 Thread Gabriel Genellina
En Wed, 02 Apr 2008 14:11:30 -0300, <[EMAIL PROTECTED]> escribió: > On Apr 1, 10:42 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Tue, 01 Apr 2008 23:56:50 -0300, <[EMAIL PROTECTED]> escribió: >> >>    yield *iterable >> >> could be used as a shortcut for this: >> >>    for __temp in

Re: Prototype OO

2008-04-02 Thread Gabriel Genellina
En Wed, 02 Apr 2008 09:23:21 -0300, sam <[EMAIL PROTECTED]> escribió: > Gabriel Genellina napisał(a): > > 1. You have different syntax for named and unnamed (lambdas) > functions. Functions and methods are different things in Python even > if they have same syntax. But all these are st

Re: class / module introspection?

2008-04-02 Thread 7stud
On Apr 2, 1:27 pm, Brian Munroe <[EMAIL PROTECTED]> wrote: > On Apr 2, 12:07 pm, Brian Munroe <[EMAIL PROTECTED]> wrote: > > > > > This gives me ['system1','system2'] - which I can then use __import__ > > on. > > Addendum, thanks Bruno! > > I also required the helper function (my_import) from the P

Re: april fools email backfires

2008-04-02 Thread Grant Edwards
On 2008-04-02, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > I nearly fell off my chair when I read this one. > > WE EXPECT FULL CHARACTER SET SUPPORT FOR EBCDIC AND A LARGE SUBSET > OF ASCII IN THE 1.34 RELEASE. TIHS WILL INCLUDE SUPPORT FOR SPECIAL CHR > SUCH AS THE EURO SYMBOL AND LOWER CASE LE

Re: xlrd and cPickle.dump

2008-04-02 Thread John Machin
[EMAIL PROTECTED] wrote: >> FWIW, it works here on 2.5.1 without errors or warnings. Ouput is: >> 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] >> 0.6.1 > > I guess it's a version issue then... I say again: Don't guess. > > I forgot about sorted! Yes, that would make sen

Re: Adding Images to MySQL

2008-04-02 Thread Gabriel Genellina
En Wed, 02 Apr 2008 10:05:56 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: > I have tried the following code: > > #!/usr/local/bin/python > import _mysql > import MySQLdb > host = 'mysqldb2.ehost-services.com' > user = 'user' > passwd = 'pass' > db = 'bre' > print 'Content-Type: image/jpeg

Re: Python in High School

2008-04-02 Thread John Henry
On Apr 2, 1:01 pm, John Henry <[EMAIL PROTECTED]> wrote: > On Apr 1, 11:10 am, sprad <[EMAIL PROTECTED]> wrote: > > > On Apr 1, 11:41 am, mdomans <[EMAIL PROTECTED]> wrote: > > > > Python needs no evangelizing but I can tell you that it is a powerfull > > > tool. I prefer to think that flash is rat

Re: Recursive function won't compile

2008-04-02 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > #include > #include > > def RecursiveFact(n): > if(n>1): > return n*RecursiveFact(n-1) > else: > return 1 > > fact = RecursiveFact(31) > print fact > > fact = "End of program" > print fact > > > ..but yet it still gives the right answe

Re: Recursive function won't compile

2008-04-02 Thread dj3vande
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: (Subject: Recursive function won't compile) >#include >#include > >def RecursiveFact(n): >..but yet it still gives the right answer. How is this possible? Possibly because it gives the right answer in a different language than it

Re: Python in High School

2008-04-02 Thread Dan Upton
On Wed, Apr 2, 2008 at 1:10 PM, Jan Claeys <[EMAIL PROTECTED]> wrote: > Op Tue, 01 Apr 2008 10:27:18 -0700, schreef sprad: > > > > I'm a high school computer teacher, and I'm starting a series of > > programming courses next year (disguised as "game development" classes > > to capture more inter

Re: Recursive function won't compile

2008-04-02 Thread ajaksu
On Apr 2, 5:23 pm, [EMAIL PROTECTED] wrote: > #include > #include > > def RecursiveFact(n): >     if(n>1): >         return n*RecursiveFact(n-1) >     else: >         return 1 > > fact = RecursiveFact(31) > print fact The output is 822283865417792281772556288000 and is correct. But the "#incl

Re: default method parameter behavior

2008-04-02 Thread Primoz Skale
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I ran into a similar situation like the following (ipython session). > Can anyone please explain why the behavior? > Thanks in advance. > > In [11]: def foo(b=[]): > : b.append(3) > : return b > : > > In [12]:

Re: Recursive function won't compile

2008-04-02 Thread Gary Herron
[EMAIL PROTECTED] wrote: > #include > #include > > def RecursiveFact(n): > if(n>1): > return n*RecursiveFact(n-1) > else: > return 1 > > fact = RecursiveFact(31) > print fact > > fact = "End of program" > print fact > > > ..but yet it still gives the right answer. How

Re: april fools email backfires

2008-04-02 Thread D'Arcy J.M. Cain
On Wed, 02 Apr 2008 12:29:58 -0500 Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-04-02, Paul Rubin wrote: > > http://www.coboloncogs.org/INDEX.HTM > That's absolutely brilliant! I particularly like the flashing > effect that simulates an old screen-at-time mode terminal (or > maybe a storage

Re: Rationale for read-only property of co_code

2008-04-02 Thread João Neves
On 2 Abr, 21:38, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 2:33 PM, João Neves <[EMAIL PROTECTED]> wrote: > > On Apr 2, 5:41 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: > > > > The thing I've been wondering is why _is_ it read-only? In what > > > > circumstances having w

Re: default method parameter behavior

2008-04-02 Thread Jerry Hill
On Wed, Apr 2, 2008 at 3:59 PM, <[EMAIL PROTECTED]> wrote: > I ran into a similar situation like the following (ipython session). > Can anyone please explain why the behavior? http://www.python.org/doc/faq/general/#why-are-default-values-shared-between-objects Since you got bitten by this, you

Re: Python in High School

2008-04-02 Thread Stef Mientki
John Henry wrote: > On Apr 1, 11:10 am, sprad <[EMAIL PROTECTED]> wrote: > >> On Apr 1, 11:41 am, mdomans <[EMAIL PROTECTED]> wrote: >> >> >>> Python needs no evangelizing but I can tell you that it is a powerfull >>> tool. I prefer to think that flash is rather visualization tool than >>>

Re: Rationale for read-only property of co_code

2008-04-02 Thread Chris Mellon
On Wed, Apr 2, 2008 at 2:33 PM, João Neves <[EMAIL PROTECTED]> wrote: > On Apr 2, 5:41 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: > > > The thing I've been wondering is why _is_ it read-only? In what > > > circumstances having write access to co_code would break the language > > > or do some

Re: default method parameter behavior

2008-04-02 Thread Konstantin Veretennicov
On Wed, Apr 2, 2008 at 10:59 PM, <[EMAIL PROTECTED]> wrote: > I ran into a similar situation like the following (ipython session). > Can anyone please explain why the behavior? Of course. >From http://docs.python.org/ref/function.html: Default parameter values are evaluated when the function def

Re: function call - default value & collecting arguments

2008-04-02 Thread Primoz Skale
>> I also understand (fairly) how to collect arguments. For example, let's >> define another function: >> >> def f(*a): >>print a > > This means that f takes any number of optional positional arguments. > If nothing is passed, within f, 'a' will be an empty tuple. Note that > this is *not* the

Re: Manipulate Large Binary Files

2008-04-02 Thread Derek Martin
On Wed, Apr 02, 2008 at 02:09:45PM -0400, Derek Tracy wrote: > Both are clocking in at the same time (1m 5sec for 2.6Gb), are there > any ways I can optimize either solution? Buy faster disks? How long do you expect it to take? At 65s, you're already reading/writing 2.6GB at a sustained transf

Recursive function won't compile

2008-04-02 Thread bc1891
#include #include def RecursiveFact(n): if(n>1): return n*RecursiveFact(n-1) else: return 1 fact = RecursiveFact(31) print fact fact = "End of program" print fact ..but yet it still gives the right answer. How is this possible? -- http://mail.python.org/mailman/l

Re: Prototype OO

2008-04-02 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Fine. But totally irrelevant here - this is comp.lang.python, not > comp.lang.c, and we *do not* (I repeat : we *do not*) face the same > safety and security problems as those existing in C. We have it better than they do in some ways. In some oth

Re: Python queue madness

2008-04-02 Thread Konstantin Veretennicov
On Wed, Apr 2, 2008 at 4:52 PM, nnp <[EMAIL PROTECTED]> wrote: > > Is there any other way for data to get onto a queue Yes, by manipulating Queue.Queue's internal "queue" attribute directly. > or are there any known bugs with Python's Queue module that could lead to > this kind of behaviour? >

Re: subtract dates with time module

2008-04-02 Thread barronmo
Thanks for the help everyone. I ended up with the following: def OBweeks(ptID): qry = 'SELECT short_des FROM problems WHERE patient_ID = %s;' % (ptID) results = EMR_utilities.getAllData(qry) for items in results: r = re.search('\d\d\d\d-\d\d-\d\d', str(items))

Re: class / module introspection?

2008-04-02 Thread Brian Munroe
On Apr 2, 12:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > Why not do the import here, so you store a real module instead of a > name ? > Right now I'm still in the prototyping phase and haven't really thought everything through. I needed the names because I am populating a GUI sele

Re: Python-by-example - new online guide to Python Standard Library

2008-04-02 Thread AK
CM wrote: > On Apr 2, 2:50 pm, AK <[EMAIL PROTECTED]> wrote: >> Terry Reedy wrote: >>> "AK" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>> || I'll be glad to hear comments/suggestions/etc: >>> | >>> |http://www.lightbird.net/py-by-example/ >>> Using - as the example/return deli

Re: Prototype OO

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 20:46, Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > Here the problem is more philosophical than anything else. Python's > > philosophy is that most programmers are responsible and normally > > intelligent, so treating them all like ret

Re: Python in High School

2008-04-02 Thread John Henry
On Apr 1, 11:10 am, sprad <[EMAIL PROTECTED]> wrote: > On Apr 1, 11:41 am, mdomans <[EMAIL PROTECTED]> wrote: > > > Python needs no evangelizing but I can tell you that it is a powerfull > > tool. I prefer to think that flash is rather visualization tool than > > programing language, and java needs

Re: who said python can't be obsfucated!?

2008-04-02 Thread Jon Nicoll
[EMAIL PROTECTED] wrote: > def s(c):return[]if c==[]else s([_ for _ in c[1:]if _ +s([_ for _ in c[1:]if _>=c[0]]) > > Anyone else got some wonders...? looks like one of castironpi's postings... J^n -- http://mail.python.org/mailman/listinfo/python-list

default method parameter behavior

2008-04-02 Thread jianbing . chen
I ran into a similar situation like the following (ipython session). Can anyone please explain why the behavior? Thanks in advance. In [11]: def foo(b=[]): : b.append(3) : return b : In [12]: foo() Out[12]: [3] In [13]: foo() Out[13]: [3, 3] In [14]: foo([]) Out[14]

Re: Manipulate Large Binary Files

2008-04-02 Thread George Sakkis
On Apr 2, 2:09 pm, "Derek Tracy" <[EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 10:59 AM, Derek Tracy <[EMAIL PROTECTED]> wrote: > > I am trying to write a script that reads in a large binary file (over 2Gb) > > saves the header file (169088 bytes) into one file then take the rest of > > the

Re: plpythonu+postgrs anybody using it?

2008-04-02 Thread Matthew Woodcraft
Martin Marcher <[EMAIL PROTECTED]> wrote: > My main concern is that when things start getting more complicated > that everytime a SP is called an instance of the interpreter ist > started which would be a huge slowdown, so does plpythonu run > continiously a python process or does it start one ever

Re: function call - default value & collecting arguments

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 21:03, "Primoz Skale" <[EMAIL PROTECTED]> wrote: > Hello! > > I am fairly new to Python, so I apologise if this is a 'newbie' question. > > First define a simple function: > > def f(a=0): > print a > > >> f(1) > 1 > >>f() > > 0 > > Argument a in function f() is set at default value of

Re: who said python can't be obsfucated!?

2008-04-02 Thread bearophileHUGS
cokofree...: > def s(c):return[]if c==[]else s([_ for _ in c[1:]if _ _ in c[1:]if _>=c[0]]) That QuickSort can be written as a lambda too: s=lambda l:[]if l==[]else s([x for x in l[1:]if x=l[0]]) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: non-terminating regex match

2008-04-02 Thread Konstantin Veretennicov
On Wed, Apr 2, 2008 at 9:32 PM, Maurizio Vitale <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > > > On Wed, 02 Apr 2008 16:01:59 +, Maurizio Vitale wrote: > > > >> And yes, I'm a total beginner when it comes to Python, but it seems > >> very strange to me th

Strange MySQL Problem...

2008-04-02 Thread Victor Subervi
Hi; I have this code which works fine: #!/usr/local/bin/python import _mysql import MySQLdb, cPickle host = 'mysqldb2.ehost-services.com' user = 'user' passwd = 'pass' db = 'bre' print 'Content-Type: image/jpeg\r\n' print '\nHi!\n' connection = MySQLdb.connect(host=host, user=user, passwd=passwd,

Re: class / module introspection?

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 21:07, Brian Munroe <[EMAIL PROTECTED]> wrote: > On Apr 2, 11:04 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > > More seriously: the answer is in the > > doc.http://www.python.org/doc/2.3.5/lib/built-in-funcs.html > > > read about the __import__ function, experiment in your

Re: Rationale for read-only property of co_code

2008-04-02 Thread João Neves
On Apr 2, 5:41 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: > > The thing I've been wondering is why _is_ it read-only? In what > > circumstances having write access to co_code would break the language > > or do some other nasty stuff? > > > João Neves > > I can't speak to Python's implementation

Re: function call - default value & collecting arguments

2008-04-02 Thread Terry Reedy
"Primoz Skale" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | def f(*a=(0,)): | print a[0] #this should come next, but we get error msg instead, saying | | SyntaxError: invalid syntax | | but it does not work this way. Now my 'newbie' question: Why not? :) Possibly beca

Re: class / module introspection?

2008-04-02 Thread Brian Munroe
On Apr 2, 12:07 pm, Brian Munroe <[EMAIL PROTECTED]> wrote: > > This gives me ['system1','system2'] - which I can then use __import__ > on. > Addendum, thanks Bruno! I also required the helper function (my_import) from the Python docs you pointed me to, that actually was the key to getting every

Re: Understanding bmp image files

2008-04-02 Thread Terry Reedy
"pranav" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hello, | I want to read a BMP file, do some processing and then write it in a | new file. The problem is in the third step. For reading the file, i | have converted the file into decimal numbers, representing the pixel | value

Re: non-terminating regex match

2008-04-02 Thread MRAB
On Apr 2, 5:01 pm, Maurizio Vitale <[EMAIL PROTECTED]> wrote: > Has to be something really stupid, but the following never finish > (running Python 2.5.1 (r251:54863, Jan 10 2008, 18:00:49) > [GCC 4.2.1 (SUSE Linux)] on linux2). > > The intention is to match C++ identifiers, with or without namespa

Re: class / module introspection?

2008-04-02 Thread Brian Munroe
On Apr 2, 11:04 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > More seriously: the answer is in the > doc.http://www.python.org/doc/2.3.5/lib/built-in-funcs.html > > read about the __import__ function, experiment in your interactive > python shell, and you should be done in a couple minut

Re: Python-by-example - new online guide to Python Standard Library

2008-04-02 Thread CM
On Apr 2, 2:50 pm, AK <[EMAIL PROTECTED]> wrote: > Terry Reedy wrote: > > "AK" <[EMAIL PROTECTED]> wrote in message > >news:[EMAIL PROTECTED] > > > || I'll be glad to hear comments/suggestions/etc: > > | > > |http://www.lightbird.net/py-by-example/ > > > Using - as the example/return delimiter does

function call - default value & collecting arguments

2008-04-02 Thread Primoz Skale
Hello! I am fairly new to Python, so I apologise if this is a 'newbie' question. First define a simple function: def f(a=0): print a >> f(1) 1 >>f() 0 Argument a in function f() is set at default value of 0, if it is not passed to the function at the function call. I get this! :) I also

Re: Prototype OO

2008-04-02 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Here the problem is more philosophical than anything else. Python's > philosophy is that most programmers are responsible and normally > intelligent, so treating them all like retarted dummies because > someone might one day do something stupid is j

Re: generator functions: why won't this work?

2008-04-02 Thread zillow10
On Apr 2, 3:57 pm, Mel <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I'd just like to test my > > > understanding of this. Suppose I create the following generator > > object: > > > g = getNextScalar(1, 2, (3, 4), 5) > > > when the iterator reaches the tuple argument (3, 4) then, accord

Re: xlrd and cPickle.dump

2008-04-02 Thread patrick . waldo
>FWIW, it works here on 2.5.1 without errors or warnings. Ouput is: >2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] >0.6.1 I guess it's a version issue then... I forgot about sorted! Yes, that would make sense! Thanks for the input. On Apr 2, 4:23 pm, [EMAIL PROTECTED]

Re: non-terminating regex match

2008-04-02 Thread Maurizio Vitale
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Wed, 02 Apr 2008 16:01:59 +, Maurizio Vitale wrote: > >> And yes, I'm a total beginner when it comes to Python, but it seems >> very strange to me that a regex match on a finite length string >> doesn't terminate > > It does terminate,

Re: License of Python

2008-04-02 Thread Jan Claeys
Op Sun, 30 Mar 2008 08:16:39 -0700, schreef iu2: > Due to Competitors... I don't want to expost the language I use If they are clever, they already know that you want to use python by now, after you posted this on a public mailing list / newsgroup... -- JanC -- http://mail.python.org/mailman

Re: Prototype OO

2008-04-02 Thread [EMAIL PROTECTED]
On 2 avr, 16:52, sam <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers napisał(a): > > > Don't misunderstand me : I'm not saying that class-based is better (or > > worse) than prototype, I'm not saying that Python is perfect, I'm not > > saying that your points are not worth any consideration, I'm j

Re: ANN: pry unit testing framework

2008-04-02 Thread j vickroy
Aldo Cortesi wrote: > We are happy to announce the first release of Pry, a unit testing framework. > > Features > > > * Built-in coverage analysis, profiling, and quick-and-dirty benchmarking > * Assertion-based tests - no ugly failUnless*, failIf*, etc. methods > * Tree-base

Re: Prototype OO

2008-04-02 Thread Carl Banks
On Apr 2, 10:52 am, sam <[EMAIL PROTECTED]> wrote: > Then I say: > > -- __id is awful, because it is a trick to prefix names > > and gurus say: > > -- it is good solution for name conflicts > > But somebody may prefix his names with class names and cause nameconflict, so > maybe it

Hyphenation: PyHyphen-0.7 released

2008-04-02 Thread Dr. leo
Hi, I have just uploaded the latest sources of PyHyphen (http://cheeseshop.python.org/pypi/PyHyphen). The tarball also contains Windows binaries of the C extension for Python 2.4 and 2.5. So most Windows users will get going without compiling. Just enter the usual 'python setup.py install'. There

Re: non-terminating regex match

2008-04-02 Thread Marc 'BlackJack' Rintsch
On Wed, 02 Apr 2008 16:01:59 +, Maurizio Vitale wrote: > And yes, I'm a total beginner when it comes to Python, but it seems > very strange to me that a regex match on a finite length string > doesn't terminate It does terminate, you just don't wait long enough. Try it with fewer characters

Re: python persistence

2008-04-02 Thread castironpi
On Apr 1, 3:21 pm, [EMAIL PROTECTED] wrote: > On Apr 1, 11:34 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > > > > > > En Tue, 01 Apr 2008 08:47:33 -0300, <[EMAIL PROTECTED]> escribió: > > > >> c['0']= type('None',(),{}) > > >> > Traceback (most recent call last): > > >> > pickle.Pic

  1   2   >