Re: How properly manage memory of this PyObject* array?? (C extension)

2006-07-13 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Now it would appear that if you **malloc an array of PyObjects** > (call it FOO[]) then you have an ambiguity > > The PyObject elements will be freed *for us* eventually by garbage > collector. > > Hence, we can't ever do 'free(FOO); ' because we don't know when >

Re: How to have application-wide global objects

2006-07-13 Thread Sanjay
Got crystal clear. Thanks a lot to all for the elaborated replies. Sanjay -- http://mail.python.org/mailman/listinfo/python-list

Re: How properly manage memory of this PyObject* array?? (C extension)

2006-07-13 Thread [EMAIL PROTECTED]
> It's quite simple, really: You malloc it, you free it. John - I hope you don't mind that I really want to make sure I understand your good wisdom in this area by asking for clarification ASSUMPTIONS: 1. As long as we properly handle the reference counting of PyObjects then memory ma

Re: Regular Expression problem

2006-07-13 Thread Paul McGuire
Pyparsing is also good for recognizing basic HTML tags and their attributes, regardless of the order of the attributes. -- Paul testText = """sldkjflsa;faj here it would be 'mystylesheet.css'. I used the following regex to get this value(I dont know if it I thought I was doing fine until I go

Re: Regular Expression problem

2006-07-13 Thread Ant
> So What should I do to get the exact value(here the value after > 'href=') in any case even if the > > tags are like these? >> > > > -OR- > > -OR- > The following should do it: expr = r'http://mail.python.org/mailman/listinfo/python-list

Re: TFTP client in python

2006-07-13 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > Is there a TFTP client python module? I just need "get file" feature. > I came across two implementations on WEB, but they are kind of > unfinished (got the code from some mailing list!). Second hit in Google ("tftp python"): http://mail.python.org/pipermail/python-list

Re: Chunking sequential values in a list

2006-07-13 Thread Paul Rubin
David Hirschfield <[EMAIL PROTECTED]> writes: > So sequentialChunks([1,2,3,5,6,8,12]) returns: > [[1,2,3],[5,6],[8],[12]] Ugly and not too efficient: find the break points and use them to make sub-lists. def sequentialChunks(l, stride=1): p = [0] + [i for i in xrange(1,len(l)) if l[i]-l[i-1]

Re: Line by line execution of python code

2006-07-13 Thread Stefan Behnel
Justin Powell wrote: > Hi, I'm looking for suggestions on how to accomplish something in python. If > this is the wrong list for such things, I appologize and please disregard the > rest. No, this is totally the right place. > My application needs to allow users to create scripts which will be

Re: attaching debugger to runinng python program

2006-07-13 Thread Bill Pursell
alf wrote: > Hi, > > I have a two fold question: > -how to attach the debugger to running multi threaded program > -the objective is to find an infinite loop in one of threads which > makes the whole thingy going craze (100%CPU) > > The program itself is not easy, in fact quite hude an

TFTP client in python

2006-07-13 Thread malahal
Is there a TFTP client python module? I just need "get file" feature. I came across two implementations on WEB, but they are kind of unfinished (got the code from some mailing list!). Thanks, Malahal. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cool Ebooks Site

2006-07-13 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > Submit your comments because I need them! [loads of SPAM deleted] As I infer from the type of your posting, what you *want* is a good placement in Google, but what you really *need* is a good lawyer. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Chunking sequential values in a list

2006-07-13 Thread skip
Gerard> David Hirschfield wrote: >> I have this function: >> >> def sequentialChunks(l, stride=1): ... >> >> Which takes a list of numerical values "l" and splits it into chunks >> where each chunk is sequential... Gerard> see the groupby example here: G

Re: Cool Ebooks Site

2006-07-13 Thread Michael P.
Hey, pretty impressive list. I downloaded a few myself. -- http://mail.python.org/mailman/listinfo/python-list

Re: Configuring IDLE on Linux

2006-07-13 Thread Adonis
Satya Kiran wrote: > Hello, > I have upgraded to Python2.4 on my Red Hat 9.0 Linux box. > I want to work with IDLE and ran a search to check it's presence. > Here is what I get. > > [EMAIL PROTECTED] bin]# find / -iname idlelib > /usr/local/lib/python2.4/idlelib > > [EMAIL PROTECTED] bin]# cd /us

Re: 3d simulation

2006-07-13 Thread Carl Banks
Edmond Dantes wrote: > I would tend to think that Lisp is more suited for Genetic Programming than > Python is. However, it is possible to do. Heck, I even had the crazy idea > of doing Genetic Programming in C++ once, however ugly that would've > been! > > Actually, there is an AI project that

Configuring IDLE on Linux

2006-07-13 Thread Satya Kiran
Hello, I have upgraded to Python2.4 on my Red Hat 9.0 Linux box. I want to work with IDLE and ran a search to check it's presence. Here is what I get. [EMAIL PROTECTED] bin]# find / -iname idlelib /usr/local/lib/python2.4/idlelib [EMAIL PROTECTED] bin]# cd /usr/local/lib/python2.4/idlelib [EMAIL

Re: What is a type error?

2006-07-13 Thread Chris Smith
Marshall <[EMAIL PROTECTED]> wrote: > > What you are asking for is some subset of identity, and I've not yet > > succeeded in understanding exactly what it is or what its limits are... > > except that so far, it seems to have everything to do with pointers or > > aliasing. > > Perhaps it is specif

Re: testing array of logicals

2006-07-13 Thread John Henry
Simon Forman wrote: > > > > False not in logflags > > > > Or, if your values aren't already bools > > False not in (bool(n) for n in logflags) > > > > Peace, > ~Simon Very intriguing use of "not in"... Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: 3d simulation

2006-07-13 Thread placid
Edmond Dantes wrote: > placid wrote: > > > > > alimoe wrote: > >> > Genetic Programming or Genetic Algorithms? > >> > >> whats the difference? > > > > > > Genetic Programming: > > is an automated methodology inspired by biological evolution to find > > computer programs that best perform a user-de

Re: What is a type error?

2006-07-13 Thread Marshall
Chris Smith wrote: > Marshall <[EMAIL PROTECTED]> wrote: > > Chris Smith wrote: > > > Darren New <[EMAIL PROTECTED]> wrote: > > > > Chris Smith wrote: > > > > > Unless I'm missing your point, I disagree with your disagreement. > > > > > Mutability only makes sense because of object identity (in the

Re: testing array of logicals

2006-07-13 Thread Simon Forman
> > False not in logflags > Or, if your values aren't already bools False not in (bool(n) for n in logflags) Peace, ~Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: testing array of logicals

2006-07-13 Thread Simon Forman
John Henry wrote: > Hi list, > > Is there a more elagant way of doing this? > > # logflags is an array of logicals > test=True > for x in logflags: >test = test and x > print test > > -- > Thanks, So many ways *drool* How about: False not in logflags (Anybody gonna run all these throu

Re: Byte array question

2006-07-13 Thread John Machin
On 14/07/2006 10:41 AM, Dan Winsor wrote: > Sybren Stuvel wrote: >> Dan Winsor enlightened us with: >>> This one "works" in that it runs, but the server on the other end gets >>> garbage unrelated to the test file. >> Are you sure it is garbage? Have you tried changing byte order? > > Ah, that I h

Re: String handling and the percent operator

2006-07-13 Thread Simon Forman
Tom Plunket wrote: > Simon Forman wrote: > > > strings have a count() method. > > thanks! > > For enrichment purposes, is there a way to do this sort of thing with > a generator? E.g. something like: > > def SentenceGenerator(): >words = ['I', 'have', 'been', 'to', 'the', 'fair'] >for w in

Re: String handling and the percent operator

2006-07-13 Thread Brett g Porter
Justin Azoff wrote: > Tom Plunket wrote: >> boilerplate = \ >> """ > [big string] >> """ >> >> return boilerplate % ((module,) * 3) >> [deletia...] > Of course.. > stuff = {'lang': 'python', 'page': 'typesseq-strings.html'} print """I should read the %(lang)s documentation at

