Re: Python Pop Quiz

2007-06-01 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] wrote: >> 7. How many Z80 assembly language programmers does it take to equal >> one Python guru? > > Trick question, the Z80 was a figment of your imagination. http://en.wikipedia.org/wiki/Zilog_Z80

Re: Ancient projectiles (was: Muzzle Velocity (was: High resolution sleep (Linux))

2007-06-01 Thread Ian MacLure
Roy Smith <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED] 625.area1.spcsdns.net: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Cameron Laird) > wrote: > >> Hmmm; now you've got me curious. What *were* the first >> composite projectiles? > > Fetchez la Vache! Non, non, non,

Re: Thread-safety of dict

2007-06-01 Thread Raymond Hettinger
On May 31, 9:12 pm, "Adam Olsen" <[EMAIL PROTECTED]> wrote: > It seems to be a commonly held belief that basic dict operations (get, > set, del) are atomic. They are atomic so long as the key does not have a custom __hash__, __eq__, or __cmp__ method which can trigger arbitrary Python code. With

Re: PythonCard or Dabo?

2007-06-01 Thread Bill Maxwell
On 19 Mar 2007 10:40:03 -0700, [EMAIL PROTECTED] wrote: ... >You might want to submit this to the wxpython news-group. ... What is the name of this newsgroup? I can't seem to locate it on my news server. Thanks, Bill -- http://mail.python.org/mailman/listinfo/python-list

Re: subexpressions

2007-06-01 Thread Terry Reedy
"Cousin Stanley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | | > | > After years of discussion, Guido has decided | > to leave lambda alone for 3.0. | > | > It will not be neither expanded, nor removed, nor renamed. | | But it still will be as ugh, ugh, ugh-lee | as a mul

YOUR PERSONAL ATM

2007-06-01 Thread [EMAIL PROTECTED]
click the moneyhttp://www.ondemandprofits.com/?cb=sagabec also visit http://www.dollaroffers.com/[EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Detecting an active exception

2007-06-01 Thread NeBlackCat
I've now also looked at this from a traceback and stack frame walking perspective as well and it seems impossible, ie. it see,s impossible to create a function AmIHandlingAnException() which would behave as follows: try: a=a+1 except: pass try: AmIHandlingAnException()

Re: c[:]()

2007-06-01 Thread Andre Engels
2007/6/1, Warren Stringer <[EMAIL PROTECTED]>: > I am not insisting on anything. I use ``c[:]()`` as shorthand way of saying > "c() for c in d where d is a container" > > Having c() support containers seems obvious to me. It jibes with duck > typing. Perhaps the title of this thread should have be

Re: Detecting an active exception

2007-06-01 Thread NeBlackCat
Thanks Duncan - that does clear things up for me on how sys.exc_info() it actually works! But it does seem that there is no way to test "am I currently running in the scope of handling of an exception", which is what I need. If there was, I could then rely on sys.exc_info() to examine the excep

Re: Create a new class on the fly

2007-06-01 Thread Alex Martelli
py_genetic <[EMAIL PROTECTED]> wrote: > Alex, thanks for the advise: > > > > class PosRecords(tables.IsDescription): > > > > > class A(object): > > > self.__init__(self, args): > > > > This makes 0 sense; maybe you should learn elementary Python syntax well > > _before_ trying advanced stuff,

Re: subexpressions

2007-06-01 Thread Cousin Stanley
> > After years of discussion, Guido has decided > to leave lambda alone for 3.0. > > It will not be neither expanded, nor removed, nor renamed. But it still will be as ugh, ugh, ugh-lee as a mule walking backwards . ;-) -- Stanley C. Kitching Human Being Phoenix, Arizona =

RE: c[:]()

2007-06-01 Thread Warren Stringer
Gabriel wrote: > I begin to think you are some kind of Eliza experiment with Python > pseudo-knowledge injected. Tell me more about your feelings that I am an Eliza experiment with Python with pseudo knowledge injected. Thanks for the code example. -- http://mail.python.org/mailman/listinfo/pyt

Re: Python Pop Quiz

2007-06-01 Thread Roy Smith
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > 1. Do you like Python? Yes > 2. Do you think Python is good? Yes > 3. Do you think Python is real good? Yes > 4. What is your favorite version of Python? Whichever version it was that added string methods. > 5. Because of Python,

