Re: How to set program name in Python? ($0 in Perl)

2005-11-10 Thread Swaroop C H
Thanks Fredrik for the info. It was not a must-have, I was just curious if it was possible. Thanks, Swaroop www.SwaroopCH.info -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread LB
>The tarball can be found at http://www.mired.org/downloads/P(x)-0.2.tar.gz >. Something doesn't work wit the link. LB -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread LB
>The tarball can be found at http://www.mired.org/downloads/P(x)-0.2.tar.gz >. Something doesn't work with the link. LB -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use generators?

2005-11-10 Thread Ian Vincent
Tom Anderson <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > Exactly - using a queue means you'll do a breadth-first rather than a > depth-first search, which will involve much less depth of recursion. > See: Thanks for the answers but found a easier (admittedly cheating) way around

Re: How to set program name in Python? ($0 in Perl)

2005-11-10 Thread Fredrik Lundh
Swaroop C H wrote: > Thanks Fredrik for the info. > > It was not a must-have, I was just curious if it was possible. it should be noted that some systems have a setproctitle() function, but the design of that API comes with its own can of quality worms: http://www.cert.org/advisories/CA-200

Re: What do you use as symbols for Python ?

2005-11-10 Thread George Sakkis
"Erik Max Francis" <[EMAIL PROTECTED]> wrote: > Pierre Barbier de Reuille wrote: > > > When you need some symbols in your program, what do you use in Python ? > > > > For example, an object get a state. This state is more readable if > > expressed as a symbols, for example "opened", "closed", "err

[curses]: detecting modifier keys?

2005-11-10 Thread MackS
Hello I am writing a small app to learn how to use the curses module. I would like to know how I can get "composite" key presses, eg, Control+Q. Currently I am looking at the following code snippet: import curses.wrapper def main(stdscr): x = 0 while True: key = stdscr.getch(

Re: getting results into one variable

2005-11-10 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > a = db.execute(stmt) and then expand variable 'a' > > instead of doing > (a,b) = db.execute(stmt) for return of 2 > (a,b,c) = for return of 3 > (a,b,c,d) for return of 4 What do you intend to do with a, b, c,d ? a = f(x) always work. You can later then do a : if len

RE: Looking Python script to compare two files

2005-11-10 Thread Tim Golden
[david] > I want to compare PDF-PDF files and WORD-WORD files. OK. Well, that's clear enough. > It seems that the right way is : > First, extract text from PDF file or Word file. > Then, use Difflib to compare these text files. When you say "it seems that the right way is..." I'll assume that th

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread Steve Holden
LB wrote: >>The tarball can be found at >http://www.mired.org/downloads/P(x)-0.2.tar.gz >. > > > Something doesn't work with the link. > > LB > Copy the whole string up to and including the ".gz" at the end and paste that into your browser's location window. I think it's a bit ill-advised to

getting results into one variable

2005-11-10 Thread s99999999s2003
hi the database "execute" function returns a list of logical results. Each logical result is a list of row tuples, as explained in the documents. everytime i use it to execute various statements, it returns me, for example ([(0,)], [(0,)], [(0,)]) and sometimes , ([(0,)], [(0,)]) or ([(0,)]) in m

Re: append to non-existing list

2005-11-10 Thread Yves Glodt
bruno at modulix wrote: > Yves Glodt wrote: > (snip) >> ok I see your point, and python's... >> >> (just FYI, and not to start a flamewar ;-): >> In php, the [] means "append to an array object". > > yes, I know this. > >> If the array does not exist yet, it's created. > > Which is what I don't

Re: append to non-existing list

2005-11-10 Thread [EMAIL PROTECTED]
Yves Glodt wrote: > Which raises another question... :-) > > Is there a possibility to bring together apache and python in a way that > I can embed python into html? What do you mean ? > > Or even, write a smallish webserver in python (using twisted maybe) > whose only purpose is to serve pages an

Re: how to modify code while debugging it without having to stop and then restart debugger