Re: What is a type error?

2006-07-13 Thread David Hopwood
Chris Smith wrote: > David Hopwood <[EMAIL PROTECTED]> wrote: > >>This is true, but note that postconditions also need to be efficient >>if we are going to execute them. > > If checked by execution, yes. In which case, I am trying to get my head > around how it's any more true to say that funct

Re: Regular Expression problem

2006-07-13 Thread Justin Azoff
Justin Azoff wrote: > >>> from BeautifulSoup import BeautifulSoup > >>> html='' > >>> page=BeautifulSoup(html) > >>> page.link.get('href') > 'mystylesheet.css' On second thought, you will probably want something like >>> [link.get('href') for link in page.fetch('link',{'type':'text/css'})] ['myst

Re: 3d simulation

2006-07-13 Thread Edmond Dantes
placid wrote: > > alimoe wrote: >> > Genetic Programming or Genetic Algorithms? >> >> whats the difference? > > > Genetic Programming: > is an automated methodology inspired by biological evolution to find > computer programs that best perform a user-defined task. > > http://en.wikipedia.org/w

Re: Regular Expression problem

2006-07-13 Thread Justin Azoff
John Blogger wrote: > That I want a particular tag value of one of my HTML files. > > ie: I want only the value after 'href=' in the tag >> > > '' > > here it would be 'mystylesheet.css'. I used the following regex to get > this value(I dont know if it is good). No matter how good it is you should

Re: Byte array question

2006-07-13 Thread Dan Winsor
Sybren Stuvel wrote: > Dan Winsor enlightened us with: > > This one "works" in that it runs, but the server on the other end gets > > garbage unrelated to the test file. > > Are you sure it is garbage? Have you tried changing byte order? Ah, that I hadn't. Any pointers to doing that? -- http:/

Re: What is a type error?

2006-07-13 Thread Chris Smith
Marshall <[EMAIL PROTECTED]> wrote: > Chris Smith wrote: > > Darren New <[EMAIL PROTECTED]> wrote: > > > Chris Smith wrote: > > > > Unless I'm missing your point, I disagree with your disagreement. > > > > Mutability only makes sense because of object identity (in the generic > > > > sense; no OO g

Re: String handling and the percent operator

2006-07-13 Thread Justin Azoff
Tom Plunket wrote: > boilerplate = \ > """ [big string] > """ > > return boilerplate % ((module,) * 3) > > My question is, I don't like hardcoding the number of times that the > module name should be repeated in the two return functions. Is there > an straight forward (inline-appropria

Re: Problem Solved

2006-07-13 Thread Gerhard Fiedler
On 2006-07-13 20:46:16, dylpkls91 wrote: > Thank you all for your responses. > > I have managed to figure out a solution using XML RPC which fits my > needs perfectly. BTW, if you want to test networking between two machines on one single (Windows) computer, try VirtualPC. (Free from MS.) Gerha

attaching debugger to runinng python program

2006-07-13 Thread alf
Hi, I have a two fold question: -how to attach the debugger to running multi threaded program -the objective is to find an infinite loop in one of threads which makes the whole thingy going craze (100%CPU) The program itself is not easy, in fact quite hude and sometimes it takes

Re: String handling and the percent operator

2006-07-13 Thread Erik Max Francis
Tom Plunket wrote: > For enrichment purposes, is there a way to do this sort of thing with > a generator? E.g. something like: > > def SentenceGenerator(): >words = ['I', 'have', 'been', 'to', 'the', 'fair'] >for w in words: > yield w > > message = "%s %s %s %s" > > print messag

Problem Solved

2006-07-13 Thread dylpkls91
Thank you all for your responses. I have managed to figure out a solution using XML RPC which fits my needs perfectly. -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a type error?

2006-07-13 Thread Marshall
Chris Smith wrote: > Darren New <[EMAIL PROTECTED]> wrote: > > Chris Smith wrote: > > > Unless I'm missing your point, I disagree with your disagreement. > > > Mutability only makes sense because of object identity (in the generic > > > sense; no OO going on here). > > > > Depends what you mean by

Re: String handling and the percent operator

2006-07-13 Thread Tom Plunket
Simon Forman wrote: > strings have a count() method. thanks! For enrichment purposes, is there a way to do this sort of thing with a generator? E.g. something like: def SentenceGenerator(): words = ['I', 'have', 'been', 'to', 'the', 'fair'] for w in words: yield w message = "%s %

Re: What is a type error?

2006-07-13 Thread Marshall
Joe Marshall wrote: > Marshall wrote: > > > > Consider the following Java fragment: > > > > void foo() { > > int i = 0; > > int j = 0; > > > > // put any code here you want > > > > j = 1; > > i = 2; > > // check value of j here. It is still 1, no matter what you filled in > > above. > >

Re: What is a type error?

2006-07-13 Thread Rob Warnock
Marshall <[EMAIL PROTECTED]> wrote: +--- | Joachim Durchholz wrote: | > Actually SQL has references - they are called "primary keys", but they | > are references nevertheless. | | I strongly object; this is quite incorrect. I grant you that from the | 50,000 foot level they appear iden

Re: problem in executing a file

2006-07-13 Thread Neil Hodgson
Ernesto: > import os > os.system("file.exe parameters") > > but I received an error like "cmd.exe : permission deneided" > > Probably I don't have the permission to execute the file. However, the server > administrator said me that he cannot give me the permission, but I can also > use > ed exe

Re: String handling and the percent operator

2006-07-13 Thread Simon Forman
Tom Plunket wrote: > I have some code to autogenerate some boilerplate code so that I don't > need to do the tedious setup stuff when I want to create a new module. > > So, my script prompts the user for the module name, then opens two > files and those files each get the contents of one of these f

Re: Tix Tree open/close issue

2006-07-13 Thread Rob Williscroft
Sorin Schwimmer wrote in news:mailman.8142.1152816058.27775.python- [EMAIL PROTECTED] in comp.lang.python: > The following code: > > from Tix import * > > r=Tk() > > tr=Tree(r) > tr.subwidget('hlist').add('br1',text='branch 1') > tr.subwidget('hlist').add('br1.b1',text='branch 1-1') > tr.subwid

Re: Regular Expression problem

2006-07-13 Thread cdecarlo
Hey, I'm new with regex's as well but here is my idea. Since you don't know which attribute will come first why don't structure your regex like this (first off, I'll assume that \s == ' ', actually now that I think of it, isn't \s any whitespace character? anyways \s == ' ' for now) '' I think

String handling and the percent operator

2006-07-13 Thread Tom Plunket
I have some code to autogenerate some boilerplate code so that I don't need to do the tedious setup stuff when I want to create a new module. So, my script prompts the user for the module name, then opens two files and those files each get the contents of one of these functions: def GetPyContents

Re: Line by line execution of python code

2006-07-13 Thread mkPyVS
Try this... slightly more complex but get's the job done-> added some wait state in the user program/thread so it didn't kill the output stream... Enjoy import thread, sys, time def someUserProgram(mutexRef): while 1: mutexRef.acquire() print "I am a user p

Regular Expression problem

2006-07-13 Thread John Blogger
(I don't know if it is the right place. So if I am wrong, please point me the right direction. If this post is read by you masters, I'm honoured. If I am getting a mere response, I'm blessed!) Hi, I'm a newbie regular expression user. I use regex in my Python programs. I have a strange (sometim

Re: What is a type error?

2006-07-13 Thread Chris Smith
David Hopwood <[EMAIL PROTECTED]> wrote: > This is true, but note that postconditions also need to be efficient > if we are going to execute them. If checked by execution, yes. In which case, I am trying to get my head around how it's any more true to say that functional languages are compilabl

Re: What is a type error?

2006-07-13 Thread Chris Smith
Darren New <[EMAIL PROTECTED]> wrote: > Chris Smith wrote: > > Unless I'm missing your point, I disagree with your disagreement. > > Mutability only makes sense because of object identity (in the generic > > sense; no OO going on here). > > Depends what you mean by "object". > > int x = 6; in

Re: What is a type error?

2006-07-13 Thread Joe Marshall
Marshall wrote: > > Consider the following Java fragment: > > void foo() { > int i = 0; > int j = 0; > > // put any code here you want > > j = 1; > i = 2; > // check value of j here. It is still 1, no matter what you filled in > above. > // The assignment to i cannot be made to affec

Cool Ebooks Site

2006-07-13 Thread bigskipster
http://cooldogebooks.blogspot.com Submit your comments because I need them! Thank You. Prentice Hall | Microsoft Press | Algorithics | Nolo Press & Law | Energy Conversion | DNA Biology | Money Management | Stock Trading | GNU Debugging | Online Unleashed | Origami | Object Recovery | TRS80 R

Re: Execute Commands on Remote Computers over Network

2006-07-13 Thread dylpkls91
Ben Sizer wrote: > Paramiko appears to use SSH, which (as far as I know) > connects to a computer running an sshd program or equivalent and > executes commands via that program. If there's no sshd running on the > target, you can't do anything. Thanks for the clarification. Can I get 'sshd' or an

Re: WMI Help

2006-07-13 Thread 3c273
"Tim Golden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 3c273 wrote: > > Hello, > > When I run the following at an interactive interpreter on Windows XP, I get > > the expected results. But if I save it to a file and run it, it generates > > the following error. (And it generates

Re: Py_NewInterpreter(), is this a bug in the python core?

2006-07-13 Thread freesteel
freesteel wrote: > Yes, I see that now in the documentation, which to me is quite > confusing. > So, how do you use python in a multithreaded environment, where for > example you want to run some embeded python code from a number of > different C threads? > > This article: http://www.linuxjournal.c

Re: Problem with "&" charater in xml.

2006-07-13 Thread Joe Kesselman
Note that any good SAX tutorial will demonstrate how to buffer the characters() events, if you don't feel like reinventing the solution yourself. -- http://mail.python.org/mailman/listinfo/python-list

Re: testing array of logicals

2006-07-13 Thread Bruno Desthuilliers
Simon Brunning a écrit : > On 13 Jul 2006 05:45:21 -0700, John Henry <[EMAIL PROTECTED]> wrote: > >> >> Simon Brunning wrote: >> > >> > min(logflags) >> > >> >> !!! > > > Be aware that not only is this an outrageous misuse of min(), +1 QOTW Ho, my, I've already proposed another one today :( --

Re: Chunking sequential values in a list

2006-07-13 Thread Gerard Flanagan
David Hirschfield wrote: > I have this function: > > def sequentialChunks(l, stride=1): > chunks = [] > chunk = [] > for i,v in enumerate(l[:-1]): > v2 = l[i+1] > if v2-v == stride: > if not chunk: > chunk.append(v) > chunk.append

wxPython Grid Cell change question

2006-07-13 Thread Kiran
Hello All, I created a grid, where I register events every time the user changes an existing value inside the grid control. Right now, I am using the event: EVT_GRID_CELL_CHANGE. However, I realized that I need to register that same kind of event even if the user doesnt change the value, but just

Re: Chunking sequential values in a list

2006-07-13 Thread bearophileHUGS
It looks like homework. Sometimes the simpler code is better: def splitter(seq): if not seq: return [] result = [] current = [seq[0]] for pos, el in enumerate(seq[1:]): if el - current[-1] > 1: result.append(current[:]) current = [] c

Re: help in xml and python

2006-07-13 Thread Paul Boddie
Fredrik Lundh wrote: > > not very long ago, "Kepioo" wrote: [...] > which looks rather similar to your post, don't you think? Are you calling "homework assignment", Fredrik? ;-) Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python strings outside the 128 range

2006-07-13 Thread Gerhard Fiedler
On 2006-07-13 12:04:58, Richard Brodie wrote: >> s = "é" >> print s >> Is there a standard way to do this? > > Use Unicode strings, with an explicit encoding. Say no to ISO-8859-1 > centrism. > See: http://www.amk.ca/python/howto/unicode particularly the > "Unicode Literals in Python Source

Re: BaseHTTPRequestHandler: how to read/write until diconnected

2006-07-13 Thread notanotheridiot
Maksim Kasimov wrote: > I'm trying to write an server-application, using > BaseHTTPServer/BaseHTTPRequestHandler. > > When application is running, some client-application can post data to the > server, and BaseHTTPRequestHandler reads all headers and posted raw data from > "rfile", sends back r

Re: What is a type error?

2006-07-13 Thread Marshall
Joe Marshall wrote: > Marshall wrote: > > > > Again, I disagree: it is posible to have mutability without > > pointers/identity/objects. > > I think you are wrong, but before I make a complete ass out of myself, > I have to ask what you mean by `mutability'. (And > pointers/identity/objects, for t

Re: What is a type error?

2006-07-13 Thread David Hopwood
Chris Smith wrote: > Joachim Durchholz <[EMAIL PROTECTED]> wrote: > >>OTOH, isn't that the grail that many people have been searching for: >>programming by simply declaring the results that they want to see? > > Possibly. > >>No, FPLs are actually just that: compilable postconditions. > > This

Re: stderr, stdout, and errno 24

2006-07-13 Thread alisonken1
Wesley Henwood wrote: > I've checked and double checked my code and I am closing all files > explicitly after opening them. The only possibliy I can think of is > Python opening files each time I run a script, or each time imput to > stderr or stdout is redirected. > The problem >I think< is th

Re: Better utilization of duo-core?

2006-07-13 Thread Fredrik Lundh
Fredrik Lundh wrote: >> How do I detect whether I have additional CPUs in the system? The >> google search turns up answer about a Sun workstation but not Windows >> XP. > > count = int(os.environ.get("NUMBER_OF_PROCESSORS", 1)) footnote: a more "correct" way to do this is to use WMI. links:

Re: help in xml and python

2006-07-13 Thread Fredrik Lundh
John Draper wrote: > I remember a few years ago, I posted something like this to the list, > and got flamed 6 ways from Sunday for having the audacity to propose > this. certain people think that the mere thought of getting paid for contributing to freely available software is outrageously immor

Re: What is a type error?

2006-07-13 Thread Marshall
Joachim Durchholz wrote: > Marshall schrieb: > > Mutability by itself does not imply identity. > > Well, the implication certainly holds from identity to mutability. > The only definition of identity that I found to hold up for all kinds of > references (pointers, shared-memory identifiers, URLs et

Re: WMI Help

2006-07-13 Thread Tim Golden
3c273 wrote: > Hello, > When I run the following at an interactive interpreter on Windows XP, I get > the expected results. But if I save it to a file and run it, it generates > the following error. (And it generates the same error either way on Windows > 2000) > > import wmi > c=wmi.WMI() > for i

Re: What is a type error?

2006-07-13 Thread David Hopwood
Marshall wrote: > David Hopwood wrote: >>Marshall wrote: >> >>>Wouldn't it be possible to do them at compile time? (Although >>>this raises decidability issues.) >> >>It is certainly possible to prove statically that some assertions cannot fail. >> >>The ESC/Java 2 (http://secure.ucd.ie/products/op

Chunking sequential values in a list

2006-07-13 Thread David Hirschfield
I have this function: def sequentialChunks(l, stride=1): chunks = [] chunk = [] for i,v in enumerate(l[:-1]): v2 = l[i+1] if v2-v == stride: if not chunk: chunk.append(v) chunk.append(v2) else: if not chunk:

Re: Byte array question

2006-07-13 Thread Dan Winsor
Sybren Stuvel wrote: > [EMAIL PROTECTED] enlightened us with: > > I want to send thorugh the API. However, no matter how I try it, > > Java on the other end doesn't like what I'm passing it there. > > What have you tried and how did it fail? See below. > > How can I mimic a byte array in python?

Re: help in xml and python

2006-07-13 Thread John Draper
Diez B. Roggisch wrote: >>can someone please with the code for this. >> >> > >Show us your efforts, and we'd be glad to help you correcting/enhancing >them. > >Or use PayPal and pay one of the guys here - my hourly fee is 50€, and >less than one hour work can't be booked. > >Diez > > I rem

Tix Tree open/close issue

2006-07-13 Thread Sorin Schwimmer
Hi, I tried for the first time a Tix Tree, so, if my question is naive, I apologize upfront. The following code: from Tix import * r=Tk() tr=Tree(r) tr.subwidget('hlist').add('br1',text='branch 1') tr.subwidget('hlist').add('br1.b1',text='branch 1-1') tr.subwidget('hlist').add('br1.b1.b1',text

Line by line execution of python code

2006-07-13 Thread Justin Powell
Hi, I'm looking for suggestions on how to accomplish something in python. If this is the wrong list for such things, I appologize and please disregard the rest. My application needs to allow users to create scripts which will be executed in a statement-by-statement fashion. Here's a little pseud

Re: RedHat: Easiest way to upgrade from Python 2.3 to 2.4

2006-07-13 Thread Stefan Behnel
gmax2006 wrote: > My RedHat Linux installation already has Python 2.3 on it. > What is the easiest way to upgrade it to 2.4? The source tar-ball contains an file Misc/RPM/python-XXX.spec that you can use to build an RPM ("rpmbuild -bs" or "rpm -bs"). The resulting package will normally be called "

Re: Determining if an object is a class?

2006-07-13 Thread Clay Culver
Dino Viehland wrote: > The first check is also off - it should if issubclass(type(Test), type): > otherwise you miss the metaclass case: > > class foo(type): pass > > class Test(object): > __metaclass__ = foo > > obj = Test > if type(obj) == type: 'class obj' > else: 'not a class' > > just on

Re: What is a type error?

2006-07-13 Thread Joe Marshall
Marshall wrote: > > Again, I disagree: it is posible to have mutability without > pointers/identity/objects. I think you are wrong, but before I make a complete ass out of myself, I have to ask what you mean by `mutability'. (And pointers/identity/objects, for that matter.) Alan Bawden discusse

Re: RedHat: Easiest way to upgrade from Python 2.3 to 2.4

2006-07-13 Thread gmax2006
Fredrik Lundh wrote: > DO NOT do a full install; you'll most likely break RedHat stuff if you > do that. I was expecting an rpm to do the update. This is a sensitive production box. I think I should just continue with Python 2.3. Regards, -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a type error?

2006-07-13 Thread Darren New
Chris Smith wrote: > Unless I'm missing your point, I disagree with your disagreement. > Mutability only makes sense because of object identity (in the generic > sense; no OO going on here). Depends what you mean by "object". int x = 6; int y = 5; x = y; I'd say x was mutable, with no "ident

Re: Better utilization of duo-core?

2006-07-13 Thread Fredrik Lundh
John Henry wrote: > How do I detect whether I have additional CPUs in the system? The > google search turns up answer about a Sun workstation but not Windows > XP. count = int(os.environ.get("NUMBER_OF_PROCESSORS", 1)) -- http://mail.python.org/mailman/listinfo/python-list

Byte array question

2006-07-13 Thread dan . winsor
Hi all, I'm trying to write through SOAPpy in python to a Java implemented API. The API for the method I want to use is as follows: boolean added = SoapService.addAttachmentsToIssue(token, issue.getKey(), new String[]{fileName}, new byte[][]{getBytesF

Re: WMI Help

2006-07-13 Thread 3c273
"Michel Claveau" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Re! > > This script run on my XP : > > > import win32com.client > WMIS = win32com.client.GetObject(r"winmgmts:root\cimv2") > objs = WMIS.ExecQuery("select * from Win32_PhysicalMedia") > for obj in objs: > print obj.S

Better utilization of duo-core?

2006-07-13 Thread John Henry
Hi list, I have a Python ap that starts another non-Pythoon ap for number crunching. My new notebook comes with a duo-core CPU. I tried manually running 2 copies of my ap at the same time) and it appears to run the whole job faster (or at least the CPU loading level as show by the task manager a

Re: How to have application-wide global objects

2006-07-13 Thread Fredrik Lundh
Jeremy Sanders wrote: >> "import" doesn't create new objects, so that's not very likely. can you >> post some code so we don't have to guess what you've tried and not ? > > It does if you mess around with sys.path between doing two imports of the > same thing (at least I found out the hard way o

Re: running python from a memory stick?

2006-07-13 Thread Jonathan Harris
John Salerno wrote: > Is there a way to 'install' and use Python on a memory stick ... > and then just write and run scripts normally straight from > your memory stick? Do you actually want a full python environment? Or do you just want an easy way to run your scripts on another machine? If the

Re: RedHat: Easiest way to upgrade from Python 2.3 to 2.4

2006-07-13 Thread Fredrik Lundh
gmax2006 wrote: > My RedHat Linux installation already has Python 2.3 on it. > What is the easiest way to upgrade it to 2.4? grab the source tarball from python.org, built it according to instructions (./configure; make), and install using: # make altinstall DO NOT do a full install; you'

Re: How to have application-wide global objects

2006-07-13 Thread Jeremy Sanders
Fredrik Lundh wrote: > "Sanjay" wrote: > >> Trying hard, I am not even being able to figure out how to create an >> object in one module and refer the same in another one. "import" >> created a new object, as I tried. > > "import" doesn't create new objects, so that's not very likely. can you >

Re: Multiplatform scripts: Can I avoid os.sep?

2006-07-13 Thread Fredrik Lundh
gmax2006 wrote: > I am developing scripts that must run on both Linux and windows. > > My scripts contain lots of relative paths (such as log\\log.txt or > ctl\\table.ctl) If I use os.sep, it makes the code ugly. Is there any > tips or techniques to have Python automatically converts \\ to / when

RedHat: Easiest way to upgrade from Python 2.3 to 2.4

2006-07-13 Thread gmax2006
Hi, My RedHat Linux installation already has Python 2.3 on it. What is the easiest way to upgrade it to 2.4? I use ActiveState python in Windows. Is it the best distribution for Linux as well? Thank you, Max -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a type error?

2006-07-13 Thread Chris Smith
Marshall <[EMAIL PROTECTED]> wrote: > Hmmm, well, I cannot agree. You've defined away the pointers > but then slipped them back in again by assumption ("objects > of these types have identity".) > > First let me say that the terminology is somewhat problematic. > For the specific issue being discu

Re: What is a type error?

2006-07-13 Thread Joachim Durchholz
Marshall schrieb: > Mutability by itself does not imply identity. Well, the implication certainly holds from identity to mutability. The only definition of identity that I found to hold up for all kinds of references (pointers, shared-memory identifiers, URLs etc.) is this: Two pieces of data ar

Re: Multiplatform scripts: Can I avoid os.sep?

2006-07-13 Thread Bruno Desthuilliers
Mike Kent wrote: (snip - about Jason Orendorff's path module) > Of course, using the '/' operator in this manner makes some people's > heads explode. +1 QOTW -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" --

Re: Multiplatform scripts: Can I avoid os.sep?

2006-07-13 Thread Mike Kent
gmax2006 wrote: > Hi, > > I am developing scripts that must run on both Linux and windows. > > My scripts contain lots of relative paths (such as log\\log.txt or > ctl\\table.ctl) If I use os.sep, it makes the code ugly. Is there any > tips or techniques to have Python automatically converts \\ to

Re: Multiplatform scripts: Can I avoid os.sep?

2006-07-13 Thread Bruno Desthuilliers
gmax2006 wrote: > Hi, > > I am developing scripts that must run on both Linux and windows. > > My scripts contain lots of relative paths (such as log\\log.txt or > ctl\\table.ctl) If I use os.sep, it makes the code ugly. Is there any > tips or techniques to have Python automatically converts \\ t

stdout/stderr for only one thread in a multithreaded python app

2006-07-13 Thread notanotheridiot
Hi- I'm trying to exec some arbitrary code in one thread of an application and read anything it prints to stdout or stderr in another thread. My question is how? I've tried changing sys.stdout, but that changes stdout for the whole application, not just that one thread, which means that any statu

Re: How to convert arbitrary objects directly to base64 without initial string conversion?

2006-07-13 Thread Stefan Behnel
Russell Warren wrote: > How can you tell what objects support the buffer interface? Is > anything visible at the python level, or do you need to dig into the C > source? At the C level, there is a function for testing: int PyObject_CheckReadBuffer(PyObject* o) http://docs.python.org/dev/api/abs

Re: Determining if an object is a class?

2006-07-13 Thread Fredrik Lundh
placid wrote: > Why is there old and new classes? What are the differences? the "what's new" document for the release where they were introduced (2.2) contains a nice overview, written from a "before and after" perspective: http://www.python.org/doc/2.2.3/whatsnew/sect-rellinks.html (how

Multiplatform scripts: Can I avoid os.sep?

2006-07-13 Thread gmax2006
Hi, I am developing scripts that must run on both Linux and windows. My scripts contain lots of relative paths (such as log\\log.txt or ctl\\table.ctl) If I use os.sep, it makes the code ugly. Is there any tips or techniques to have Python automatically converts \\ to / when the script runs on Li

Re: What is a type error?

2006-07-13 Thread Chris Smith
Joachim Durchholz <[EMAIL PROTECTED]> wrote: > OTOH, isn't that the grail that many people have been searching for: > programming by simply declaring the results that they want to see? Possibly. > No, FPLs are actually just that: compilable postconditions. This seems to me a bit misleading. Pe

  1   2   3   >