Re: Personal criticisms and logical fallacies

2010-02-09 Thread Alf P. Steinbach
* Ben Finney: "D'Arcy J.M. Cain" writes: On Wed, 10 Feb 2010 01:38:50 +0100 "Alf P. Steinbach" wrote: However, although in this particular case the Ad Hominems constituted logical fallacies, not all Ad Hominems are logical fallacies. Yes they are. Using the reputation of someone to prove o

Re: Modifying Class Object

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 1:08 PM, Alf P. Steinbach wrote: [abundant snips which do not accurately represent who said what where due to my own laziness] > Not sure, but perhaps it's possible to mail directly to gmane? > > Is there *any* problem you don't have a fatuous answer for? >>>

Re: Personal criticisms and logical fallacies

2010-02-09 Thread Steven Howe
Really, is this a relevant topic on a program mail list? You guys need to get a room and start discussing angel counts on pinheads under the blankets. sph On 02/09/2010 10:51 PM, D'Arcy J.M. Cain wrote: On Wed, 10 Feb 2010 01:38:50 +0100 "Alf P. Steinbach" wrote: However, although in th

Re: Personal criticisms and logical fallacies

2010-02-09 Thread D'Arcy J.M. Cain
On Wed, 10 Feb 2010 01:38:50 +0100 "Alf P. Steinbach" wrote: > However, although in this particular case the Ad Hominems constituted logical > fallacies, not all Ad Hominems are logical fallacies. Yes they are. Using the reputation of someone to prove or disprove their claims is a logical falla

Re: New to Python

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 7:30 PM, Quin wrote: > Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to > PyScripter and will test tomorrow. > The chance of this being the case is vanishingly small. Provide real code, copy-pasted directly from a real file, and showing real res

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Paul McGuire
On Feb 9, 10:10 am, Grant Edwards wrote: > Is there another way to measure small periods of elapsed time > (say in the 1-10ms range)? > On Feb 9, 10:10 am, Grant Edwards wrote: > Is there another way to measure small periods of elapsed time > (say in the 1-10ms range)? > I made repeated calls to

Re: Creating formatted output using picture strings

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 8:45 PM, wrote: > Does Python provide a way to format a string according to a 'picture' > format? > > For example, if I have a string '123456789' and want it formatted like > '(123)-45-(678)[9]', is there a module or function that will allow me to do > this or do I need to

Creating formatted output using picture strings

2010-02-09 Thread python
Does Python provide a way to format a string according to a 'picture' format? For example, if I have a string '123456789' and want it formatted like '(123)-45-(678)[9]', is there a module or function that will allow me to do this or do I need to code this type of transformation myself? Thank you,

Re: "if {negative}" vs. "if {positive}" style

2010-02-09 Thread Alf P. Steinbach
* Tim Chase: Larry Hudson wrote: But a minor rearrangement is simpler, and IMHO clearer: if 'mystring' not in s: print 'not found' else: print 'foundit' print 'processing' I've always vacillated on whether that would better be written as Larry does, or as if 'mystring' in

Re: "if {negative}" vs. "if {positive}" style (was: New to Python)

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 7:58 PM, Daniel Stutzbach < dan...@stutzbachenterprises.com> wrote: > On Tue, Feb 9, 2010 at 9:36 PM, Tim Chase > wrote: > >> removing the "not" from the condition. I admit I choose one over the >> other based on some gut-feeling aesthetic that I can't really nail down. I

Re: New to Python

2010-02-09 Thread Steve Holden
Quin wrote: > Thanks guys, I'm thinking it's a problem with IronPython. I'm switching > to PyScripter and will test tomorrow. > I'd be very surprised to find that something as basic as this was wrong with IronPython. Complex commercial software has been built on it, so there's little question tha

Re: "if {negative}" vs. "if {positive}" style (was: New to Python)

2010-02-09 Thread Daniel Stutzbach
On Tue, Feb 9, 2010 at 9:36 PM, Tim Chase wrote: > removing the "not" from the condition. I admit I choose one over the other > based on some gut-feeling aesthetic that I can't really nail down. I think > one of my major influencing factors revolves around the negative "not" > portion having one

Re: "if {negative}" vs. "if {positive}" style (was: New to Python)

