Re: Persistent python object and the Web

2005-04-21 Thread Esben Pedersen
[EMAIL PROTECTED] wrote: My problem is that I don't know how to create a graph_object that remains persistent through time (it has to be the same graph_object for One possibility is to have a remote procedure call server that stores the graph running seperately from your wab application. Your web

Re: New line

2005-04-21 Thread Esben Pedersen
ionic wrote: Ok sorry guys, using the python gui, if i hit the 'enter' key python just executes what ever ive typed. It doesnt take me to the next line. try shift + enter /Esben -- http://mail.python.org/mailman/listinfo/python-list

Re: Strings

2005-04-21 Thread John Machin
On Thu, 21 Apr 2005 21:16:43 +0800, Dan <[EMAIL PROTECTED]> wrote: >I've having trouble coming to grip with Python strings. > >I need to send binary data over a socket. I'm taking the data from a >database. When I extract it, non-printable characters come out as a >backslash followed by a three

Re: Dictionary question.

2005-04-21 Thread hawkesed
Here is an example of the input list: [101, 66, 75, 107, 108, 101, 106, 98, 111, 88, 119, 93, 115, 95, 114, 95, 118, 109, 85, 75, 88, 97, 53, 78, 98, 91, 115, 77, 107, 153, 108, 101] Here is the code I am working on now: >>> for num in alist: ... if adict.has_key(num): ... x = adic

Re: Semi-newbie, rolling my own __deepcopy__

2005-04-21 Thread [EMAIL PROTECTED]
I'm back... Thanks to Michael Spencer and Steven Bethard for their excellent help. It has taken me a few sessions of reading, and programming, and I've had to pick up the exploded fragments of my skull from time to time. But I now have succeeded in making deepcopy work for a simple class that I wr

Ron Grossi: God is not a man

2005-04-21 Thread Obaid R.
SUMMARY === For the past few weeks, a self-professed internet evangelist has posted several times to several news groups to claim several points as facts. It would appear that these assertions do not stand up to close examination, logic and reason, and stand in direct contradiction to the expl

Re: Dictionary question.

2005-04-21 Thread hawkesed
Steve, thanks for the input. That is actually what I am trying to do, but I don't know the syntax for this in python. For example here is a list I want to work with as input: [101, 66, 75, 107, 108, 101, 106, 98, 111, 88, 119, 93, 115, 95, 114, 95, 118, 109, 85, 75, 88, 97, 53, 78, 98, 91, 115, 77

Re: Regular Expressions - Python vs Perl

2005-04-21 Thread Karl A. Krueger
Terry Reedy <[EMAIL PROTECTED]> wrote: > Depending upon you particular application, 'completeness' may be a > more relevant concern than 'performance'. I believe the original > Python regex engine did not have all the Perl extensions, some of them > decidedly 'non regular'. It was replace by the

Re: Semi-newbie, rolling my own __deepcopy__

2005-04-21 Thread Michael Spencer
[EMAIL PROTECTED] wrote: I'm back... [wondering why copy.deepcopy barfs on array instances] http://www.python.org/doc/2.3.3/lib/module-copy.html deepcopy: ... This version does not copy types like module, class, function, method, stack trace, stack frame, file, socket, window, *array*, or any sim

Re: New line

2005-04-21 Thread Dan
On Thu, 21 Apr 2005 21:34:03 +0100, "ionic" <[EMAIL PROTECTED]> wrote: Open a text editor and write your code. Save the file with a .py extension, i.e., myprogram.py. From the command line type 'python myfile.py' Dan > >Ok sorry guys, > >using the python gui, if i hit the 'enter' key python ju

Re: Dictionary question.