Re: Observer-Pattern by (simple) decorator

2007-06-01 Thread Gabriel Genellina
En Fri, 01 Jun 2007 21:25:50 -0300, Wildemar Wildenburger <[EMAIL PROTECTED]> escribió: > Steven Bethard wrote: >> I think you want to define __get__ on your Observable class so that it >> can do the right thing when the method is bound to the instance: > > It took me quite some time understand

Re: c[:]()

2007-06-01 Thread Grant Edwards
On 2007-06-02, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Fri, 01 Jun 2007 14:22:29 -0300, Warren Stringer <[EMAIL PROTECTED]> > escribió: > >> I am not insisting on anything. I use ``c[:]()`` as shorthand >> way of saying "c() for c in d where d is a container" > > I begin to think you ar

Re: Examples of high-quality python code?

2007-06-01 Thread kaens
On 31 May 2007 06:58:36 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On May 31, 8:38 am, Larry Bates <[EMAIL PROTECTED]> wrote: > > kaens wrote: > > > Hey everyone, I'm relatively new to python - I actually picked it up > > > to see how quickly I could start building non-trivial apps with

Python Pop Quiz

2007-06-01 Thread snorble
1. Do you like Python? 2. Do you think Python is good? 3. Do you think Python is real good? 4. What is your favorite version of Python? 5. Because of Python, do you think it will be easier to take over the world? If so, when? If not, when? 7. How many Z80 assembly language programmers does it

Re: c[:]()

2007-06-01 Thread Gabriel Genellina
En Fri, 01 Jun 2007 14:22:29 -0300, Warren Stringer <[EMAIL PROTECTED]> escribió: > I am not insisting on anything. I use ``c[:]()`` as shorthand way of > saying > "c() for c in d where d is a container" I begin to think you are some kind of Eliza experiment with Python pseudo-knowledge inj

Re: M2Crypto-0.17 blocks python threads?

2007-06-01 Thread Heikki Toivonen
[EMAIL PROTECTED] wrote: > I am having a problem with python threads and M2Crypto. It appears > the M2Crypto used in multi-thread application blocks other threads > from running: This turned into https://bugzilla.osafoundation.org/show_bug.cgi?id=9401 Thanks for the report! -- Heikki Toivone

Re: Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread George Sakkis
On Jun 1, 2:20 pm, "Brian L. Troutwine" <[EMAIL PROTECTED]> wrote: > >http://wiki.python.org/moin/ParallelProcessing > > Ah, I'd forgotten about that page of the wiki; I hadn't seen it for a few > months. > > > Do you have any opinions about those projects listed on the above page > > that are sim

Re: FAQ: how to vary the byte offset of a field of a ctypes.Structure

2007-06-01 Thread p . lavarre
> Often it helps to ask yourself the question: How would I do this in C? ... > > *Not* by using a structure. A structure is fine if the definition is fixed, > or at most has *one* variable sized field at the very end. http://docs.python.org/lib/module-pickle.html might be near where I'll find conc

Re: subexpressions

2007-06-01 Thread Steven D'Aprano
On Fri, 01 Jun 2007 07:09:50 -0400, Steve Holden wrote: > The real answer is of course: Use a function. But what about something like lambda x: sin(y)+cos(y) where y=x*x ? May be this could be a PEP? If there is no straight way to do this. >>> def f(x): >>>y =

Re: Observer-Pattern by (simple) decorator

2007-06-01 Thread Wildemar Wildenburger
Steven Bethard wrote: > I think you want to define __get__ on your Observable class so that it > can do the right thing when the method is bound to the instance: > > >>> class Observable(object): > [snip] > ... def __get__(self, obj, cls=None): > ... if obj is None: > ... re

Re: Using PIL to find separator pages

2007-06-01 Thread Larry Bates
Steve Holden wrote: > Larry Bates wrote: >> Steve Holden wrote: >>> Larry Bates wrote: I have a project that I wanted to solicit some advice on from this group. I have millions of pages of scanned documents with each page in and individual .JPG file. When the documents were sca

Re: Cookie: Not understanding again