2010-02-09 Thread Cameron Simpson
On 09Feb2010 21:36, Tim Chase wrote: | Larry Hudson wrote: | >But a minor rearrangement is simpler, and IMHO clearer: | > | >if 'mystring' not in s: | > print 'not found' | >else: | > print 'foundit' | > print 'processing' | | I've always vacillated on whether that would better be wri

Re: "if {negative}" vs. "if {positive}" style (was: New to Python)

2010-02-09 Thread Tim Chase
Larry Hudson wrote: But a minor rearrangement is simpler, and IMHO clearer: if 'mystring' not in s: print 'not found' else: print 'foundit' print 'processing' I've always vacillated on whether that would better be written as Larry does, or as if 'mystring' in s print 'f

Re: New to Python

2010-02-09 Thread Quin
Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to PyScripter and will test tomorrow. "Larry Hudson" wrote in message news:ybmdnrfzz_3nvu_wnz2dnuvz_hgdn...@giganews.com... Quin wrote: s = f.readline() if 'mystring' in s: print 'foundit' if 'mystring' not in s: print

Re: New to Python

2010-02-09 Thread Larry Hudson
Quin wrote: s = f.readline() if 'mystring' in s: print 'foundit' if 'mystring' not in s: print 'not found' if 'mystring' in s: print 'processing' this generates output: not found processing so, it doesn't find the substring, but goes into processing code anyway. This is using IronPython A

Re: convention for documenting function parameters in doc strings

