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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

<    1   2