2007-06-01 Thread David Wahler
On Jun 1, 3:49 pm, mosscliffe <[EMAIL PROTECTED]> wrote: > I have the following code, which I thought would create a cookie, if > one did not exist and on the html form being sent to the server, it > would be availabe for interrogation, when the script is run a second > time. > > It seems to me the

Re: Observer-Pattern by (simple) decorator

2007-06-01 Thread Steven Bethard
Wildemar Wildenburger wrote: > I thought: I'll just write a decorator that lets me react to method > calls easily (the ever so popular observer-pattern). I've looked at some > recepies, but I just don't get them (I'm feeling kinda dumb today, sorry). [snip] > This is more complicated than expecte

Re: Get ClassID of different versions of program with same ProgID

2007-06-01 Thread ilocke
AutoCAD.Application.16 opens 2004, but I tried numbers before and after and nothing opend up 14. I figured out a way to find it though. I was using pythoncom.GetClassFile on the AutoCAD executable instead of a drawing file. I used it with .dwg twice while associated to each of the versions, and i

Re: Get ClassID of different versions of program with same ProgID

2007-06-01 Thread Matimus
Bummer you can't look into the registry. By convention the ProgID is named ... Also, usually there is a version independent ProgID that goes .. The version independent ProgID usually points to the newest version. It looks like that is what you are using. Many programs get away with not using those

Re: Updated Jython Bibliography

2007-06-01 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >To celebrate jython's recent progress I've updated my Jython >Bibliography to include new resources I've tripped over in the last >little while. Its available here: http://www.fishandcross.com/blog/?p=194 >Please let me

Get ClassID of different versions of program with same ProgID

2007-06-01 Thread ilocke
Hello, I am new to Python and COM, but both seem very useful for automation as AutoCAD, ArcGIS, and my gps software all have COM interfaces and ArcGIS actually uses python scripts. My trouble is that I am running two versions of AutoCAD (14 and 2004). The problem is that both have the same ProgID

Observer-Pattern by (simple) decorator

2007-06-01 Thread Wildemar Wildenburger
Hello folks :) This has got to be an FAQ, but somehow I can't seem to find an answer that I understand ... I thought: I'll just write a decorator that lets me react to method calls easily (the ever so popular observer-pattern). I've looked at some recepies, but I just don't get them (I'm feelin

Re: Create a new class on the fly

2007-06-01 Thread py_genetic
Alex, thanks for the advise: > > class PosRecords(tables.IsDescription): > > > class A(object): > > self.__init__(self, args): > > This makes 0 sense; maybe you should learn elementary Python syntax well > _before_ trying advanced stuff, no? I accidently left that erroneous snippet in, howeve

Updated Jython Bibliography

2007-06-01 Thread [EMAIL PROTECTED]
To celebrate jython's recent progress I've updated my Jython Bibliography to include new resources I've tripped over in the last little while. Its available here: http://www.fishandcross.com/blog/?p=194 Please let me know if I've missed anything. -- http://mail.python.org/mailman/listinfo/pytho

[ANN]: 'twander' Cross-Platform File Manager Version 3.224 Released And Available

2007-06-01 Thread Tim Daneliuk
'twander' Version 3.224 is now released and available for download at: http://www.tundraware.com/Software/twander The last public release was 3.210. This release fixes a number of bugs and adds a variety of useful new features. See the WHATSNEW.txt file for all the details. -

Re: subexpressions

2007-06-01 Thread Paul Boddie
Steve Howell wrote: > > The compiler doesn't know the types up front, but if > you wanted to do this kind of optimization (and you > believed that 95% of x*x cases would benefit from it, > and you're willing to sacrifice performance for the 5% > of folks that overload multiply), then the compiler >

Re: Detecting an active exception

2007-06-01 Thread Duncan Booth
"NeBlackCat (lists)" <[EMAIL PROTECTED]> wrote: > Depending on what you read, sys.exc_info() is supposed to return > (None,None,None) when there is no active exception, but it seems that > it returns info about the last exception when there isn't one > currently active. > > For example: > > try

Re: Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread MC
Hi! Look Candygram : http://candygram.sourceforge.net/ -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Detecting an active exception

2007-06-01 Thread NeBlackCat (lists)
Hello everybody - my first post! And it may be the most monumentally stupid question ever asked, but I just can't see an answer after several hours experimenting, searching and reading. It's simply this - how can a function determine whether or not it's being called in handling of an exception