2005-11-10 Thread Magnus Lycka
Mike Meyer wrote: > In that case, you're using the wrong IDE. I run the Python interpeter > inside of Emacs. I edit my code in another buffer. In the source code > buffer, I hit M-C-x, and the current version of the function I'm > currently editing gets sent to the interpreter. Reload is pretty eas

Re: append to non-existing list

2005-11-10 Thread Fredrik Lundh
Yves Glodt wrote: > Is there a possibility to bring together apache and python in a way that > I can embed python into html? http://www.onlamp.com/pub/a/python/2004/02/26/python_server_pages.html http://www.modpython.org/live/mod_python-3.2.2b/doc-html/pyapi-psp.html#pyapi-psp -- http://ma

Re: append to non-existing list

2005-11-10 Thread Yves Glodt
[EMAIL PROTECTED] wrote: > Yves Glodt wrote: >> Which raises another question... :-) >> >> Is there a possibility to bring together apache and python in a way that >> I can embed python into html? > What do you mean ? I need this (invalid example-html follows): title of page Hello, today is: %s

Re: getting results into one variable

2005-11-10 Thread Steve Holden
[EMAIL PROTECTED] wrote: That's a nice email address :-) > hi > the database "execute" function returns a list of logical results. Each > logical result is a list of row tuples, as explained in the documents. > In a DB-API-compliant module, execution of the query adn retrieval of the result(s) a

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-10 Thread Jeremy Sanders
vinjvinj wrote: > Unfortunately this in not an options since all the processes share > objects in memory which are about 1gig for each node. Having a copy of > this in each user process is just not an options. I think I'm going to > use RestrictedPython from zope3 svn which should take care of 70-

output question 1

2005-11-10 Thread leewang kim
I wrote the following code and got the output:a 13 0Noneb 81 3Nonec 8 2Noned 9 2Nonee 1 1Nonewhere are those 'none' from? and how can I remove them? class Point:    def __init__(self,x,y,name):    self.x = x    self.y = y    self.name = name    def summary(self):    print self.name

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > George Sakkis wrote: > >list(takewhile(p, xrange(1000))) >> >>[0, 1] > > thanks. that is what I am doing now, in a more generic form : > > takewhile(p, (x for x in xrange(1))) How does a useless generator expression make it more generic? -- http://mail

Re: output question 1

2005-11-10 Thread Simon Brunning
On 10/11/05, leewang kim <[EMAIL PROTECTED]> wrote: > I wrote the following code and got the output: > a 13 0 > None > b 81 3 (snip) > where are those 'none' from? and how can I remove them? > > class Point: > def __init__(self,x,y,name): > self.x = x > self.y = y > se

Re: append to non-existing list

