Re: Accessors in Python (getters and setters)

2006-07-13 Thread Roel Schroeven
mystilleef schreef: > Ant wrote: >> We seem to be flogging a dead horse now. Is the following a fair >> summary: >> >> Q. What is the Pythonic way of implementing getters and setters? >> >> A. Use attributes. >> >> Quote: "I put a lot more effort into choosing method and function >> names" >> >> Wi

Re: running python from a memory stick?

2006-07-13 Thread Daniel Dittmar
John Salerno wrote: > Is there a way to 'install' and use Python on a memory stick, just as > you would on any computer? I use Windows, and I know the installation > does things with the registry, so probably I couldn't use the executable > file to install it. But is it possible to do it some ot

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

2006-07-13 Thread Russell Warren
I've got a case where I want to convert binary blocks of data (various ctypes objects) to base64 strings. The conversion calls in the base64 module expect strings as input, so right now I'm converting the binary blocks to strings first, then converting the resulting string to base64. This seems h

Re: Data access from multiple code modules

2006-07-13 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Bruno Desthuilliers wrote: > > >>Separating operations on data (model/controler) from GUI code (view). >>The controler(s) have a reference on the model. The views have a >>reference on the controler(s), and call on the controller to get data to >>display or act on data.

Re: bay area based - python guru..

2006-07-13 Thread Stefan Behnel
Simon Brunning wrote: > On 7/13/06, Stefan Behnel <[EMAIL PROTECTED]> wrote: >> Maybe the right thing to ask back is: how much do you pay? > > And possibly; *which* bay? ;-) What do you mean? Is there more than one Bayern? http://en.wikipedia.org/wiki/Bayern Stefan -- http://mail.python.org/ma

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Bruno Desthuilliers
mystilleef wrote: > Bruno Desthuilliers wrote: > You choose a bad name for a *public* symbol. >>> >>> >>>My point exactly! It doesn't solve my problem! >> >>What do you hope ? Something that cures cancer ? Please enlighten us and >>explain how explicit getters/setters would have solved the pro

Re: Advice for Python Reporting Tool

2006-07-13 Thread rwboley
Mike Kent wrote: > rwboley wrote: > > > My question is: how can I make that graphing step easier? Ideally I'd > > like the chart to exist on it's own page, but I have no idea where to > > even begin to implement this. Any thoughts would be appreciated. > > I've seen several people recommend matpl

Re: Python strings outside the 128 range

2006-07-13 Thread Fredrik Lundh
Gerhard Fiedler wrote: > If I understand you correctly, you are saying that if I distribute a file > with the following lines: > > s = "é" > print s > > I basically need to distribute also the information how the file is encoded > and every user needs to use the same (or a compatible) encoding

Re: running python from a memory stick?

2006-07-13 Thread Magnus Lycka
John Salerno wrote: > Is there a way to 'install' and use Python on a memory stick, just as > you would on any computer? I use Windows, and I know the installation > does things with the registry, so probably I couldn't use the executable > file to install it. But is it possible to do it some ot

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Bruno Desthuilliers
mystilleef wrote: > Ant wrote: > >>We seem to be flogging a dead horse now. Is the following a fair >>summary: >> >>Q. What is the Pythonic way of implementing getters and setters? >> >>A. Use attributes. >> >>Quote: "I put a lot more effort into choosing method and function >>names" >> >>Wisdom:

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

2006-07-13 Thread Thomas Heller
Russell Warren schrieb: > I've got a case where I want to convert binary blocks of data (various > ctypes objects) to base64 strings. > > The conversion calls in the base64 module expect strings as input, so > right now I'm converting the binary blocks to strings first, then > converting the resul

Re: Python strings outside the 128 range

2006-07-13 Thread Richard Brodie
"Gerhard Fiedler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If I understand you correctly, you are saying that if I distribute a file > with the following lines: > > s = "é" > print s > > I basically need to distribute also the information how the file is encoded > and ever

Re: What is a type error?