Re: subexpressions

2007-06-01 Thread Steven Bethard
Sergey Dorofeev wrote: > Please help, is there way to use sub-expressions in lambda? > For example, if I want to calculate sin(x^2)+cos(x^2) I must code: > lambda x: sin(x*x)+cos(x*x) [and later] > This code is needed once in a map, Peter Otten wrote: > Perhaps you like [sin(y)+cos(y) for y in (x

Re: Thread-safety of dict

2007-06-01 Thread Rhamphoryncus
On Jun 1, 3:51 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Adam Olsen" <[EMAIL PROTECTED]> wrote: > > So there you have it: if you're using a dict with custom classes (or > > anything other than str) across multiple threads, and without locking > > it, it's possible (though presumably extremely

Re: Thread-safety of dict

2007-06-01 Thread Adam Olsen
On 6/1/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > So there you have it: if you're using a dict with custom classes (or > > anything other than str) across multiple threads, and without locking > > it, it's possible (though presumably extremely rare) for a lookup to > > fail even through t

Re: c[:]()

2007-06-01 Thread Grant Edwards
On 2007-06-01, Warren Stringer <[EMAIL PROTECTED]> wrote: >> This discussion has gone in more circles than Earth has gone >> 'round the Sun, but it seems you should consider the >> following: > > Yes, I've been feeling a bit dizzy No comment. >> 1) Sequences and functions serve fundamentally dif

Re: c[:]()

2007-06-01 Thread Grant Edwards
On 2007-06-01, Warren Stringer <[EMAIL PROTECTED]> wrote: >> And that your insisting on ``c[:]()`` instead of just ``c()`` >> seems to indicate you want a change that is quite surprising. >> It would mean that a slice of a list returns an other type >> with the __call__ method implemented. > > I a

Re: Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread Brian L. Troutwine
> http://wiki.python.org/moin/ParallelProcessing Ah, I'd forgotten about that page of the wiki; I hadn't seen it for a few months. > Do you have any opinions about those projects listed on the above page > that are similar to your own? My contribution (pprocess), along with > others (processing,

Re: __getslice__ depreciation

2007-06-01 Thread Screamingfirst
On Jun 1, 7:50 pm, [EMAIL PROTECTED] wrote: > If __getslice__ is depreciated (since version 2.0) why are neither > __setslice__ or __delslice__ > depreciated?http://docs.python.org/ref/sequence-methods.html Sorry disregard that, I should have RTFA -- http://mail.python.org/mailman/listinfo/pyth

Python 2.3 ODBC Datetime limitations

2007-06-01 Thread YuePing Lu
Hello, Has any of you ever used Python odbc to retrieve data from a relational DB? I encountered a problem where it can't handle datetime *earlier than **1969*, and *later than **2040*. It just returned some garbage strings when I call str(my_date_object). When I call strptime to convert the va

__getslice__ depreciation

2007-06-01 Thread Screamingfirst
If __getslice__ is depreciated (since version 2.0) why are neither __setslice__ or __delslice__ depreciated? http://docs.python.org/ref/sequence-methods.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread Paul Boddie
On 1 Jun, 19:34, "Brian L. Troutwine" <[EMAIL PROTECTED]> wrote: > Lately I've been tinkering around with Erlang and have begun to sorely want > some of its features in Python, mostly the ease at which new processes can be > forked off for computation. To that end I've coded up a class I call, > bo

RE: c[:]()

2007-06-01 Thread Warren Stringer
Thanks, Dakz for taking the time to reply: > This discussion has gone in more circles than Earth has gone 'round > the Sun, but it seems you should consider the following: Yes, I've been feeling a bit dizzy > 1) Sequences and functions serve fundamentally different purposes in > Python. One is f

Re: c[:]()

2007-06-01 Thread Jerry Hill
On 6/1/07, Warren Stringer <[EMAIL PROTECTED]> wrote: > > And that your > > insisting on ``c[:]()`` instead of just ``c()`` seems to indicate you want > > a change that is quite surprising. It would mean that a slice of a list > > returns an other type with the __call__ method implemented. > > I a

Re: Resize image NO PIL!!