2005-04-21 Thread hawkesed
Actually, I think I got it now. Here is what I did: >>> for num in alist: ... if adict.has_key(num): ... x = adict.get(num) ... x = x + 1 ... adict.update({num:x}) ... else: ... adict.update({num:1}) ... >>> adict {128: 2, 129: 2, 132: 1, 15

Re: Dictionary question.

2005-04-21 Thread Brian van den Broek
hawkesed said unto the world upon 2005-04-21 20:28: Actually, I think I got it now. Here is what I did: for num in alist: ... if adict.has_key(num): ... x = adict.get(num) ... x = x + 1 ... adict.update({num:x}) ... else: ... adict.updat

Re: Strings

2005-04-21 Thread Dan
On Thu, 21 Apr 2005 10:09:59 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: Thanks, that's exactly what I wanted. Easy when you know how. Dan >Dan wrote: >> I've having trouble coming to grip with Python strings. >> >> I need to send binary data over a socket. I'm taking the data from a >> da

Re: Dictionary question.

2005-04-21 Thread Kent Johnson
hawkesed wrote: Actually, I think I got it now. Here is what I did: for num in alist: ... if adict.has_key(num): ... x = adict.get(num) ... x = x + 1 ... adict.update({num:x}) A simpler way to do this last line is adict[num] = x ... else: ...

Re: Strings

2005-04-21 Thread Bengt Richter
On Thu, 21 Apr 2005 10:09:59 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Dan wrote: >> I've having trouble coming to grip with Python strings. >> >> I need to send binary data over a socket. I'm taking the data from a >> database. When I extract it, non-printable characters come out as a >>

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Greg Ewing
Antoon Pardon wrote: This is nonsens. table[i] = j, just associates value j with key i. That is the same independend from whether the keys can start from 0 or some other value. Also, everyone, please keep in mind that you always have the option of using a *dictionary*, in which case your indices ca

Smooth upgrade to New Version

2005-04-21 Thread kent sin
Python is now enter 2.4 era. It is greate, and I want to upgrade too. However, everytime upgrading to a new version is a great pain. For every version, we start to re-install what have been in our past python. Re-install all packages sometimes require searching for a new version of binary which i

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Greg Ewing
Roy Smith wrote: What would actually be cool is if Python were to support the normal math notation for open or closed intervals. > foo = bar (1, 2) foo = bar (1, 2] foo = bar [1, 2) foo = bar [1, 2] That would certainly solve this particular problem, but the cost to the rest of the language synta

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Greg Ewing
[EMAIL PROTECTED] wrote: I disagree. Programming languages should not needlessly surprise people, and a newbie to Python probably expects that x[1:3] = [x[1],x[2],x[3]]. But said newbie's expectations will differ considerably depending on which other language he's coming from. So he's almost always

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Greg Ewing <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > > What would actually be cool is if Python were to support the normal math > > notation for open or closed intervals. > > > > foo = bar (1, 2) > > foo = bar (1, 2] > > foo = bar [1, 2) > > foo = bar [1

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread beliavsky
Dan Bishop wrote: > Antoon Pardon wrote: > > Like users have a choice in how long they make a list, they > > should have a choice where the indexes start. (And that > > shouldn't be limited to 0 and 1). > > Suppose you could. Then what should > > ([3, 1, 4] indexbase 0) + ([1, 5, 9] indexbase

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Paul Rubin
[EMAIL PROTECTED] writes: > > Suppose you could. Then what should > > ([3, 1, 4] indexbase 0) + ([1, 5, 9] indexbase 4) > > equal? > If + means add, the result would be ([4,6,13] indexbase 0) . That's counterintuitive. I'd expect c = a + b to result in c[i] = a[i]+b[i] for all elements. So, fo

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Roy Smith
Greg Ewing <[EMAIL PROTECTED]> wrote: > Also, everyone, please keep in mind that you always have > the option of using a *dictionary*, in which case your > indices can start wherever you want. > > You can't slice them, true, but you can't have everything. :-) Of course you can slice them, you jus

Re: Regular Expressions - Python vs Perl

2005-04-21 Thread codecraig
Thanks for the input. I was just looking for some feedback about which was better and faster, if an answer exists. However, I am not choosing Perl or Python b/c of it's RegEx engine as someone mentioned. The question was just because I was curious, sorry if I misled you to think I was choosing w

Re: Semi-newbie, rolling my own __deepcopy__

2005-04-21 Thread Michael Spencer
Michael Spencer wrote: http://www.python.org/doc/2.3.3/lib/module-copy.html deepcopy: ... This version does not copy types like module, class, function, method, stack trace, stack frame, file, socket, window, *array*, or any similar types. ... On reflection, I realize that this says that the arr

Re: deprecation of has_key?

2005-04-21 Thread John Roth
"Terry Reedy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] "Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Ahh, ok. Now I understand. I think you could probably search the python-dev archives and see why the decision was made as it was. For pretty

Re: How can I verify that a passed argument is an interiblecollection?

2005-04-21 Thread Terry Reedy
> On Thu, 21 Apr 2005 09:59:54 -0500, Larry Bates > <[EMAIL PROTECTED]> wrote: > >>2) Or if you not you could see if the argument has next and >>__iter__ methods (more general solution) >> >>if hasattr(arg, 'next') and not hasattr(arg, '__iter__'): >># perform work on iterable The 'not' is a

Re: How to run Python in Windows w/o popping a DOS box?

2005-04-21 Thread Paul Rubin
[EMAIL PROTECTED] (Bengt Richter) writes: > I would try right-clicking the shortcut icon and selecting > properties, then select the shortcut tab and edit the target string > with s/python/pythonw/ and then click ok. > > Then try double clicking the shortcut icon again. If that does it, > you're

How to prevent Tkinter frame resize?

2005-04-21 Thread phil_nospam_schmidt
I am trying to prevent a user from resizing a frame beyond its "natural" size as given by winfo_reqwidth and winfo_reqheight, without any success. Can anyone make any suggestions, based on my code below? Thanks! from Tkinter import * class Table(Frame): def __init__(self, master,

Manipulating large blobs in Python

2005-04-21 Thread Tim Stone
I'm working on a module that will manipulate large blobs. I'm using a C dll to allocate big blocks of memory, using PyMem_Malloc, which is working quite well up until I try to manipulate a blob that exhausts Python's heap. I'm guessing that to increase the heapsize, I'm going to have to recom

Re: Regular Expressions - Python vs Perl

2005-04-21 Thread Ilpo Nyyssönen
James Stroud <[EMAIL PROTECTED]> writes: > Is it relevant that Python can produce compiled expressions? I don't think > that there is such a thing with Perl. The problem in python here is that it needs to always recompile the regexp. I would like to have a way to write a regexp as a constant and

Re: grouping subsequences with BIO tags

2005-04-21 Thread Bengt Richter
On Thu, 21 Apr 2005 15:37:03 -0600, Steven Bethard <[EMAIL PROTECTED]> wrote: >I have a list of strings that looks something like: > ['O', 'B_X', 'B_Y', 'I_Y', 'O', 'B_X', 'I_X', 'B_X'] >I need to group the strings into runs (lists) using the following rules >based on the string prefix: >

Re: Design advice for unit test asserters

2005-04-21 Thread Edvard Majakari
"Gary" <[EMAIL PROTECTED]> writes: [ py.test ad follows :) ] > def test_SomeTest(...): > ... > self.AssertAllFilesExist(fileList) > > or > > def test_SomeTest(...): > ... > [ self.AssertFileExists(f) for f in fileList ] I prefer the latter, because t

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Mike Meyer
Roy Smith <[EMAIL PROTECTED]> writes: > Greg Ewing <[EMAIL PROTECTED]> wrote: >> Also, everyone, please keep in mind that you always have >> the option of using a *dictionary*, in which case your >> indices can start wherever you want. >> >> You can't slice them, true, but you can't have everythi

Re: python LEX

2005-04-21 Thread Mike Meyer
Miki Tebeka <[EMAIL PROTECTED]> writes: > Hello jozo, > >> I have to work on python lexical definition in Lex. I spent lots of my >> time to find regular expresions written for Lex of Python language but >> nothing. >> Can somebody help me? > http://www.antlr.org/grammar/list (search for Python) >

Re: goto statement

2005-04-21 Thread Mike Meyer
Grant Edwards <[EMAIL PROTECTED]> writes: > On 2005-04-21, Roy Smith <[EMAIL PROTECTED]> wrote: >> Grant Edwards <[EMAIL PROTECTED]> wrote: >>>Sure, but what about the case where his program is on paper >>>tape and all he has for an editor is an ice pick? >> >> Can't you emulate that in emacs wit

Re: Manipulating large blobs in Python

2005-04-21 Thread Fredrik Lundh
Tim Stone wrote: I'm working on a module that will manipulate large blobs. I'm using a C dll to allocate big blocks of memory, using PyMem_Malloc, which is working quite well up until I try to manipulate a blob that exhausts Python's heap. how large is that? I'm guessing that to increase the he

regarding system function

2005-04-21 Thread praba kar
Dear All, In Php If I send a command to system function then It will return 1 on success and 0 on failure. So based upon that value I can to further work. But In Python If I send a command to system function then It will return 0 only for both conditions(success and failure). So What

Run Unix shell command $ parse command line arguments in python

2005-04-21 Thread rkoida
Hello evryone I am a newbie to python. I have a makefile which i can compile in UNIX/LINUX, But i I am planning to write a python script which actually does what my MAKEFILE does. The make file is #Makefile and some scripts to give output #numbers #Change till sign #END var1:=564-574 a1 =

Re: XML parsing per record

2005-04-21 Thread William Park
Willem Ligtenberg <[EMAIL PROTECTED]> wrote: > On Sun, 17 Apr 2005 02:16:04 +, William Park wrote: > > Care to post more details? > > The XML file I need to parse contains information about genes. > So the first element is a gene and then there are a lot sub-elements with > sub-elements. I onl

time.strftime in 2.4.1 claims data out of range when not

2005-04-21 Thread Sheila King
I have a web app that has been running just fine for several months under Python 2.2.2. We are preparing to upgrade the server to run Python 2.4.1. However, part of my web app is throwing an error on this code (that has previously worked without exception): >>> time.strftime("%Y-%m-%d", (Y, M,

Re: Why Python does *SLICING* the way it does??

2005-04-21 Thread Antoon Pardon
Op 2005-04-21, Dan Bishop schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> Op 2005-04-21, Steve Holden schreef <[EMAIL PROTECTED]>: >> > [EMAIL PROTECTED] wrote: > ... >> >> Along the same lines, I think the REQUIREMENT that x[0] rather > than >> >> x[1] be the first element of list x is a mi

Re: regarding system function

2005-04-21 Thread Mike Meyer
praba kar <[EMAIL PROTECTED]> writes: > Dear All, > > In Php If I send a command to system function > then It will return 1 on success and 0 on failure. So > based upon that value I can to further work. > > But In Python If I send a command to system > function then It will return 0 onl

Re: regarding system function

2005-04-21 Thread Robert Kern
praba kar wrote: Dear All, In Php If I send a command to system function then It will return 1 on success and 0 on failure. So based upon that value I can to further work. But In Python If I send a command to system function then It will return 0 only for both conditions(success and fail

<    1   2   3