2006-07-13 Thread Marshall
Andreas Rossberg wrote: > Marshall wrote: > > > > Okay, sure. But for the problem you describe, both imperativeness > > and the presence of pointers is each necessary but not sufficient; > > it is the two together that causes the problem. So it strikes > > me (again, a very minor point) as inaccura

Re: How to have application-wide global objects

2006-07-13 Thread Bruno Desthuilliers
Sanjay wrote: > Probably a newcomer question, but I could not find a solution. > > I am trying to have some singleton global objects like "database > connection" or "session" shared application wide. Whenever possible, dont. If you really have no other way out, create the 'singleton' in it's modu

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Alex Martelli
Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-13 01:50:18, Alex Martelli wrote: > > >> I'm not sure about which languages you are talking (pretty much all that > >> allow public methods also allow public attributes), [...] > > > > Smalltalk is a very well known object-oriented language

Tix.Grid patch

2006-07-13 Thread klappnase
Hi all, I just wrote a wrapper for the Tix.Grid widget (http://www.8ung.at/klappnase/TixGrid/TixGrid.html); I guess I should have searched before, because now I found this has already been done for Python2.5 . However it looks like my version offers some more functionality (and the ScrolledGrid in

Re: How to have application-wide global objects

2006-07-13 Thread Fredrik Lundh
"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 post some code so we don't have to

Re: running python from a memory stick?

2006-07-13 Thread John Salerno
Fredrik Lundh wrote: > windows doesn't care about the #! line, so you'd have to run the > scripts as e.g. > > e:\py24\python.exe myscript.py > >> Is this what exemaker takes care of? > > exemaker simply maps > > foobar.exe > > to > > python.exe foobar.py > > and uses the #! line

Re: Tix.Grid patch

2006-07-13 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I just wrote a wrapper for the Tix.Grid widget > (http://www.8ung.at/klappnase/TixGrid/TixGrid.html); I guess I should > have searched before, because now I found this has already been done > for Python2.5 . However it looks like my version offers some more > functionali

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

2006-07-13 Thread Russell Warren
> Many functions that operate on strings also accept buffer objects as > parameters, > this seems also be the case for the base64.encodestring function. ctypes > objects > support the buffer interface. > > So, base64.b64encode(buffer(ctypes_instance)) should work efficiently. Thanks! I have ne

Re: What is a type error?

2006-07-13 Thread Marshall
Joachim Durchholz wrote: > Marshall schrieb: > > Joachim Durchholz wrote: > >> Marshall schrieb: > >>> Joachim Durchholz wrote: > Marshall schrieb: > > I can see the lack of a formal model being an issue, but is the > > imperative bit really all that much of an obstacle? How hard > >>>

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Bruno Desthuilliers
mystilleef wrote: (snip) > > Okay, I feel I need to make myself clear. I certainly I'm not blaming > Python for my mistakes. And I don't think language X is better than > Python or vice-versa. Okay scrap the vice-versa. It was silly of me to > name the variable tmp regardless of whatever excuses I

Re: Accessors in Python (getters and setters)

2006-07-13 Thread Carl Banks
mystilleef wrote: > Fredrik Lundh wrote: > > "mystilleef" wrote: > > > > > Pretending to be intelligent does, however. > > > > so the real reason you've written a few hundred posts saying basically "I > > pick > > bad names, which proves... uh... whatever" is to impress people by > > pretending

Re: How to have application-wide global objects

2006-07-13 Thread Sanjay
Hi Bruno, Thanks a lot for the reply. In order to post here, I wrote a very simple program now, and it seems working! I can diagnose the original problem now. There might be some other problem. Pardon me if I am too novice but I could not make out the meaning of this phrase from your reply: "(at

Re: What is a type error?

2006-07-13 Thread Andreas Rossberg
Marshall wrote: > > However if the mutable types are not first class, then there > is no way to have the aliasing. Thus, if we do not have pointers > or objects or identity but retain mutability, there is no aliasing > problem. Yes, technically you are right. But this makes a pretty weak notion o

Re: How to have application-wide global objects

2006-07-13 Thread zarrg
Sanjay wrote: > Probably a newcomer question, but I could not find a solution. > > I am trying to have some singleton global objects like "database > connection" or "session" shared application wide. > > Trying hard, I am not even being able to figure out how to create an > object in one module and

[Way off-topic] Re: What is a type error?

2006-07-13 Thread David Hopwood
Joachim Durchholz wrote: > A concrete example: the > first thing that Windows does when accepting userland data structures > is... to copy them; this were unnecessary if the structures were immutable. It is necessary also because the userland structures are in a different privilege domain, and the

Re: running python from a memory stick?

2006-07-13 Thread Thorsten Kampe
* John Salerno (2006-07-13 14:54 +) > Is there a way to 'install' and use Python on a memory stick, just as > you would on any computer? I use Windows, and I know the installation > does things with the registry, so probably I couldn't use the executable > file to install it. But is it possi

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

2006-07-13 Thread Russell Warren
After some digging around it appears there is not a tonne of documentation on buffer objects, although they are clearly core and ancient... been sifting through some hits circa 1999, long before my python introduction. What I can find says that buffer is deprecated (Python in a Nutshell), or non-e

WMI Help

2006-07-13 Thread 3c273
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 item in c.win32_PhysicalMedia():

BaseHTTPRequestHandler: how to read/write until diconnected

2006-07-13 Thread Maksim Kasimov
Hi, 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 response, than client/server

Re: How to have application-wide global objects

2006-07-13 Thread Bruno Desthuilliers
Sanjay wrote: > Hi Bruno, > > Thanks a lot for the reply. In order to post here, I wrote a very > simple program now, and it seems working! I can diagnose the original > problem now. Fine. > There might be some other problem. This, we can't tell, since you didn't post the code !-) > Pardon me

Re: WMI Help

2006-07-13 Thread Michel Claveau
Hi! Win32_PhysicalMedia WMI class is available only on Windows 2003 or XP Then, swap Admin <=> Normal_user -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie

2006-07-13 Thread Stéphane ROCHOY
Gueorgui Vaskes wrote: > Could anyone feel me in what do you mostly use python for? > > > > ___ > The all-new Yahoo! Mail goes wherever you go - free your email address from > your Internet provider. http://uk.docs.yahoo.com

Re: Determining if an object is a class?

2006-07-13 Thread Michael Spencer
Michele Simionato wrote: > [EMAIL PROTECTED] wrote: >> I need to find out if an object is a class. >> Which is quite simply awful...does anyone know of a better way to do >> this? > > inspect.isclass > > M.S. > ...which made me wonder what this canonical test is. The answer: def isclass(o

Re: WMI Help

2006-07-13 Thread Michel Claveau
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.SerialNumber print obj.Tag print -- @-salutations Michel Claveau -- http://mail.p

Re: Find and Delete all files with .xxx extension

2006-07-13 Thread Fredrik Lundh
John McMonagle wrote: >> Find and Delete all files with .xxx extension >> >> Please do so. > > How ? In the current directory/folder ? Recursively search through all > the directories/folders from a certain path ? on *your* machine, of course. -- http://mail.python.org/mailman/listinfo/p

Re: What is a type error?

2006-07-13 Thread Darren New
Andreas Rossberg wrote: > Yes, technically you are right. But this makes a pretty weak notion of > mutability. All stateful data structures had to stay within their > lexical scope, and could never be passed to a function. Not really. The way Hermes handles this is with destructive assignment.

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

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: 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

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

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: 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

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
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: 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: 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

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: 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

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: 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: 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: 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

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: 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

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: 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

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: 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 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: 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: 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 "

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

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

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

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?

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: 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

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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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 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

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: 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: 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: 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: 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

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: 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

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 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

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: 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

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: 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

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: 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: 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: 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: 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. > >

<    1   2   3   >