2007-06-01 Thread cbmeeks
Thanks for the suggestions. I checked out webfaction.com and they looked nice. Might move from Pair over there. I think what I am going to do is splurge and go with Amazon's EC2 ($72/ month). But it's root level access so I can do anything. Last night I got a Python daemon running that monitor

Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread Brian L. Troutwine
Lately I've been tinkering around with Erlang and have begun to sorely want some of its features in Python, mostly the ease at which new processes can be forked off for computation. To that end I've coded up a class I call, boringly enough, Process. It takes a function, its args and keywords and

Re: getmtime differs between Py2.5 and Py2.4

2007-06-01 Thread Joe Salmeri
>"Neil Hodgson" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] > >One problem I have seen is that Windows Explorer and its File > Properties sheet sometimes cache time values. Even closing and reopening > the properties can show the old value. dir should always read the times

RE: c[:]()

2007-06-01 Thread Warren Stringer
> > [Please quit saying "a container" if you mean lists and tuples. > > "A container" is way too general. There most probably _are_ > > containers for which c() does not fail.] > > One example of such a container is any folderish content in Zope: > subscripting gets you the contained pages, calli

RE: c[:]()

2007-06-01 Thread Warren Stringer
> And that your > insisting on ``c[:]()`` instead of just ``c()`` seems to indicate you want > a change that is quite surprising. It would mean that a slice of a list > returns an other type with the __call__ method implemented. I am not insisting on anything. I use ``c[:]()`` as shorthand way of

Re: Python 2.5.1 broken os.stat module

2007-06-01 Thread Joe Salmeri
Hi Terry, > If, when discussion is concluded here, you still think there is a bug, > file > a report on SF. Make a concise summary in the comments section and attach > a file with the output from your experiments. You may have to submit the > attachment separately after first submitting the rep

Re: subexpressions