2010-02-09 Thread danielx
On Feb 8, 2:49 am, Jean-Michel Pichavant wrote: > danielx wrote: > > Is there aconventionfor how to document function (or method) > > parameters in doc strings? Recently, I've been doing alot of PHP > > programming, and in PHPdoc, you'd do it like this: > > > /* > >  * @param type $foo Description

Re: Programing family

2010-02-09 Thread Terry Reedy
C is Python's Mom C++ : Dad Obviously no. The other parent might be arguably be Barbara Liskov's CLU, itself based on Algol. http://en.wikipedia.org/wiki/CLU_%28programming_language%29 CLU contributions: The basic object model, including mutable/immutable The function call-by-object mode

Re: ANN: obfuscate

2010-02-09 Thread Steven D'Aprano
On Wed, 10 Feb 2010 02:03:47 +0100, Christian Heimes wrote: > Stef Mientki wrote: >> sorry I don't, >> unless Python is only meant for the very well educated people in >> encryption. > > All algorithms in obfuscate are obsolete, insecure and only interesting > for people *that* want to get well e

Re: ANN: obfuscate

2010-02-09 Thread Ben Finney
Christian Heimes writes: > All algorithms in obfuscate are obsolete, insecure and only > interesting for people *that* want to get well educated in the history > of encryption. Not true. Another use case is suggested by the chosen name for the library: to obfuscate text against casual human read

Re: ANN: obfuscate

2010-02-09 Thread Christian Heimes
Stef Mientki wrote: > sorry I don't, > unless Python is only meant for the very well educated people in encryption. All algorithms in obfuscate are obsolete, insecure and only interesting for people *that* want to get well educated in the history of encryption. > I neither did look at the code, >

Re: Personal criticisms and logical fallacies

2010-02-09 Thread Alf P. Steinbach
* Ben Finney: Steven D'Aprano writes: An ad hominem attack is not when somebody makes a criticism of you personally. It is when somebody says something along the lines of "Don't pay any attention to Alf, he doesn't know what he's talking about, he's a ". In other words, a criticism of the pe

Re: Modifying Class Object

2010-02-09 Thread Gabriel Genellina
En Tue, 09 Feb 2010 21:06:02 -0300, Alf P. Steinbach escribió: * Steven D'Aprano: On Tue, 09 Feb 2010 21:04:08 +0100, Alf P. Steinbach wrote: You thought you cold do a bit of ad hominem attack. That phrase you keep using, "ad hominem"... it doesn't mean what you seem to think it means.

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Sean DiZazzo
On Feb 8, 2:36 pm, a...@pythoncraft.com (Aahz) wrote: > In article > , > Sean DiZazzo   wrote: > > >On Feb 3, 6:08=A0pm, alex23 wrote: > > >> There was also a PEP with another possible implementation: > >>http://www.python.org/dev/peps/pep-0355/ > > >Why did Path() get rejected?  Is it the idea i

Re: ANN: obfuscate

2010-02-09 Thread Gabriel Genellina
En Tue, 09 Feb 2010 20:27:13 -0300, Stef Mientki escribió: On 10-02-2010 00:09, Alf P. Steinbach wrote: * David Robinow: On Tue, Feb 9, 2010 at 5:10 PM, Simon Brunning wrote: On 9 February 2010 16:29, Robert Kern wrote: On 2010-02-09 09:37 AM, Daniel Fetchinson wrote: If the code base s

Re: I've built Python, but can't figure out how to package it for windows

2010-02-09 Thread Mark Jones
That was so simple, thanks. I scanned all the folders for inst, install, setup, but since msi was the expected output extension, I didn't see that! On Feb 9, 6:14 pm, "Gabriel Genellina" wrote: > En Tue, 09 Feb 2010 19:55:30 -0300, Mark Jones   > escribió: > > > Python 2.6.4 is built, and I fou

Personal criticisms and logical fallacies (was: Modifying Class Object)

2010-02-09 Thread Ben Finney
Steven D'Aprano writes: > An ad hominem attack is not when somebody makes a criticism of you > personally. It is when somebody says something along the lines of > "Don't pay any attention to Alf, he doesn't know what he's talking > about, he's a ". In other words, a criticism of the person is on

PyCon is coming! Tomorrow, Feb. 10 is the last day for pre-conference rates

2010-02-09 Thread VanL
PyCon is coming! Tomorrow (February 10th) is the last day for pre-conference rates. You can register for PyCon online at: Register while it is still Feb. 10th somewhere in the world and rest easy in the knowledge that within 10 days you will enjoying the comp

Re: Problem Regarding Queue

2010-02-09 Thread Rob Williscroft
mukesh tiwari wrote in news:80fed7d5-76eb-40c8-ace1-0c35736de399 @t17g2000prg.googlegroups.com in comp.lang.python: > Could some one please tell what is wrong with this code. I am trying > to use Queue in this program but i am getting error The type you appear to be trying to use is Queue.Queue w

Re: I've built Python, but can't figure out how to package it for windows

2010-02-09 Thread Gabriel Genellina
En Tue, 09 Feb 2010 19:55:30 -0300, Mark Jones escribió: Python 2.6.4 is built, and I found a bdist_wininst project and wininst-8 project. How do I manage to build the msi for this thing? See the Tools\msi directory; and look for some posts last year from Tim Golden regarding some issues

Re: Modifying Class Object

2010-02-09 Thread Alf P. Steinbach
* Steven D'Aprano: On Tue, 09 Feb 2010 21:04:08 +0100, Alf P. Steinbach wrote: You thought you cold do a bit of ad hominem attack. That phrase you keep using, "ad hominem"... it doesn't mean what you seem to think it means. An ad hominem attack is not when somebody makes a criticism of you

Re: ANN: obfuscate

2010-02-09 Thread rantingrick
On Feb 9, 7:21 am, Roy Smith wrote: > In article <00fa27a3$0$15628$c3e8...@news.astraweb.com>, >  Steven D'Aprano wrote: [..] > No pig latin? Wait a minute guys, Stevens a well known prankster and comic relief clown around here, I think he's just shining us all on! ;o) -- http://mail.python.o

Re: Ternary plus

2010-02-09 Thread Gabriel Genellina
En Tue, 09 Feb 2010 15:47:43 -0300, Martin Drautzburg escribió: Carl Banks wrote: You can have __add__ return a closure for the first addition, then perform the operation on the second one. Example (untested): That's way cool. Of course! - CURRYING!! If you can return closures you can

Re: New to Python

2010-02-09 Thread Jean-Michel Pichavant
Quin wrote: s = f.readline() if 'mystring' in s: print 'foundit' if 'mystring' not in s: print 'not found' if 'mystring' in s: print 'processing' this generates output: not found processing so, it doesn't find the substring, but goes into processing code anyway. This is using IronPython Th

Re: EAFP gone wrong

2010-02-09 Thread Matthew Barnett
Arnaud Delobelle wrote: Hi all, Hi have a set of classes that represent mathematical objects which can be represented as a string using a 'latex' method (after Knuth's famous typesetting system). As I want to be able to typeset some builtin types as well, I have a generic function, latex(), as

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Gabriel Genellina
En Tue, 09 Feb 2010 13:10:56 -0300, Grant Edwards escribió: What's the correct way to measure small periods of elapsed time. I've always used time.clock() in the past: However on multi-processor machines that doesn't work. Sometimes I get negative values for delta. According to google, thi

Easter Eggs

2010-02-09 Thread Alf P. Steinbach
I know 3 Python Easter Eggs, from __future__ import braces import this help( "antigravity" ) Are there more? Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying Class Object

2010-02-09 Thread Steven D'Aprano
On Tue, 09 Feb 2010 21:04:08 +0100, Alf P. Steinbach wrote: > You thought you cold do a bit of ad hominem attack. That phrase you keep using, "ad hominem"... it doesn't mean what you seem to think it means. An ad hominem attack is not when somebody makes a criticism of you personally. It is wh

Re: Programing family

2010-02-09 Thread Steven D'Aprano
On Tue, 09 Feb 2010 17:49:21 +0100, Bruno Desthuilliers wrote: > On Feb 8, 2010, at 8:39 PM, AON LAZIO wrote: >> >>> I have thought funny things >>> If we think all languages are like a family > > Then it would be a very incestuous family fore sure. > >>> I could draft them like this (Python b

Re: EAFP gone wrong

2010-02-09 Thread Malte Helmert
Ben Finney wrote: > def latex(val): > def make_result_in_the_absence_of_a_latex_method(): > result = transmogrify(val) > return result > > try: > typeset_func = val.latex > except AttributeError: > typeset_func = make_result_in_the_absence_of_a_latex_met

Re: ANN: obfuscate

2010-02-09 Thread Stef Mientki
On 10-02-2010 00:09, Alf P. Steinbach wrote: * David Robinow: On Tue, Feb 9, 2010 at 5:10 PM, Simon Brunning wrote: On 9 February 2010 16:29, Robert Kern wrote: On 2010-02-09 09:37 AM, Daniel Fetchinson wrote: If the code base stabilizes in a production version after losing the alphas and b

Re: EAFP gone wrong

2010-02-09 Thread Malte Helmert
Arnaud Delobelle wrote: > This means that EAFP made me hide a typo which would have been obviously > detected had I LBYLed, i.e. instead of > > try: > return val.latex() > except AttributeError: > ... > > do > > if hasattr(val, 'latex'): > return val.latex()

Re: EAFP gone wrong

2010-02-09 Thread Ben Finney
Arnaud Delobelle writes: > As I want to be able to typeset some builtin types as well, I have a > generic function, latex(), as follows: > > def latex(val): > try: > return val.latex() > except AttributeError: […] > It's EAFP and I have used this for a while with no problem. […]

Re: ANN: obfuscate

2010-02-09 Thread Alf P. Steinbach
* David Robinow: On Tue, Feb 9, 2010 at 5:10 PM, Simon Brunning wrote: On 9 February 2010 16:29, Robert Kern wrote: On 2010-02-09 09:37 AM, Daniel Fetchinson wrote: If the code base stabilizes in a production version after losing the alphas and betas they would be a great addition to the std

I've built Python, but can't figure out how to package it for windows

2010-02-09 Thread Mark Jones
Python 2.6.4 is built, and I found a bdist_wininst project and wininst-8 project. How do I manage to build the msi for this thing? -- http://mail.python.org/mailman/listinfo/python-list

EAFP gone wrong

2010-02-09 Thread Arnaud Delobelle
Hi all, Hi have a set of classes that represent mathematical objects which can be represented as a string using a 'latex' method (after Knuth's famous typesetting system). As I want to be able to typeset some builtin types as well, I have a generic function, latex(), as follows: def latex(val):

Re: Possible? Python 2.6.x and PythonWin on 64-bit Windows 7

2010-02-09 Thread Sridhar Ratnakumar
On 2010-02-07, at 5:02 PM, escalation746 wrote: > Andrej Mitrovic wrote: > >> Perhaps you've accidentally downloaded the wrong version of PythonWin? > > Erk, yes, my bad. > > Thanks for the quick help! Though I still wonder why the ActiveState > build does not include this. I just added suppo

Re: ANN: obfuscate

2010-02-09 Thread David Robinow
On Tue, Feb 9, 2010 at 5:10 PM, Simon Brunning wrote: > On 9 February 2010 16:29, Robert Kern wrote: >> On 2010-02-09 09:37 AM, Daniel Fetchinson wrote: >>> If the code base stabilizes in a production version after losing the >>> alphas and betas they would be a great addition to the stdlib, I >>

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Chris Rebert
On Tue, Feb 9, 2010 at 6:00 AM, Phlip wrote: > Ah, now we get down to the root of the problem. Because Python is so > stuck on the "one best way to do it" mentality, language bigotry > prevented the Committee from picking from among several equally valid > but non-best options. And after 20 years

Re: Problem Regarding Queue

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 2:06 PM, mukesh tiwari wrote: > Could some one please tell what is wrong with this code. I am trying > to use Queue in this program but i am getting error > Traceback (most recent call last): > File "/home/user/NetBeansProjects/NewPythonProject2/src/ > Pollard_rho.py", line

Re: New to Python

2010-02-09 Thread John Gordon
In <14cdnb6rubmduozwnz2dnuvz_gadn...@posted.grandecom> "Quin" writes: > s = f.readline() > if 'mystring' in s: print 'foundit' > if 'mystring' not in s: print 'not found' > if 'mystring' in s: > print 'processing' > this generates output: > not found > processing > so, it doesn't find the

Re: ANN: obfuscate

2010-02-09 Thread Simon Brunning
On 9 February 2010 16:29, Robert Kern wrote: > On 2010-02-09 09:37 AM, Daniel Fetchinson wrote: >> If the code base stabilizes in a production version after losing the >> alphas and betas they would be a great addition to the stdlib, I >> think. > > Why? I agree. Why wait? Put them in the stdlib

Problem Regarding Queue

2010-02-09 Thread mukesh tiwari
Could some one please tell what is wrong with this code. I am trying to use Queue in this program but i am getting error Traceback (most recent call last): File "/home/user/NetBeansProjects/NewPythonProject2/src/ Pollard_rho.py", line 80, in factor(n) File "/home/user/NetBeansProjects/NewP

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Grant Edwards
On 2010-02-09, Grant Edwards wrote: > On 2010-02-09, Jean-Michel Pichavant wrote: >> Grant Edwards wrote: >>> What's the correct way to measure small periods of elapsed >>> time. I've always used time.clock() in the past: >>> >>>start = time.clock() >>>[stuff being timed] >>>stop =

Re: Programing family

2010-02-09 Thread Gabriel Genellina
En Mon, 08 Feb 2010 22:39:58 -0300, AON LAZIO escribió: I have thought funny things If we think all languages are like a family I could draft them like this (Python base) Have a look at: http://oreilly.com/news/languageposter_0504.html -- Gabriel Genellina -- http://mail.python.org/mailma

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Grant Edwards
On 2010-02-09, Jean-Michel Pichavant wrote: > Grant Edwards wrote: >> What's the correct way to measure small periods of elapsed >> time. I've always used time.clock() in the past: >> >>start = time.clock() >>[stuff being timed] >>stop = time.clock() >> >>delta = stop-start >> >>

Re: PostgreSQL driver for Python applications that supports bytea correctly?

2010-02-09 Thread Jonathan Gardner
On Feb 9, 7:27 am, CyclingGuy wrote: > Can anyone recommend a PostgreSQL driver for Python that supports > selecting and inserting bytea types? > Can you name some that don't? -- http://mail.python.org/mailman/listinfo/python-list

shelve.open generates (22, 'Invalid argument') Os X 10.5 with Python 2.5

2010-02-09 Thread seth
There is something you could possibly help me with. We have a code that creates a simple Python shelve database. We are able to serialize objects and store them in the dbm file. This seem to work the same on Windows XP Python 2.5, Ubuntu 9.1 with Python 2.6, but on Os X 10.5 with Python 2.5 the da

Re: Python and Ruby

2010-02-09 Thread Jonathan Gardner
On Feb 9, 1:51 am, waku wrote: > 'stupid', 'wrong', 'deficient', 'terrible', ...  you're using strong > words instead of concrete arguments, it might intimidate your > opponents, but is hardly helpful in a fair discussion. > In today's day and age, I don't know how a text editor which cannot do s

Re: Executing Commands From Windows Service

2010-02-09 Thread David Bolen
David Bolen writes: > Not from my past experience - the system account (LocalSystem for > services) can be surprising, in that it's pretty much unlimited access > to all local resources, but severely limited in a handful of cases, > one of which is any attempt to access the network. I can't reca

Re: Python-URL! - weekly Python news and links (Feb 9)

2010-02-09 Thread Gabriel Genellina
En Tue, 09 Feb 2010 12:32:54 -0300, Marius Gedminas escribió: The last three URLs are malformed: Sorry... It happens even in the best of families :) These are the right ones: There is no module in the standard library to handle filesystem paths in an OO way - but why? http://groups.

Re: Modifying Class Object

2010-02-09 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: * Stephen Hansen: [...] I've heard that before, and have no idea why, nor any real interest in solving it: I don't want to read cpl via Usenet, and prefer to read it as a mailing list. Somewhere between Gmail->py

New to Python

2010-02-09 Thread Quin
s = f.readline() if 'mystring' in s: print 'foundit' if 'mystring' not in s: print 'not found' if 'mystring' in s: print 'processing' this generates output: not found processing so, it doesn't find the substring, but goes into processing code anyway. This is using IronPython -- http://mail.p

Re: errno 107 socket.recv issue

2010-02-09 Thread Steve Holden
Jordan Apgar wrote: > On Feb 9, 1:51 pm, Jean-Michel Pichavant [...] >> you swapped port & hostID in your call >> >> JM > > tThanks guys it's working now... feel a little stupid though. Cool! regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, F

Re: Modifying Class Object

2010-02-09 Thread Steve Holden
Alf P. Steinbach wrote: > * Steve Holden: >> Alf P. Steinbach wrote: >>> * Stephen Hansen: >> [...] I've heard that before, and have no idea why, nor any real interest in solving it: I don't want to read cpl via Usenet, and prefer to read it as a mailing list. Somewhere between Gmail

Re: Modifying Class Object

2010-02-09 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Stephen Hansen: [...] I've heard that before, and have no idea why, nor any real interest in solving it: I don't want to read cpl via Usenet, and prefer to read it as a mailing list. Somewhere between Gmail->python.org->python.org 's

Re: Modifying Class Object

2010-02-09 Thread Alf P. Steinbach
* Duncan Booth: "Alf P. Steinbach" wrote: A copyable reference is a pointer. That is, a "pointer", in e.g. the Java sense, and in the general language independent sense, means a copyable reference -- as illustrated e.g. in the Stanford computer science 101 course page I referred you

Re: To (monkey)patch or not to (monkey)patch, that is the question

2010-02-09 Thread sjdevn...@yahoo.com
On Feb 9, 3:54 am, George Sakkis wrote: > I was talking to a colleague about one rather unexpected/undesired > (though not buggy) behavior of some package we use. Although there is > an easy fix (or at least workaround) on our end without any apparent > side effect, he strongly suggested extending

Re: Ternary plus

2010-02-09 Thread Martin Drautzburg
Carl Banks wrote: > You can have __add__ return a closure for the first addition, then > perform the operation on the second one. Example (untested): > > class Closure(object): > def __init__(self,t1,t2): > self.t1 = t1 > self.t2 = t2 > def __add__(self,t3): > #

Re: Executing Commands From Windows Service

2010-02-09 Thread David Bolen
T writes: > The more testing I do, I think you may be right..I was able to get it > to work under a local admin account, and it worked under debug mode > (which would also have been running as this user). I'm a bit > surprised though - I was under the assumption that LocalSystem had > rights to

Re: Pycrypto RSA Issue

2010-02-09 Thread Jordan Apgar
On Feb 9, 1:27 pm, Legrandin wrote: > > gkey = RSA.generate(384, Random.new().read) > > string = str((gkey.publickey().__getstate__(),(333,444))) > > You are encrypting with RSA a piece of data which is way > larger than the key size (48 bytes). ah thanks Legrandin -- http://mail.python.org/mail

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
On Feb 9, 1:51 pm, Jean-Michel Pichavant wrote: > Jordan Apgar wrote: > > thanks JM, > > > at this point i switched over to this scheme and now I'm getting an > > error durring instantiation of the server: > > Server.py: > > from Crypto.PublicKey import RSA > > from ServerNegotiator import ServerN

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Grant Edwards
On 2010-02-09, Jean-Michel Pichavant wrote: > Grant Edwards wrote: >> What's the correct way to measure small periods of elapsed >> time. I've always used time.clock() in the past: >> >>start = time.clock() >>[stuff being timed] >>stop = time.clock() >> >>delta = stop-start >> >>

Re: mac install

2010-02-09 Thread Gnarlodious
Hello. The answer is, I don't know. But I originally replaced my existing Python with 3.1.1. I then had to backtrack because some stuff broke. Nothing in the OS, but adapting every Python script on my HD was not what I wanted to do. So my Py3 executable is at: /Library/Frameworks/Python.framework/

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: thanks JM, at this point i switched over to this scheme and now I'm getting an error durring instantiation of the server: Server.py: from Crypto.PublicKey import RSA from ServerNegotiator import ServerNegotiator from sharedComs import * f = open("hostid") tup = stringToTuple

Re: errno 107 socket.recv issue

2010-02-09 Thread George Trojan
Argument mismatch? Jordan Apgar wrote: servernegotiator = ServerNegotiator(host,HostID, port, key) class ServerNegotiator: def __init__(self, host, port, hostid, rsa_key, buf = 512): -- http://mail.python.org/mailman/listinfo/python-list

Re: Pycrypto RSA Issue

2010-02-09 Thread Legrandin
> gkey = RSA.generate(384, Random.new().read) > string = str((gkey.publickey().__getstate__(),(333,444))) You are encrypting with RSA a piece of data which is way larger than the key size (48 bytes). -- http://mail.python.org/mailman/listinfo/python-list

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Jean-Michel Pichavant
Grant Edwards wrote: What's the correct way to measure small periods of elapsed time. I've always used time.clock() in the past: start = time.clock() [stuff being timed] stop = time.clock() delta = stop-start However on multi-processor machines that doesn't work. Sometimes I get

Re: use strings to call functions

2010-02-09 Thread OdarR
On 9 fév, 11:01, Stefan Behnel wrote: > Klaus Neuner, 09.02.2010 10:04: > > > my program is supposed to parse files that I have created myself and that > > are on my laptop. It is not supposed to interact with anybody else > > than me. > > Famous last words. > > Stefan I knew it. Olivier -- htt

Pycrypto RSA Issue

2010-02-09 Thread Jordan Apgar
I am trying to encrypt public data along with another tuple and then decrypt it after sending. RSA is needed for negotiation of keys for AES. But I just get garbage after I decrypt it. This is what I'm attempting to do: from Crypto.PublicKey import RSA from Crypto import Random gkey = RSA.generat

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
thanks JM, at this point i switched over to this scheme and now I'm getting an error durring instantiation of the server: Server.py: from Crypto.PublicKey import RSA from ServerNegotiator import ServerNegotiator from sharedComs import * f = open("hostid") tup = stringToTuple(f.readline()[0:-1]) H

Re: To (monkey)patch or not to (monkey)patch, that is the question

2010-02-09 Thread Raymond Hettinger
On Feb 9, 12:54 am, George Sakkis wrote: > So I'm wondering if there is a consensus on when it's better to (hard) > patch, monkey patch or just try to work around a third party package > that doesn't do exactly what one would like. Does it have mainly to do > with the reason for the patch (e.g. fi

Incorrect 'Host' header when using urllib2 to access a server by its IPv6 link-local address

2010-02-09 Thread slmnhq
I have a snippet of Python code that makes an HTTP GET request to an Apache web server (v 2.2.3) using urllib2. The server responds with an HTTP 400 error presumably because of a malformed 'Host' header. The snippet is quite simple: it creates a url based on IPv6 string literal syntax, then create

Re: ANN: obfuscate

2010-02-09 Thread Aahz
In article , Robert Kern wrote: >On 2010-02-09 09:37 AM, Daniel Fetchinson wrote: >>> >>> obfuscate is a pure-Python module providing classical encryption >>> algorithms suitable for obfuscating and unobfuscating text. >>> >>> DISCLAIMER: obfuscate is not cryptographically strong, and should not

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: http://docs.python.org/library/socketserver.html JM each time a handler is spawned is it client specific? in other words when two clients send something to the server do handlers spawn for each of them or does everything just go into a single handler? docstring of

Re: pyclutter anyone?

2010-02-09 Thread Aahz
In article , donn wrote: > >No one uses pyClutter? Never heard of it before. >I have some code, it does not work, but maybe this will start to help >solve the problem: You need to provide some more detail than "does not work". Perhaps this will help: http://www.catb.org/~esr/faqs/smart-ques

mac install

2010-02-09 Thread Thomas Nelson
I downloaded the 3.1.1 dmg from http://www.python.org/download/releases/3.1.1/ but when I run it I get the error "The folowing install step failed: run postflight script for python documentation." The bugs list has this bug at http://bugs.python.org/issue6934 but it's described as fixed. Is it on

Re: Modifying Class Object

2010-02-09 Thread Terry Reedy
On 2/9/2010 12:12 AM, Alf P. Steinbach wrote: As far as the language spec is concerned the argument passing mechanism seems to me to be identical to assignments, not just "very much like". Except for the cross-namespace nature of the assignment, yes. Glad you agree. Your phrase "or objects

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 8:10 AM, Grant Edwards wrote: > However on multi-processor machines that doesn't work. > Sometimes I get negative values for delta. According to > google, this is due to a bug in Windows that causes the value > of time.clock() to be different depending on which core in a >

Re: Executing Commands From Windows Service

2010-02-09 Thread Sean DiZazzo
On Feb 9, 6:52 am, T wrote: > On Feb 8, 2:25 pm, David Bolen wrote: > > > > > T writes: > > > I have a script, which runs as a Windows service under the LocalSystem > > > account, that I wish to have execute some commands.  Specifically, the > > > program will call plink.exe to create a reverse

Re: Python 3: Plist as OrderedDict

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 8:07 AM, Gnarlodious wrote: > To extract the list I am saying this: > > ordered=plistlib.readPlist(path) > print(list(ordered)) # only a list of keys > print(ordered[list(ordered)[0]]) > > However this seems too laborious. is there an easier way? > I'm not familiar with p

Re: Modifying Class Object

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 7:53 AM, Steve Holden wrote: > > [several paragraphs-worth of bothering further] > > So you didn't believe me when I said > > > Of course this won't make the slightest difference. "'When I use a > > word,' said Humpty ..." > It was early, I was barely awake. That paragraph

Re: PostgreSQL driver for Python applications that supports bytea correctly?

2010-02-09 Thread D'Arcy J.M. Cain
On Tue, 9 Feb 2010 07:27:39 -0800 (PST) CyclingGuy wrote: > Can anyone recommend a PostgreSQL driver for Python that supports > selecting and inserting bytea types? > I'm not looking to write server functions in Python, just client > applications. http://www.PyGreSQL.org/ -- D'Arcy J.M. Cain

Re: Programing family

2010-02-09 Thread Bruno Desthuilliers
On Feb 8, 2010, at 8:39 PM, AON LAZIO wrote: I have thought funny things If we think all languages are like a family Then it would be a very incestuous family fore sure. I could draft them like this (Python base) C is Python's Mom C++ : Dad Not that much C++ in Python, IMHO. If that's f

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
> http://docs.python.org/library/socketserver.html > > JM each time a handler is spawned is it client specific? in other words when two clients send something to the server do handlers spawn for each of them or does everything just go into a single handler? -- http://mail.python.org/mailman/list

Re: errno 107 socket.recv issue

2010-02-09 Thread r. clayton
> http://docs.python.org/library/socketserver.html > > JM each time a handler is spawned is it client specific? in other words when two clients send something to the server do handlers spawn for each of them or does everything just go into a single handler? -- http://mail.python.org/mailman/list

Re: ANN: obfuscate

2010-02-09 Thread Robert Kern
On 2010-02-09 09:37 AM, Daniel Fetchinson wrote: I am pleased to announce the first public release of obfuscate 0.2.2a. http://pypi.python.org/pypi/obfuscate/0.2.2a obfuscate is a pure-Python module providing classical encryption algorithms suitable for obfuscating and unobfuscating text. obfu

Re: Python-URL! - weekly Python news and links (Feb 9)

2010-02-09 Thread Tim Golden
On 09/02/2010 15:37, Stephen Hansen wrote: On Tue, Feb 9, 2010 at 7:03 AM, Gabriel Genellinawrote: After a false start, finally we get our first "Is it Call-By-Value or Call-By-Reference?" thread of the year! http://groups.google.com/group/comp.lang.pythonfd36962c4970ac487ea/

How to measure elapsed time under Windows?

2010-02-09 Thread Grant Edwards
What's the correct way to measure small periods of elapsed time. I've always used time.clock() in the past: start = time.clock() [stuff being timed] stop = time.clock() delta = stop-start However on multi-processor machines that doesn't work. Sometimes I get negative values for de

Re: Programing family

2010-02-09 Thread rodrick brown
Don't forget his little brother Go! Sent from my iPhone 3GS. On Feb 8, 2010, at 8:39 PM, AON LAZIO wrote: I have thought funny things If we think all languages are like a family I could draft them like this (Python base) C is Python's Mom C++ : Dad Pascal/Assembly : Grandparents C# : Uncle

  1   2   >