2005-11-10 Thread [EMAIL PROTECTED]
Yves Glodt wrote: > I need this (invalid example-html follows): > > > title of page > > > import time > > print "Hello, today is: %s" % (time.ctime()) > > ?> > > Cheetah template ? But I like Kid better as I don't want python in HTML, Kid IMO strikes the balance between python feature and XHTM

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Leif K-Brooks wrote: > [EMAIL PROTECTED] wrote: > > George Sakkis wrote: > > > >list(takewhile(p, xrange(1000))) > >> > >>[0, 1] > > > > thanks. that is what I am doing now, in a more generic form : > > > > takewhile(p, (x for x in xrange(1))) > > How does a useless generator expre

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > How does a useless generator expression make it more generic? > > xrange is only picked as an example. I may be newbie on python but not > that dumb if all I want is a list of integer(sorted) that meets certain > criteria. > > takewhile(p, (x fo

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > How does a useless generator expression make it more generic? > > > > xrange is only picked as an example. I may be newbie on python but not > > that dumb if all I want is a list of integer(sorted) that meets certain > > cri

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > Leif K-Brooks wrote: > >>[EMAIL PROTECTED] wrote: >> >>>thanks. that is what I am doing now, in a more generic form : >>> >>>takewhile(p, (x for x in xrange(1))) >> >>How does a useless generator expression make it more generic? > > xrange is only picked as an e

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
I use "list" in the name in "english"/general sense(say a list in haskell is lazily evaluated), it could be a list or it could be a lazily evaluated iterable. The original post is really just about "when" or may be "until" syntax that makes it a bit shorter to read and hopefuly easier to understan

Re: how to modify code while debugging it without having to stop and then restart debugger

2005-11-10 Thread Ed Singleton
I used Visual Basic a long time in the past and I know what you mean. The ability to step through code line by line was very useful in a language where you often didn't know what was happening. I particularly loved the ability to hover the mouse over any variable or expression and see the value a

Re: Looking Python script to compare two files

2005-11-10 Thread David Boddie
Tim Golden wrote: > + PDF: David Boddie's pdftools looks like about the only possibility: > (ducks as a thousand people jump on him and point out the alternatives) I might as well do that! Here are a couple of alternatives: http://www.sourceforge.net/projects/pdfplayground http://www.adaptive-en

Script to export MySQL tables to csv

2005-11-10 Thread Jandre
To anyone that can help I have 2 MySQL databases that contain large amounts of tables. I need to be able to compare the data in the tables with older/newer versions of the tables. I figured the easiest way would be to get the info in csv format and then run a comparison. I can get all the data usi

iterate over class variables

2005-11-10 Thread Yves Glodt
Hello list, I need to iterate over a class and get all her variable names and values, e.g. considering this example: class testclass: var1 = 'ab' var2 = 'cd' var3 = 'ef' test = testclass() Then I wanna do sonmething like this: for name,value in test: print n

Re: iterate over class variables

2005-11-10 Thread Yves Glodt
Yves Glodt wrote: > Hello list, > > I need to iterate over a class and get all her variable names and > values, e.g. considering this example: > > > class testclass: > var1 = 'ab' > var2 = 'cd' > var3 = 'ef' > > test = testclass() > > > > Then I wanna do sonmething like th

Re: iterate over class variables

2005-11-10 Thread Yves Glodt
Yves Glodt wrote: > Yves Glodt wrote: >> Hello list, >> >> I need to iterate over a class and get all her variable names and >> values, e.g. considering this example: >> >> >> class testclass: >> var1 = 'ab' >> var2 = 'cd' >> var3 = 'ef' >> >> test = testclass() >> >> >> >> Then I w

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Alex Martelli wrote: > >>This becomes a valid list comprehension by writing 'if' instead of >>'when'. > > valid, yes. efficient, I am not sure. > > [ x for x in xrange(1000) if p(x) ] > > means I need to go through the whole range even if p = lambda x: x < 2. If

Re: iterate over class variables

2005-11-10 Thread Daniel Evers
Hi! You can iterate over the internal dictionary: >>> class Test: ... def __init__(self): ... self.x = 5 ... self.y = 6 ... self.z = "Hallo" ... >>> x = Test() >>> print x.__dict__ {'y': 6, 'x': 5, 'z': 'Hallo'} >>> for key, value in x.__dict__.items(): ..

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-10 Thread Nick Craig-Wood
I tested gmpy cvs as of now on Debian/testing/x86 with python2.3. It compiled perfectly, ran all of its unit tests and also all my test programs - Well done! My test program seemed to run at the same speed with both versions (not suprising really since both are using the same libgmp.so on the syst

Re: Python obfuscation

2005-11-10 Thread yepp
The Eternal Squire wrote: > > 1) The decrypted modules should only reside in RAM, never in virtual > memory. Those RAM locations should be rendered inaccessible to Python > code. I'm starting to understand why FOSS developers are said to be productive above the average: they don't have to mess

Re: iterate over class variables

2005-11-10 Thread bruno at modulix
Yves Glodt wrote: > Yves Glodt wrote: > >> Hello list, >> >> I need to iterate over a class and get all her variable names and >> values, e.g. considering this example: >> >> >> class testclass: >> var1 = 'ab' >> var2 = 'cd' >> var3 = 'ef' Take care, these are *class* variables, not i

Re: Script to export MySQL tables to csv

2005-11-10 Thread Steve Holden
Jandre wrote: > To anyone that can help > > I have 2 MySQL databases that contain large amounts of tables. I need > to be able to compare the data in the tables with older/newer versions > of the tables. I figured the easiest way would be to get the info in > csv format and then run a comparison.

Re: getting results into one variable

2005-11-10 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > hi (snip) > > in python, can we do something like > > a = db.execute(stmt) and then expand variable 'a' > instead of doing > (a,b) = db.execute(stmt) for return of 2 > (a,b,c) = for return of 3 > (a,b,c,d) for return of 4 Did you try ?-) Took me about 30'': >>> def

Re: Python as a HTTP Client

2005-11-10 Thread Fuzzyman
``urllib2`` is the standard library module you need. I've written a guide to using it (although it's very easy - but some attributes of the errors it can raise aren't documented) : http://www.voidspace.org.uk/python/articles/urllib2.shtml All the best, Fuzzyman http://www.voidspace.org.uk/p

Re: Looking Python script to compare two files

2005-11-10 Thread david
Thanks for the quick replies! So if I want to use these tools: antiword,pdf2text, can I pack these tools and python script into a windows EXE file? I know there is open source tool which can pack python script and libs and generate the windows EXE file. Yes, this approach can't handle the picture

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Peter Hansen wrote: > (I say "readable or somehow better" since you stated in another post "I > just try to use list/generator expression when possible" but you didn't > explain your reason for doing so. I assume you have some reason other > than arbitrary whim.) The reason is simple: I found it

Python as a HTTP Client

2005-11-10 Thread [EMAIL PROTECTED]
I am writing a program that has to do some lightweight HTTP communication with a webserver on the internet. I haven't checked, but I'm sure I could do something lowlevel like opening a socket myself and then send/receive everything myself on this (how do I do that?), but I'd bet that Python have so

Re: iterate over class variables

2005-11-10 Thread Peter Hansen
Yves Glodt wrote: > I need to iterate over a class and get all her variable names and > values, e.g. considering this example: > > class testclass: > var1 = 'ab' > var2 = 'cd' > var3 = 'ef' Is the following of any help to you? >>> class testclass: ... a = 'a' ... >>> dir(testcla

Problem connecting to SQL Server2000 using SQLRelay in Python

2005-11-10 Thread bharat
Hi, I want to connect to SQL Server 2000 at remote site in python using SQLRelay at local machine. When i run my query, the following message comes: Debugging to:/usr/local/firstworks/var/sqlrelay/debug/sqlr-listener.11639 and then no result is displayed. The above file contains: 11/10/2005

Re: Python as a HTTP Client

2005-11-10 Thread Fredrik Lundh
"[EMAIL PROTECTED]" wrote: >I am writing a program that has to do some lightweight HTTP > communication with a webserver on the internet. I haven't checked, but > I'm sure I could do something lowlevel like opening a socket myself and > then send/receive everything myself on this (how do I do that

Re: What do you use as symbols for Python ?

2005-11-10 Thread bruno at modulix
Pierre Barbier de Reuille wrote: > When you need some symbols in your program, what do you use in Python ? > > For example, an object get a state. This state is more readable if > expressed as a symbols, for example "opened", "closed", "error". > Typically, in C or C++, I would use an enum for tha

Python as a HTTP Client

2005-11-10 Thread [EMAIL PROTECTED]
I am writing a program that has to do some lightweight HTTP communication with a webserver on the internet. I haven't checked, but I'm sure I could do something lowlevel like opening a socket myself and then send/receive everything myself on this (how do I do that?), but I'd bet that Python have so

Re: What do you use as symbols for Python ?

2005-11-10 Thread Antoon Pardon
Op 2005-11-10, Pierre Barbier de Reuille schreef <[EMAIL PROTECTED]>: > When you need some symbols in your program, what do you use in Python ? > > For example, an object get a state. This state is more readable if > expressed as a symbols, for example "opened", "closed", "error". > Typically, in C

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread LB
Sorry, I can only obtain a windows with caption: "VRML Console" and text: [ Info] Unable to open input file: http://www.mired.org/downloads/P(x)-0.2.tar.gz [ Info] Compilation error: Unrecognized header string ? LB -- http://mail.python.org/mailman/listinfo/python-list

Re: Newb ??

2005-11-10 Thread Norman Silverstone
< snip> > I assume the way the computer is going to guess is by trying some > number, and you respond either that it's guessed right, or to go lower, > or to go higher. Yes, that is correct. > > In that case, think of "bisection". Originally, all the computer knows > is that the number is in s

Re: web interface

2005-11-10 Thread Michele Simionato
I have been looking for an example like this for a while, so thanks to J.P. Calderone. Unfortunately, this kind of solution is pretty much browser-dependent. For instance, I tried it and it worked with Firefox, but not with MSIE 5.01 and it will not work with any browser if you disable Javascript

Re: how to modify code while debugging it without having to stop and then restart debugger

2005-11-10 Thread Steven D'Aprano
On Wed, 09 Nov 2005 18:04:02 +, Steve Holden wrote: >>>how can such a dynamic language like python not be able to do this. >> >> >> Do you try to ignore the syntax and grammar of the programming language >> you are coding in too, or only English? >> > That's rather unkind. I'd judge we are

Re: Script to export MySQL tables to csv

2005-11-10 Thread Larry Bates
Jandre wrote: > To anyone that can help > > I have 2 MySQL databases that contain large amounts of tables. I need > to be able to compare the data in the tables with older/newer versions > of the tables. I figured the easiest way would be to get the info in > csv format and then run a comparison.

Re: Python obfuscation

2005-11-10 Thread Steven D'Aprano
On Wed, 09 Nov 2005 15:08:15 -0500, Yu-Xi Lim wrote: > As you said, if you have some novel features, you will need obfuscation. > Copyright doesn't protect the process and patents may take a while. In > the meanwhile, good obfuscation is reasonable protection, imho. > > But I think you failed t

Confusion about __call__ and attribute lookup

2005-11-10 Thread Kent Johnson
I am learning about metaclasses and there is something that confuses me. I understand that if I define a __call__ method for a class, then instances of the class become callable using function syntax: >>> class Foo(object): ... def __call__(self): ... print 'Called Foo' ... >>> f=Foo(

Re: web interface

2005-11-10 Thread Jean-Paul Calderone
On 10 Nov 2005 05:31:29 -0800, Michele Simionato <[EMAIL PROTECTED]> wrote: > > >I have been looking for an example like this for a while, so thanks to >J.P. Calderone. >Unfortunately, this kind of solution is pretty much browser-dependent. >For instance, >I tried it and it worked with Firefox, but

python + ODBC + Oracle + MySQL - money

2005-11-10 Thread hot . favorite
Hi, I'm fairly new to Python so please pardon any dumbness on my part. I plan to write an app in Python that will run on Linux and would need to connect to Oracle and MySQL. I could use MySQLdb for MySQL and cx_oracle for Oracle, but 2 different APIs in the same app is kind of painful. So I hav

Re: iterate over class variables

2005-11-10 Thread Yves Glodt
bruno at modulix wrote: > Yves Glodt wrote: >> Yves Glodt wrote: >> >>> Hello list, >>> >>> I need to iterate over a class and get all her variable names and >>> values, e.g. considering this example: >>> >>> >>> class testclass: >>> var1 = 'ab' >>> var2 = 'cd' >>> var3 = 'ef' > > Take

Python-based Document Management System?

2005-11-10 Thread W. Borgert
Hi, I'm looking for a Python-based DMS, but I don't know any. The following points are relevant: - suitable for 10..100 users with more than 1 documents - documents are mostly proprietary formats: MS Word, MS Excel, MS PowerPoint, but maybe also: PDF, HTML, DocBook, ... - typical DMS feat

Dr. Dobb's Python-URL! - weekly Python news and links (Nov 9)

2005-11-10 Thread Cameron Laird
QOTW: "The lesson for me is to spend much less time on Python discussion and much more on unfinished projects. So even if I never use the new syntax, I will have gained something ;-)" - Terry Reedy "In short, this group is a broad church, and those readers with brains the size of planets should

Re: Python obfuscation

2005-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2005 13:35:00 +0100, yepp wrote: > The Eternal Squire wrote: > >> >> 1) The decrypted modules should only reside in RAM, never in virtual >> memory. Those RAM locations should be rendered inaccessible to Python >> code. > > I'm starting to understand why FOSS developers are said

Re: Confusion about __call__ and attribute lookup

2005-11-10 Thread Leif K-Brooks
Kent Johnson wrote: > But why doesn't Foo.__call__ shadow type.__call__? Normally an instance > attribute takes precedence over a class attribute. Is it something > special about how function call syntax is handled internally, or do all > special methods work this way, or is there something else go

Re: python + ODBC + Oracle + MySQL - money

2005-11-10 Thread rios . andy
Well having two different Databases from one app could be painful, but I think that using Python and a "Divide and Conquer" aproach might be your best GPL way of handling this. Start up a set of python Classes that just does the access to the MySQL database. Get these working, just concentrate on b

Re: Newb ??

2005-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2005 13:30:05 +, Norman Silverstone wrote: >> In that case, think of "bisection". Originally, all the computer knows >> is that the number is in some range, say 0 to 100. It can then guess >> the midpoint, 50. If it's right, yay! Otherwise: if it's told to go >> lower, then

Re: Addressing the last element of a list

2005-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2005 06:47:41 +, Donn Cave wrote: > Quoth Steven D'Aprano <[EMAIL PROTECTED]>: > ... > | So when working with ints, strs or other immutable objects, you aren't > | modifying the objects in place, you are rebinding the name to another > | object: > | > | py> spam = "a tasty meat-

Re: A Tcl/Tk programmer learns Python--any advice?

2005-11-10 Thread Svenn Are Bjerkem
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > That is a misconception. There are several really good packages for OO > in Tcl. XOTcl, [incr] Tcl, and my favorite Snit. None of which are core functions. As I stated, there is currently no OO in the core like in python. > > On top o

Re: need an example of Python numarray to C++ and back again, Boost / SWIG?

2005-11-10 Thread PL
I looked at Stefan's post - but he remarks that "Unfortunately, Blitz jealously guards its data (restricted pointers), so that it is not so easy to do the conversion in the other direction. If anyone knows an answer to this problem, I'd be glad to hear it" I've previously looked at Phillip Austin

Re: Pythonising the vim (e.g. syntax popups) -> vimpst

2005-11-10 Thread Christoph Haas
Hi, Roman et al... On Thursday 10 November 2005 00:52, Roman Roelofsen wrote: > The last 5 days I´ve been working on a code-completion/calltips plugin > for vim. It´s working pretty good but not finished yet. I will anounce > the first beta version on this mailling list. I hope during the next > w

IE Temporary Internet Files & Python

2005-11-10 Thread rtilley
A bit off-topic, but Python related. Below is a script that recursively deletes files from a directory. It works well on the two directories that I'm currently using it on: C:\Documents and Settings\user\Cookies C:\Documents and Settings\user\Temp However, I'd like to use it on this directory a

Re: IE Temporary Internet Files & Python

2005-11-10 Thread Laszlo Zsolt Nagy
>The script does not seem to work when used on Temporary Internet Files. > > Doesn't work well? What does it mean? Is there an exception raised? Les -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-10 Thread Antoon Pardon
Op 2005-11-10, Steven D'Aprano schreef <[EMAIL PROTECTED]>: > On Thu, 10 Nov 2005 06:47:41 +, Donn Cave wrote: > >> Quoth Steven D'Aprano <[EMAIL PROTECTED]>: >> ... >> | So when working with ints, strs or other immutable objects, you aren't >> | modifying the objects in place, you are rebindin

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I use "list" in the name in "english"/general sense(say a list in > haskell is lazily evaluated), it could be a list or it could be a > lazily evaluated iterable. OK, but the general point is: [x for x in ] is best written list() (x for x in

wxPython newbie question, creating "mega widgets" , and DnD

2005-11-10 Thread [EMAIL PROTECTED]
I've made the switch from tKinter to wxPython. I'm slowly trying to learn it, but I had a question - what is the appropriate object to subclass to create a "mega widget" ie A listbox with it's add/delete buttons already built in? wxPanel seems a possibility - any thoughts? A side question - why

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > takewhile(lambda x: condition(x), some_generator) is not very much > difference than(well, still more things to type) > > (x for x in some_generator when condition(x)) So use takewhile(condition, some_generator) which is LESS to type. When y

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-10 Thread Alex Martelli
Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > I tested gmpy cvs as of now on Debian/testing/x86 with python2.3. It > compiled perfectly, ran all of its unit tests and also all my test > programs - Well done! Thanks! > My test program seemed to run at the same speed with both versions > (not supri

Re: append to non-existing list

2005-11-10 Thread Steven D'Aprano
On Wed, 09 Nov 2005 20:45:52 +0100, bruno at modulix wrote: >> If the array does not exist yet, it's created. > > Which is what I don't like. It should crash. Perhaps not *crash* as such. Raise an exception perhaps. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python obfuscation

2005-11-10 Thread skip
Steven> But as a general rule, you're right. If you, the developer, Steven> don't have to think of your users as the enemy, you'd be amazed Steven> the amount of make-work you don't have to do. +1 QOTW. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: python + ODBC + Oracle + MySQL - money

2005-11-10 Thread Grig Gheorghiu
In my testing, I need to connect to Oracle, SQL Server and DB2 on various platforms. I have a base class with all the common code, and derived classes for each specific database type using specific database modules such as cxOracle, mxODBC and pyDB2. The derived classes are pretty thin, containing

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > This is the first time on this thread in which I'm glimpsing that you > mean 'when' not as in SQL (where it has just the same meaning as the > 'if' in Python's genexps/listcomps), but rather with the meaning that > any Pythonista would instinctively spell 'while'. Since AFA

Re: Addressing the last element of a list

2005-11-10 Thread Peter Otten
Antoon Pardon wrote: > Write somekind of property so that if you manipulate a.x it would > manipulate data[-1] Like that? >>> def make_prp(index): ... def get(self): return self[index] ... def set(self, value): self[index] = value ... return property(get, set) ... >>> class List(list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > So use takewhile(condition, some_generator) > > which is LESS to type. When your predicate is a function, there's no > need to wrap a lambda around it, just like there's no need to wrap an > '[x for x in' or '(x for x in' around a list/iterator. No. my predicate sometimes i

Re: Confusion about __call__ and attribute lookup

2005-11-10 Thread Kent Johnson
Leif K-Brooks wrote: > New-style classes look up special methods on the class, not on the instance: For my future reference, is this documented somewhere in the standard docs? Thanks, Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: A Tcl/Tk programmer learns Python--any advice?

2005-11-10 Thread Robert Hicks
Why does there need to be OO "in the core"? That is one thing I have never understood. If you want OO, get a package that fits your style of OO and "package require" you are off and running. That probably isn't what you would be looking at Tcl for anyway. I agree about Tk and I am actually talking

Re: A Tcl/Tk programmer learns Python--any advice?

2005-11-10 Thread Grant Edwards
On 2005-11-10, Svenn Are Bjerkem <[EMAIL PROTECTED]> wrote: > (and python can not do "set result [exec someprog << $input]" > as far as I know) I don't remember Tcl very well, but doesn't this do the same thing? result = os.popen('someprog','r').read() -- Grant Edwards gran

Re: IE Temporary Internet Files & Python

2005-11-10 Thread rtilley
Laszlo Zsolt Nagy wrote: > >> The script does not seem to work when used on Temporary Internet Files. >> > Doesn't work well? What does it mean? Is there an exception raised? > > Les > No exception. The files are not deleted. -- http://mail.python.org/mailman/listinfo/python-list

tiff tags

2005-11-10 Thread James Hu
 Hi,   Is any way to write more tags to tiff file when saved from:   im= Image.fromstring("I", datasize, newbuftemp, 'raw', 'I;16') im.save(“myfile.tif”)   the tag are: 256=(640,) 257=(512,) 258=(16,) 259=(1,) 262=(1,) 273=(110,) 278=(512,) 279=(4, '\x00\x00\n\x00')   But

Re: Addressing the last element of a list

2005-11-10 Thread Daniel Crespo
Hi Proposition 1: > data = [0, None, 2, 0] > ref = data[-1] > ref = 1 > assert data[-1] == 1 Logically, it doesn't work. Here you are assigning to ref a NEW value. That won't replace the data[-1] value. It's out of logic this proposition. While this (proposition 2): data = [0, None, 2, ["hello"]

Re: Addressing the last element of a list

2005-11-10 Thread [EMAIL PROTECTED]
This mutable/immutable object and name/variable is confusing. Daniel Crespo wrote: > Well, I hope that newcomers to Python don't confuse himselves :) > > Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: Python obfuscation

2005-11-10 Thread petantik
Alex Martelli wrote: > Anand S Bisen <[EMAIL PROTECTED]> wrote: > > > I dont know much !! But if somebody asks me this question my answer > > would be to convert some of the meat inside my programs to C/C++ and > > then provide the interface to those novel ideas to Python using swig. > > And for an

Recommendation please: forming an XML toolkit

2005-11-10 Thread jmdeschamps
I'm asking help on this topic of building a tools foundation for future XML projects because of the sheer volume of possibilities I will not have the time to check/try/test in detail. This question is a bit like the ones pertaining to 'Which web framework to use?', there is a lot of good stuff out

Re: A Tcl/Tk programmer learns Python--any advice?

2005-11-10 Thread Fredrik Lundh
Svenn Are Bjerkem wrote: > (and python can not do "set result [exec someprog << $input]" as far as > I know) execute a pro import subprocess -- http://mail.python.org/mailman/listinfo/python-list

Re: Python obfuscation

2005-11-10 Thread Ben Sizer
Alex Martelli wrote: > If you have valuable code, and > distribute it, people WILL crack it -- just check the warez sites for > experimental proof... EVERYTHING that people are really interested in > DOES get cracked, no matter what tricky machine-code the "protections" > are coded in. That is ver

Re: getting results into one variable

2005-11-10 Thread s99999999s2003
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > That's a nice email address :-) > > hi > > the database "execute" function returns a list of logical results. Each > > logical result is a list of row tuples, as explained in the documents. > > > In a DB-API-compliant module, execution of the quer

PySol --> SuSE 10.0

2005-11-10 Thread Mike T.
Hi, I'm trying to install PySol on 10.0. I've tried two routes: the RPM and building from source. First, from RPM. I su'd to root and run the following: linuxdell:/home/mike # rpm -i pysol-4.82-1.noarch.rpm error: Failed dependencies: tkinter >= 2.2 is needed by pysol-4.82-1 Checking i

Re: A Tcl/Tk programmer learns Python--any advice?

2005-11-10 Thread Fredrik Lundh
oops. > (and python can not do "set result [exec someprog << $input]" as far as > I know) execute a script inside a list comprehension and shift it to the left by a built-in function ? I suspect you want: import subprocess -- http://mail.python.org/mailman/listinfo/python-list

RE: IE Temporary Internet Files & Python

2005-11-10 Thread Tim Golden
[rtilley] > Below is a script that recursively deletes files from a directory. It > works well on the two directories that I'm currently using it on: > C:\Documents and Settings\user\Cookies > C:\Documents and Settings\user\Temp > However, I'd like to use it on this directory as well: > C:\Doc

Re: Newb ??

2005-11-10 Thread Norman Silverstone
On Fri, 11 Nov 2005 01:39:40 +1100, Steven D'Aprano wrote: > On Thu, 10 Nov 2005 13:30:05 +, Norman Silverstone wrote: > >>> In that case, think of "bisection". Originally, all the computer knows >>> is that the number is in some range, say 0 to 100. It can then guess >>> the midpoint, 50.

Re: python + ODBC + Oracle + MySQL - money

2005-11-10 Thread Gerhard Häring
Grig Gheorghiu wrote: > In my testing, I need to connect to Oracle, SQL Server and DB2 on > various platforms. I have a base class with all the common code, and > derived classes for each specific database type using specific database > modules such as cxOracle, mxODBC and pyDB2. The derived classe

  1   2   3   >