2007-06-01 Thread Kay Schluehr
On Jun 1, 9:51 am, "Sergey Dorofeev" <[EMAIL PROTECTED]> wrote: > Hello all! > > Please help, is there way to use sub-expressions in lambda? > For example, if I want to calculate sin(x^2)+cos(x^2) I must code: > lambda x: sin(x*x)+cos(x*x) > How to make x*x to be evaluated once? lambda x: (lambda

Re: subexpressions

2007-06-01 Thread Steve Howell
--- Paul Boddie <[EMAIL PROTECTED]> wrote: > On 1 Jun, 12:55, Steve Howell <[EMAIL PROTECTED]> > wrote: > > FWIW there's the possibility that even without a > > subexpression syntax, some Python implementations > > would detect the duplication of x*x and optimize > that > > for you. It would hav

RE: MySQLdb insert fails on one table

2007-06-01 Thread Sells, Fred
thank you! that was it. I created the table using a create table (select from which must have defaulted to InnoDb, now I just create it in a script. > -Original Message- > From: Carsten Haese [mailto:[EMAIL PROTECTED] > Sent: Friday, June 01, 2007 8:56 AM > To: Sells, Fred > Cc: pyth

Re: What is equivalent of *this = that in python?

2007-06-01 Thread Terry Reedy
"Emin.shopper Martinian.shopper" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | How do I reassign self to another object? Exactly the way you give below. |For example, I want something like | | class foo: |def Update(self,other): Self and other are two local names. Self is p

Re: subexpressions

2007-06-01 Thread Steve Howell
--- "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > The elegance of that solution very much depends on > the cost of the duplicate > operation vs. the additional function call. > > And for the usecase at hand, that's exactly the > point not to do it: > > [EMAIL PROTECTED]:/tmp$ python -m timeit '

Re: file reading by record separator (not line by line)

2007-06-01 Thread Neil Cerutti
On 2007-06-01, Tijs <[EMAIL PROTECTED]> wrote: > Steve Howell wrote: >>> >>> from blockread import BlockReader >>> >>> b = BlockReader(f, boundary='>') >>> for block in b: >>> # whatever >> >> Yep, I like this idea. You might have a few >> variations: > > Yes, or a single one that takes

Re: subexpressions

2007-06-01 Thread Terry Reedy
"Sergey Dorofeev" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | How to make x*x to be evaluated once? Addendum to the answers already posted: In Python, lambda params: expression is an inline abbreviation for def (params): return expression except that there is no external bi

Re: Using PIL to find separator pages

2007-06-01 Thread Steve Holden
Larry Bates wrote: > Steve Holden wrote: >> Larry Bates wrote: >>> I have a project that I wanted to solicit some advice >>> on from this group. I have millions of pages of scanned >>> documents with each page in and individual .JPG file. >>> When the documents were scanned the people that did >>>

Re: How to clean a module?

2007-06-01 Thread ai
thx On Jun 1, 6:50 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > ai wrote: > > Yes, you are right. > > But from this problem, could I infer that the statement "del xxx" > > doesn't release the memory which xxx used? > > It just removes the name xxx from the current scope - which will result

Re: unknown host

2007-06-01 Thread Steve Holden
abcd wrote: > I have a linux machine (ip = 10.10.10.8), which can ping other > machines on the same subnet...such as > > 10.10.10.1 > 10.10.10.2 > 10.10.10.5 > 10.10.10.6 > 10.10.10.254 > > If I use socket.gethostbyaddr() I get back results when ip is > 10.10.10.1 and 10.10.10.254 but for the oth

Re: Delete a file from a CGI

2007-06-01 Thread Steve Holden
Matias Surdi wrote: > Thanks for your reply. > > This is the code that creates the file: > lock_file = open(".lock","w") > lock_file.write("test") > lock_file.close() > #Change permissions so that CGI can write lock file > os.chmod(".lock",stat.S_IMODE(stat.S_IRWXU | stat.S_IRWXO | stat.S_IRWXG))

Re: Python in University

2007-06-01 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | to lift the academic profile of The Python Papers, and to this end we | are hoping to encourage teachers and students who are interested to | publish in our journal, and also to contact their libraries regarding | having TPP included a

Re: What is equivalent of *this = that in python?

2007-06-01 Thread Larry Bates
Carsten Haese wrote: > On Fri, 2007-06-01 at 11:53 -0400, Emin.shopper Martinian.shopper wrote: >> I have a distributed application using xmlrpc and I'd like for a local >> object to sync itself to match a remote version of the object. I >> realize that I can copy all the attributes from the remote

Re: Python 2.5.1 broken os.stat module

2007-06-01 Thread Terry Reedy
"Joe Salmeri" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I hope I have provided enough information for you to reproduce the bug so | that a solution can be found. If, when discussion is concluded here, you still think there is a bug, file a report on SF. Make a concise summa

Re: cStringIO change in 2.4 vs 2.5. Regression?

2007-06-01 Thread Terry Reedy
"Markus Schöpflin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hello, | | I just stumbled accross a difference between cStringIO in Python 2.4 | and 2.5. You can no longer feed arrays to cStringIO. [snip] | Has this change been done on purpose or is it a regression? I doubt tha

Re: What is equivalent of *this = that in python?

2007-06-01 Thread Carsten Haese
On Fri, 2007-06-01 at 11:53 -0400, Emin.shopper Martinian.shopper wrote: > I have a distributed application using xmlrpc and I'd like for a local > object to sync itself to match a remote version of the object. I > realize that I can copy all the attributes from the remote object to > the local obj

Re: MySQLdb insert fails on one table

2007-06-01 Thread Carsten Haese
On Fri, 2007-06-01 at 11:48 -0400, Sells, Fred wrote: > INSERT INTO valid_individuals (fname,lname,alias,email) VALUES (%s,%s,%s,%s) > [['', '', 'z', 'aa']] > > this function works fine for several other tables, but on this one I get no > errors and there is nothing in the table.

Re: Using PIL to find separator pages

2007-06-01 Thread Larry Bates
Steve Holden wrote: > Larry Bates wrote: >> I have a project that I wanted to solicit some advice >> on from this group. I have millions of pages of scanned >> documents with each page in and individual .JPG file. >> When the documents were scanned the people that did >> the scanning put a colored

Re: What is equivalent of *this = that in python?

2007-06-01 Thread Emin.shopper Martinian.shopper
I have a distributed application using xmlrpc and I'd like for a local object to sync itself to match a remote version of the object. I realize that I can copy all the attributes from the remote object to the local object, but that seems like an ugly solution. There must be a better way... Thanks

Re: c[:]()

2007-06-01 Thread dackz
This discussion has gone in more circles than Earth has gone 'round the Sun, but it seems you should consider the following: 1) Sequences and functions serve fundamentally different purposes in Python. One is for containing objects, the other is for executing an action. (And yes, I'm aware that th

Re: What is equivalent of *this = that in python?

2007-06-01 Thread Carsten Haese
On Fri, 2007-06-01 at 11:30 -0400, Emin.shopper Martinian.shopper wrote: > Dear Experts, > > How do I reassign self to another object? For example, I want > something like > > class foo: > def Update(self,other): > # make this object the same as other or make this object a > copy of o

MySQLdb insert fails on one table

2007-06-01 Thread Sells, Fred
I have this table mysql> describe valid_individuals; +---+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +---+--+--+-+-+---+ | fname | varchar(30) | YES | | NULL| | | lname | varchar(30)

What is equivalent of *this = that in python?

2007-06-01 Thread Emin.shopper Martinian.shopper
Dear Experts, How do I reassign self to another object? For example, I want something like class foo: def Update(self,other): # make this object the same as other or make this object a copy of other self = other # This won't work. What I really want is *this = other in C++ termi

Re: Cookie: Not understanding again

2007-06-01 Thread mosscliffe
On 1 Jun, 15:49, mosscliffe <[EMAIL PROTECTED]> wrote: > I have the following code, which I thought would create a cookie, if > one did not exist and on the html form being sent to the server, it > would be availabe for interrogation, when the script is run a second > time. > > It seems to me there

Cookie: Not understanding again

2007-06-01 Thread mosscliffe
I have the following code, which I thought would create a cookie, if one did not exist and on the html form being sent to the server, it would be availabe for interrogation, when the script is run a second time. It seems to me there is something basic missing in that I should need to tell the serv

Re: c[:]()

2007-06-01 Thread Grant Edwards
On 2007-06-01, Warren Stringer <[EMAIL PROTECTED]> wrote: > I like your use case. Am I correct in assuming that `y = x[:]; > y()` is NOT to be found in working code? No, you may not assume that. > If that is the case, then nothing gets broken. It would be > instructive to have a use case where e

Re: c[:]()

2007-06-01 Thread Grant Edwards
On 2007-06-01, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-06-01 at 02:19 -0700, Warren Stringer wrote: >> There is code that you type which persists and code that you type from a >> command line. Two completely different idioms. A credo inside the cell phone >> game industry is that yo

Re: calling Postgresql stored procedure (written in plpython)

2007-06-01 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, Alchemist <[EMAIL PROTECTED]> wrote: > Thanks for your help. > > My stored procedure is written in pythonpl. I noticed that SELECT > queries are executed correctly (results are returned to my script) > whereas UPDATE queries are not being performed as the data is

Re: unknown host

2007-06-01 Thread Sion Arrowsmith
abcd <[EMAIL PROTECTED]> wrote: >I have a linux machine (ip = 10.10.10.8), which can ping other >machines on the same subnet...such as > [ ... ] >If I use socket.gethostbyaddr() I get back results when ip is >10.10.10.1 and 10.10.10.254 but for the other IP addresses >(10.10.10.5, .6, etc) I get b

Re: c[:]()

2007-06-01 Thread Sion Arrowsmith
Warren Stringer <[EMAIL PROTECTED]> wrote: >#-- >class do(list): >def __call__(self,*args,**kwargs): >return [f(*args,**kwargs) for f in self] > > >def a(): print 'a called' >def b(): print 'b called' >c = do() >c = [a,b] >do(c[:])() >do(c)()

Re: Delete a file from a CGI

2007-06-01 Thread Matias Surdi
Thanks for your reply. This is the code that creates the file: lock_file = open(".lock","w") lock_file.write("test") lock_file.close() #Change permissions so that CGI can write lock file os.chmod(".lock",stat.S_IMODE(stat.S_IRWXU | stat.S_IRWXO | stat.S_IRWXG)) This script was run as root. Now,

Re: pack() and the division of vertical space

2007-06-01 Thread [EMAIL PROTECTED]
On Jun 1, 3:13 am, "Eric Brunel" <[EMAIL PROTECTED]> wrote: > On Thu, 31 May 2007 19:45:04 +0200, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > I am trying to figure out how to stack two widgets in a frame > > vertically so that they both expand horizontally and during vertical > > expansi

Re: logging module: log file with datetime

2007-06-01 Thread Vinay Sajip
On 1 Jun, 13:00, Álvaro Nieto <[EMAIL PROTECTED]> wrote: > How could I define a log file with datetime in his name?. Now the > name > for log file is './Logs/cdmto.log' and I'd like it would be './ > Logs/cdmto_20070601.log', > for example. > You can't do this just in the configuration

Re: unknown host

2007-06-01 Thread Michael Bentley
On Jun 1, 2007, at 8:09 AM, abcd wrote: > I have a linux machine (ip = 10.10.10.8), which can ping other > machines on the same subnet...such as > > 10.10.10.1 > 10.10.10.2 > 10.10.10.5 > 10.10.10.6 > 10.10.10.254 > > If I use socket.gethostbyaddr() I get back results when ip is > 10.10.10.1 and

Re: ImageMagick Issue

2007-06-01 Thread Facundo Batista
Sick Monkey escribió: > I ran into another slight problem. And I attempted to fix it, but have > not been able to do so yet. If a filename does not contain a space, > then this method works like a charm. But if there is a space then the > code throws a nasty error. Ok, the issue is that sub

unknown host

2007-06-01 Thread abcd
I have a linux machine (ip = 10.10.10.8), which can ping other machines on the same subnet...such as 10.10.10.1 10.10.10.2 10.10.10.5 10.10.10.6 10.10.10.254 If I use socket.gethostbyaddr() I get back results when ip is 10.10.10.1 and 10.10.10.254 but for the other IP addresses (10.10.10.5, .6, e

Re: subexpressions

2007-06-01 Thread Diez B. Roggisch
> Ok, I stand corrected. > > Duplicate subexpressions are pretty easy to avoid in > Python, so though an optimization would not be > impossible here (checking for immutability of > builtins, etc., which still assumes the idea that > multiplication is more expensive than checking for > immutability

RE: c[:]()

2007-06-01 Thread Carsten Haese
On Fri, 2007-06-01 at 08:39 -0400, Carsten Haese wrote: > On Fri, 2007-06-01 at 02:19 -0700, Warren Stringer wrote: > > There is code that you type which persists and code that you type from a > > command line. Two completely different idioms. A credo inside the cell phone > > game industry is that

RE: c[:]()

2007-06-01 Thread Carsten Haese
On Fri, 2007-06-01 at 02:19 -0700, Warren Stringer wrote: > There is code that you type which persists and code that you type from a > command line. Two completely different idioms. A credo inside the cell phone > game industry is that you lose half your audience with each menu keystroke. > That's

Re: subexpressions

2007-06-01 Thread Steve Howell
--- Tijs <[EMAIL PROTECTED]> wrote: > Steve Howell wrote: > > FWIW there's the possibility that even without a > > subexpression syntax, some Python implementations > > would detect the duplication of x*x and optimize > that > > for you. It would have to know that x*x had no > side > > effects,

Re: file reading by record separator (not line by line)

2007-06-01 Thread Tijs
Steve Howell wrote: > Do you have any free time on your hands? Nope. I think Python is a programmer's language, not a whack-something-together script language for text processing (although it is used that way). Any decent programmer has no need of this construct, since the time to lookup how

Re: getmtime differs between Py2.5 and Py2.4

2007-06-01 Thread Neil Hodgson
Joe Salmeri: > I can see that you guys have already spent alot of time investigating this > but surely the results should match what Windows Explorer says or what the > dir command returns??? One problem I have seen is that Windows Explorer and its File Properties sheet sometimes cache tim

Re: Delete a file from a CGI

2007-06-01 Thread Gerardo Herzig
When you execute a cgi, the program runs under the "apache user" (ussualy www or wwwrun or so), so THAT user needs permissions for deleting the file. Other approach could be suid'ing the cgi program. Gerardo >HI! > >I want to delete a file from a CGI, but I always get a Permission denied >error

Re: c[:]()

2007-06-01 Thread Duncan Booth
Steve Holden <[EMAIL PROTECTED]> wrote: >> Actually you can copy and paste from a Windows cmd/command shell: >> right-click the title-bar of the window, select "Edit" from the pop-up >> menu, then "Mark" from the sub-menu to copy whatever you want to select >> into the Windows clipboard. >> >>

  1   2   >