Re: Weekly Python Patch/Bug Summary

2007-03-16 Thread Dick Moores
May I ask a dumb question here? It isn't clear to me what to do with these patches. For most of them there is something like, "Committed as r54386 and r54387". I'm familiar with updating the editor Ulipad to the latest revision, using software such as TortoiseSVN and RapidSVN. Is that what is mea

Re: Mastering Python

2007-03-16 Thread Paul Rubin
John Nagle <[EMAIL PROTECTED]> writes: > Execution model: dynamic stack-type interpreter. Erm, the iterator protocol makes the above a little more complicated. > Biggest headache is finding out what doesn't work in the libraries. Good observation. -- http://mail.python.org/mailman/lis

Re: Mastering Python

2007-03-16 Thread John Nagle
Alex Martelli wrote: > Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > >>>need to catch up quickly and master Python programming.How do you >> >>Mastery and quickly are opposing terms Took me 15 years on a job >>using FORTRAN 77 and I still wouldn't have called myself a master. (I'm >>more of a

Generating HTML containing XML in an INPUT tag

2007-03-16 Thread bendorge
Hi there, Using Python, I'm auto-generating an HTML file that contains: , where XXX is XML data (encoded somehow). Articles regarding unicode are making my head spin! Is there a way to encode XML file contents to a hexadecimal string that could be decoded on a PHP server? I have an XML file that

[no subject]

2007-03-16 Thread Milton Segura
Hello, I'm trying to exclude files from a list using the following code: for item in dirs:if item.find('Software') > -1:dirs.remove(item) elif item.find('Images') > -1:dirs.remove(item) let's supose dirs = ['C:\Images', 'C:\Images\2006', 'C:\Images\2007', 'C:\Music', 'C

Re: Finding the insertion point in a list

2007-03-16 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > or even > > len(filter(lambda t, y=y: y>t, x)) How about min(i for i,t in enumerate(x) if t >= y) or max(i for i,t in enumerate(x) if t <= y) Those are actually pretty direct. -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the insertion point in a list

2007-03-16 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > (1) It's wrong. That always returns the length of the list. Perhaps you > meant something like this? > len(["anything will do" for t in x if y > t]) Yeah, that's what I meant. -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the insertion point in a list

2007-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2007 18:17:08 -0800, Paul Rubin wrote: > [EMAIL PROTECTED] writes: >> Or with a generator comprehension >> n = sum ( y>x[i] for i in range(len(x)) ) - 1 >> >> But there has to be a cleaner way, as the first approach is unwieldy >> and does not adapt to changing list lengths, and

Re: mySQLdb versus platform problem

2007-03-16 Thread John Nagle
Robin Becker wrote: > John Nagle wrote: > >> Try: >> >> db=MySQLdb.connect(host='appx',db='sc_0',user='user',passwd='secret', >> use_unicode=True, charset = "utf8") >> >> The distinction is that "use_unicode" tells Python to convert to Unicode, >> but Python doesn't know the MySQL table ty

Odd error

2007-03-16 Thread [EMAIL PROTECTED]
I'm trying to use a script that I originally wrote on a Mac Classic machine and have moved to a Windows XP machine. I can open the script and edit the thing, but when I try to run it in I get: Exception in Tkinter callback Traceback (most recent call last): File "C:\Python25\lib\lib-tk\Tkinter.p

Re: Returning other instance from __init__

2007-03-16 Thread Steven D'Aprano
On Thu, 15 Mar 2007 04:33:01 +, Paulo da Silva wrote: > I would like to implement something like this: > > class C1: > def __init__(self,xxx): > if ... : > self.foo = foo > self.bar = bar > else: >

Weekly Python Patch/Bug Summary

2007-03-16 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 342 open (-38) / 3712 closed (+54) / 4054 total (+16) Bugs: 951 open (-14) / 6588 closed (+33) / 7539 total (+19) RFE : 257 open (-15) / 266 closed (+13) / 523 total ( -2) New / Reopened Patches __ ftp.pytho

Re: Mastering Python

2007-03-16 Thread Alex Martelli
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > need to catch up quickly and master Python programming.How do you > > Mastery and quickly are opposing terms Took me 15 years on a job > using FORTRAN 77 and I still wouldn't have called myself a master. (I'm > more of a JoAT) My favorite "Stars!

import error

2007-03-16 Thread Nick Burns
Hi,   Quick question. I am running python on windows xp. i want to import my own module "mymod". However, when I try to import it i get the error message "ImportError: no module named mymod".   "mymod" is located in a directory that is part of the computer's "path" env variable. Imports fine if 'my

Re: Python Eggs on Cygwin

2007-03-16 Thread [EMAIL PROTECTED]
Jason, On 3/16/07, Jason Tishler <[EMAIL PROTECTED]> wrote: > The following is a WAG... > > Does the MySQL Python module contain shared extension modules (i.e., > DLLs)? If so, are they executable? If not, then make them so (i.e., > chmod +x). I did: % unzip MySQL_foo_bar.eggs % chmod +x M

Re: Finding the insertion point in a list

2007-03-16 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Or with a generator comprehension > n = sum ( y>x[i] for i in range(len(x)) ) - 1 > > But there has to be a cleaner way, as the first approach is unwieldy > and does not adapt to changing list lengths, and the second is not > obvious to a casual reader of the code. H

Re: Mastering Python

2007-03-16 Thread cga2000
On Fri, Mar 16, 2007 at 09:27:21AM EST, BartlebyScrivener wrote: > On Mar 16, 8:39 am, "Paul McGuire" <[EMAIL PROTECTED]> wrote: > > > > Wow, are you still reading? Quit wasting time and go download a > > Python dist and get started already! > > > > I think you should extract that and spend twent

Re: Returning other instance from __init__ - I need help

2007-03-16 Thread Paulo da Silva
Paulo da Silva escreveu: > Paulo da Silva escreveu: >> Alex Martelli escreveu: >>> Paulo da Silva <[EMAIL PROTECTED]> wrote: >> >> >>> E.g.: >>> >>> class C1(object): >>> def __new__(cls, xxx): >>> if xxx: return type.__new__(cls, xxx) >>> else: return C1.load(xxx) >>>

Re: Circular Class Logic

2007-03-16 Thread greg
Paul McGuire wrote: > I always assumed that super, being added to > the language later, represented some form of improvement, but this may > not be 100% correct. It's not -- super is not a replacement for explicit inherited method calls. It does something different, and has different use cases. I

Re: Executing a list of functions

2007-03-16 Thread James Stroud
HMS Surprise wrote: > Seems to me that one should be able to put the names of several > functions in a list and then have the list executed. But it seems the > output of the functions is hidden, only their return value is visible. > Is this because the list execution is another scope? > > Thanx, >

Obtaining Webpage Source with Python

2007-03-16 Thread paul debrigida
hey bud this is ryan kaskel just wanted tuch base we have the same name little disapointed i did not come up on my google searchryan kaskel balt mdsearch parkville high school lacrosse-- http://mail.python.org/mailman/listinfo/python-list

File extension

2007-03-16 Thread Anil Kumar
Hi, Can Python Script can have different extensions like .sh etc Or Is .py is mandatory to be present as the extension for the Python Script. We have an application where the script was initially written in shell script with extension .sh. Now we are migrating this script to be run in both U

Re: Python shell on mac os x

2007-03-16 Thread 7stud
On Mar 16, 2:53 am, [EMAIL PROTECTED] wrote: > or go tohttp://pythonmac.org/packages/ > and you have python 2.5 or python 2.4.4 with readline support The download instructions seem to steer Mac users to version 2.4.4 because it has more modules available. What is the consensus on that? -- http:

Can Epydoc be used to parse eggs

2007-03-16 Thread davels
I'm trying to use epydoc (3.0beta1) to generate documentation for some packages I've installed as eggs. When I run the epydoc command "epydoc.py -v -o sqlalchemy sqlalchemy" in completes without error, but the resulting documentation is just a stub. Everything All Functions sqlalchemy.global_

Re: Executing a list of functions

2007-03-16 Thread Michel Claveau
Hi! Your code run OK for me. But, if you want "time-lag" (sorry for my english) execution, you can try this: def a(): print "this is a" def b(): print "this is b" lst = [a, b] [f() for f in lst] -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/py

Re: SQLite3, data not found

2007-03-16 Thread Jerry Hill
On 3/16/07, jim-on-linux <[EMAIL PROTECTED]> wrote: > Below, the first select produces results but, > after closing then re-opening the database the > select produces an empty list. Anyone know the > reason ?? When you first open a connection, you implicitly begin a transaction. You need to call

Re: python global variable error

2007-03-16 Thread Sönmez Kartal
Then after defining clientsock, write a print statement as "print clientsock", see what it will print, None or a object? Sönmez ANIL KARADAĞ wrote: > ok , arranged block.but program give error global name 'clientsock' is not > defined " ,.. > > 2007/3/17, Sönmez Kartal <[EMAIL PROTECTED]>: >> >

Re: SQLite3, data not found

2007-03-16 Thread jim-on-linux
from John Clark use con.commit() Thanks John, this works jim-on-linux On Friday 16 March 2007 17:55, jim-on-linux wrote: > Python help, > > I just started working with SQLite3 and ran > into this problem. > > Below, the first select produces results but, > after closing then re-opening the

Re: How to get the previous line in a file?

2007-03-16 Thread dhn
On Mar 16, 5:10 pm, [EMAIL PROTECTED] wrote: > On Mar 16, 3:51 pm, Shane Geiger <[EMAIL PROTECTED]> wrote: > > > > > lines = open('/tmp/foo.py', > > "r").read().splitlines() > > > previous_line = > > '' > > > for line in > > lines: > > > if "foo" in > > line: > > > print "found foo in t

Re: Executing a list of functions

2007-03-16 Thread 7stud
On Mar 16, 3:59 pm, "7stud" <[EMAIL PROTECTED]> wrote: > lst = [a, b] > > The () symbol causes the named function to execute, and a function > call in the code is always replaced by the function's return value. Try this: -- def a(): print "this is a" def b(): print "this is b

Re: mySQLdb versus platform problem

2007-03-16 Thread Robin Becker
John Nagle wrote: > Try: > > db=MySQLdb.connect(host='appx',db='sc_0',user='user',passwd='secret', > use_unicode=True, charset = "utf8") > > The distinction is that "use_unicode" tells Python to convert to Unicode, > but Python doesn't know the MySQL table type. 'charset="utf8"' tells >

Re: Executing a list of functions

2007-03-16 Thread 7stud
lst = [a, b] The () symbol causes the named function to execute, and a function call in the code is always replaced by the function's return value. -- http://mail.python.org/mailman/listinfo/python-list

SQLite3, data not found

2007-03-16 Thread jim-on-linux
Python help, I just started working with SQLite3 and ran into this problem. Below, the first select produces results but, after closing then re-opening the database the select produces an empty list. Anyone know the reason ?? The table seems to be empty. import sqlite3 con = sqlite3.c

Executing a list of functions

2007-03-16 Thread HMS Surprise
Seems to me that one should be able to put the names of several functions in a list and then have the list executed. But it seems the output of the functions is hidden, only their return value is visible. Is this because the list execution is another scope? Thanx, jh ~~~

Re: How to get the previous line in a file?

2007-03-16 Thread Jerry Hill
On 3/16/07, Qilong Ren <[EMAIL PROTECTED]> wrote: > I have a question. I need to do some text processing. I need to read from a > file line by line. If some line is met with some condition, the previous > line needs some modification. How to get the info of the previous line? I would do something

Re: How to get the previous line in a file?

2007-03-16 Thread Paul McGuire
On Mar 16, 3:51 pm, Shane Geiger <[EMAIL PROTECTED]> wrote: > lines = open('/tmp/foo.py', > "r").read().splitlines() > > > previous_line = > ''

Re: How to get the previous line in a file?

2007-03-16 Thread kyosohma
On Mar 16, 3:51 pm, Shane Geiger <[EMAIL PROTECTED]> wrote: > lines = open('/tmp/foo.py', > "r").read().splitlines() > > previous_line = > '' > > for line in > lines: > > if "foo" in > line: > > print "found foo in the current line. The previous line is: " > + > previous_line > >

Re: How to get the previous line in a file?

2007-03-16 Thread Qilong Ren
Hi, Shane, Thanks for fast reply. What I used is : for line in open(FILE): I don't want to store all lines in a list because sometimes the file is very large. We need to store the value of the previous line in a variable. Is that right? Thanks,Qilong - Original Message

Re: How to get the previous line in a file?

2007-03-16 Thread Shane Geiger
lines = open('/tmp/foo.py', "r").read().splitlines() previous_line = ''

Re: Finding the insertion point in a list

2007-03-16 Thread tobiaskk
Or like this: x = [0, 100, 200, 1000] y = 435 for n, i in enumerate(x): if y < i: n = n - 1 break x.insert(n + 1, y) If you decide to stick with n = sum ( y>x[i] for i in range(len(x)) ) - 1 Replace it with:

Re: Sharing Objects in Python

2007-03-16 Thread Christoph Haas
On Friday 16 March 2007 12:41, Clement wrote: > Can a object sharable by two different python programs... If so can you > please explain... because my project needs two programs to access nearly > 45GB file Symentaniously... What kind of information is that? Can you put it into a database? Chris

How to get the previous line in a file?

2007-03-16 Thread Qilong Ren
Hi,all I am new to this list. And I am glade I am here. I have a question. I need to do some text processing. I need to read from a file line by line. If some line is met with some condition, the previous line needs some modification. How to get the info of the previous line? Thanks! Qilong

Re: Finding the insertion point in a list

2007-03-16 Thread Matimus
On Mar 16, 11:20 am, "Matimus" <[EMAIL PROTECTED]> wrote: > You might look at the bisect module (part of the standard > distribution). Here is an example: >>> from bisect import insort >>> x = [0,100,200,1000] >>> insort(x,10) >>> x [0, 10, 100, 200, 1000] -- http://mail.python.org/mailman/list

Re: Returning other instance from __init__

2007-03-16 Thread Paulo da Silva
Paulo da Silva escreveu: > Alex Martelli escreveu: >> Paulo da Silva <[EMAIL PROTECTED]> wrote: > > >> E.g.: >> >> class C1(object): >> def __new__(cls, xxx): >> if xxx: return type.__new__(cls, xxx) >> else: return C1.load(xxx) >> @staticmethod >> def load(xxx):

Re: Finding the insertion point in a list

2007-03-16 Thread 7stud
How about: --- x = [0, 100, 200, 1000] y = -1 inserted = False for i in range(len(x)): if(y <= x[i]): x.insert(i, y) inserted = True break if(not inserted): x.append(y) print x -- http://mail.python.org/mailman/listin

python global variable error

2007-03-16 Thread ANIL KARADAĞ
hi, i made a program in python but received global name error. the program code; serverhost = '127.0.0.1' serverport = 2000 BUFSIZ = 1024 addr = (serverhost,serverport) if str(sys.argv).find("-s") == -1: cs = socket(AF_INET, SOCK_STREAM,0) # create a TCP socket cs.c

Re: To count number of quadruplets with sum = 0

2007-03-16 Thread marek . rocki
My attempt uses a different approach: create two sorted arrays, n^2 elements each; and then iterate over them looking for matching elements (only one pass is required). I managed to get 58,2250612857 s on my 1,7 MHz machine. It requires numpy for decent performance, though. import numpy import tim

socket.error: (9, 'Bad file descriptor') Python 2.5

2007-03-16 Thread Brian G. Merrell
I'm getting the following trace in python 2.5: Traceback (most recent call last): File "./template_unittest.py", line 36, in zencc.start_browser(machines.zones[0].devices.get_primary_servers()[0]) File "/home/bean/code/automation/nrm-qa/trunk/brimstone/lib/zcc.py", line 221, in start_browse

Re: Finding the insertion point in a list

2007-03-16 Thread kyosohma
On Mar 16, 2:32 pm, "Paul McGuire" <[EMAIL PROTECTED]> wrote: > On Mar 16, 12:59 pm, [EMAIL PROTECTED] wrote: > > > > > I have an ordered list e.g. x = [0, 100, 200, 1000], and given any > > positive integer y, I want to determine its appropriate position in > > the list (i.e the point at which I w

Re: python noob, multiple file i/o

2007-03-16 Thread hiro
Thanks a lot for the help guys, I'm at work right now and I will go over your suggestions one by one this weekend. Being more alert now, taking a look at the examples you posted, I now see how to approach this problem. The thing with python that I'm starting to realize is that there are a million

Re: python noob, multiple file i/o

2007-03-16 Thread hiro
Thanks a lot for the help guys, I'm at work right now and I will go over your suggestions one by one this weekend. Being more alert now, taking a look at the examples you posted, I now see how to approach this problem. The thing with python that I'm starting to realize is that there are a million

Re: mySQLdb versus platform problem

2007-03-16 Thread John Nagle
Try: db=MySQLdb.connect(host='appx',db='sc_0',user='user',passwd='secret', use_unicode=True, charset = "utf8") The distinction is that "use_unicode" tells Python to convert to Unicode, but Python doesn't know the MySQL table type. 'charset="utf8"' tells MySQL to do the conversion to

Re: Finding the insertion point in a list

2007-03-16 Thread Paul McGuire
On Mar 16, 12:59 pm, [EMAIL PROTECTED] wrote: > I have an ordered list e.g. x = [0, 100, 200, 1000], and given any > positive integer y, I want to determine its appropriate position in > the list (i.e the point at which I would have to insert it in order to > keep the list sorted. I can clearly do

MySQLdb collectable memory leak

2007-03-16 Thread John Nagle
It's not big, but it's there. Just attaching to a MySQL database with MySQLdb, then closing the connection without doing anything results in some collectable garbage: gc: collectable gc: collectable gc: collectable gc: collectable gc: collectable (Python 2.4, MySQL 5, Windows 2000) (For te

Re: TypeError: 'module' object is not callable

2007-03-16 Thread 7stud
Hi, I can't find any documentation on the profile() function. But it might take a function reference as an argument and not the string you are feeding it. For instance: profile(t.printworld) Note the difference between: t.printworld t.printworld() The latter executes the function and then re

Displaying EPS in a GUI

2007-03-16 Thread virtk0s
Does anybody know of a good way to display Encapsulated Postscript images in a GUI? I'm currently using wx, but would be perfectly willing to switch to another binding to keep the program from becoming hackish. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Determining cause of termination

2007-03-16 Thread Yang
Hi all, my Python (2.4) program crashed after a couple days of running (this'll be a pain to debug, I know). I think it just...stopped running. My log files didn't show any (unusual) exceptions (I use the logging module to files and stdout/stderr piped to files). I have a feeling that the python in

Re: TypeError: 'module' object is not callable

2007-03-16 Thread kyosohma
On Mar 16, 12:42 pm, [EMAIL PROTECTED] wrote: > Hello everyone! > i have the following test code: > class temp: > def __init__(self): > self.hello = "hello world!" > def printworld(self): > print(self.hello) > t = temp() > > and i tried to call profile('t.printworld()') > >

Re: Finding the insertion point in a list

2007-03-16 Thread kyosohma
On Mar 16, 12:59 pm, [EMAIL PROTECTED] wrote: > I have an ordered list e.g. x = [0, 100, 200, 1000], and given any > positive integer y, I want to determine its appropriate position in > the list (i.e the point at which I would have to insert it in order to > keep the list sorted. I can clearly do

Re: distributing python software in jar like fashion

2007-03-16 Thread Chris Cioffi
Hi John, I don't think eggs are a flop, however the pain they are trying to solve is generally pretty minor in the Python world vs what we often see with other languages. We're starting to see some push to move more 3rd party libraries and frameworks to eggs (ie: Turbogears) and as the developer

Re: distributing python software in jar like fashion

2007-03-16 Thread Robert Kern
John Nagle wrote: > Were Python "eggs" a flop, or what? No. > We need to have one packager that everyone agrees on. > Otherwise, installs become a mess, and then you have to have > installers that handle multiple packagers. Eggs and Squisher are complementary tools. Squisher is good fo

Re: Finding the insertion point in a list

2007-03-16 Thread Matimus
You might look at the bisect module (part of the standard distribution). -- http://mail.python.org/mailman/listinfo/python-list

Finding the insertion point in a list

2007-03-16 Thread tkpmep
I have an ordered list e.g. x = [0, 100, 200, 1000], and given any positive integer y, I want to determine its appropriate position in the list (i.e the point at which I would have to insert it in order to keep the list sorted. I can clearly do this with a series of if statements: if yx[i] for i i

TypeError: 'module' object is not callable

2007-03-16 Thread randomtalk
Hello everyone! i have the following test code: class temp: def __init__(self): self.hello = "hello world!" def printworld(self): print(self.hello) t = temp() and i tried to call profile('t.printworld()') but i received the following error: Traceback (most recent call last

Python training in Barcelona, Spain?

2007-03-16 Thread xavim
Hi! I work for a company located in Barcelona, Spain, and we are looking for an on-site introductory Python training. The audience would consist of about 10 developers with Java background. The training should be taught in Spanish. Does anyone knows of a company or individual that could deliver

Re: getopt or optparse options/arguments wrapping?

2007-03-16 Thread Steven Bethard
Rocky Zhou wrote: > I wonder is there any way to make the wrapper program can wrap options > && arguments for the the subprocess/command the wrapper will > execute? by getopt or optparse module? [snip] > I need this because I now have finished a fs_backup script written in > python, it will execu

Re: Eureka moments in Python

2007-03-16 Thread Sion Arrowsmith
Paul McGuire <[EMAIL PROTECTED]> wrote: >On Mar 13, 2:16 am, Steven D'Aprano <[EMAIL PROTECTED]> >wrote: >> I'd be interested in hearing people's stories of Eureka moments in Python, >> moments where you suddenly realise that some task which seemed like it >> would be hard work was easy with Python

Re: Mastering Python

2007-03-16 Thread Diez B. Roggisch
Dennis Lee Bieber wrote: > On 16 Mar 2007 04:41:38 -0700, "Gerald" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > >> Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my >> curriculum did not include Python programming yet I see many vacancies >> for Python develope

Re: Importing

2007-03-16 Thread HMS Surprise
Thanks for posting. I continued to read and realized the instantiation was not a function call soon after I posted. Oh well... Still unsure about the best way to break up the large #start - #end section. I appreciate your answers and try to digest them more fully. Then maybe I will have a better i

Re: looking for a simple crypto library

2007-03-16 Thread Pınar Yanardağ
yep, thanx a lot ;) 2007/3/15, hg <[EMAIL PROTECTED]>: Paul Rubin wrote: > tlslite cool ! -- http://mail.python.org/mailman/listinfo/python-list -- Pınar "pinguar" Yanardağ http://pinguar.org -- http://mail.python.org/mailman/listinfo/python-list

Re: python noob, multiple file i/o

2007-03-16 Thread 7stud
On Mar 16, 9:38 am, "7stud" <[EMAIL PROTECTED]> wrote: > - > import os > > filepath = "./change_files" > > li = os.listdir(filepath) > for name in li: > fullpath = filepath + "/" + name > if os.path.isfile(fullpath): > infile = open(fullpath, 'r') > >

Re: distributing python software in jar like fashion

2007-03-16 Thread John Nagle
Were Python "eggs" a flop, or what? We need to have one packager that everyone agrees on. Otherwise, installs become a mess, and then you have to have installers that handle multiple packagers. John Nagle Gary Duzan wrote: > In article <[EMAIL PR

Re: To count number of quadruplets with sum = 0

2007-03-16 Thread Paul Rubin
Steven Bethard <[EMAIL PROTECTED]> writes: > > According to a post by Raymond Hettinger it's faster to use that > > iterator instead of `int`. > Yep. It's because the .next() method takes no arguments, while int() > takes varargs because you can do:: ... Heh, good point. Might be worth putting a

mySQLdb versus platform problem

2007-03-16 Thread Robin Becker
I am seeing different outcomes from simple requests against a common database when run from a freebsd machine and a win32 box. The test script is ### import MySQLdb, sys print sys.version print MySQLdb.__version__ db=MySQLdb.connect(host='appx',db='sc_0',user='user',passwd='s

Re: python noob, multiple file i/o

2007-03-16 Thread 7stud
The general idiom for altering lines in a file is to open the original file and write the alterations to a temp file. After you are done writing to the temp file, delete the original file, and change the temp file name to the original file name. If instead you were to read the whole file into a va

Re: To count number of quadruplets with sum = 0

2007-03-16 Thread Steven Bethard
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Paul Rubin wrote: > >> "n00m" <[EMAIL PROTECTED]> writes: >>> h = collections.defaultdict(itertools.repeat(0).next) >> Something wrong with >>h = collections.defaultdict(int) >> ? > > According to a post by Raymond Hettinger it's

UpNp messages

2007-03-16 Thread ozan SARI
I want to sendmessages to a upnp device ,and listen to it's notify messages. Can I do that with Python. Can you help me and send an example? Thanks Ozan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python shell on mac os x

2007-03-16 Thread Bert Heymans
On Mar 16, 4:08 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Bert Heymans <[EMAIL PROTECTED]> wrote: > > Hi! > > > I'm using iTerm on the mac the keymapping isn't right. On Linux and > > Windows it's really nice to be able to hit up to get the previous > > command. Does anyone know a way to get t

Re: Eureka moments in Python

2007-03-16 Thread Jarek Zgoda
Ben Finney napisał(a): >> I'd be interested in hearing people's stories of Eureka moments in >> Python, moments where you suddenly realise that some task which >> seemed like it would be hard work was easy with Python. > > I don't recall the exact context, but Python was the language that > intro

Re: war with china? a different approach?

2007-03-16 Thread Graeme Glass
Whats this got to do with python? On Jan 19, 9:34 pm, [EMAIL PROTECTED] wrote: > Coz we have fools in the govt, the downfall of the US has only been > accelerated !! > The are morons who staged 9/11 controlled demolition to kill americans > to start their idiotic war. > > Date: Sat, 21 Oct 2006 1

Re: Mastering Python

2007-03-16 Thread Jan Danielsson
Gerald wrote: > Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my > curriculum did not include Python programming yet I see many vacancies > for Python developers.I studied programming Pascal,C++ and Delphi.So I > need to catch up quickly and master Python programming.How do you > sugge

RE: Need help with apack compression code

2007-03-16 Thread Sells, Fred
try google: "python apack" found several in general, always google first; python has so many devotees that someone has generally solved most problems already. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of priya kale Sent: Thursday, March 15, 2007 11:33 PM

Re: Python COM called from VB/Delphi

2007-03-16 Thread Jorge Mazzonelli
Larry, It's been a while since I coded something in VB or Delphi because I'm mostly turn on Python ;) so please excuse me any mistakes I can make 8I don't have neither VB or Delphi installed on this computer) For Delphi to use an OLE/COM Object it requires a TypeLibrary that explains how to acc

Re: Mastering Python

2007-03-16 Thread paul
Paul McGuire schrieb: > What does Python have that C++ doesn't? > - The biggie: dynamic typing (sometimes called "duck typing"). > Dynamic typing is a huge simplifier for development: > . no variable declarations > . no method type signatures > . no interface definitions needed > . no templ

Re: Importing

2007-03-16 Thread Bruno Desthuilliers
HMS Surprise a écrit : > Greetings, > > First I will admit I am new to Python but have experience with C++ and > some Tcl/Tk. I am starting to use a tool called MaxQ that uses > jython. I have been studying Rossum's tutorial but still am unclear on > importing, What's your problem here ? > the

Re: Mastering Python

2007-03-16 Thread BartlebyScrivener
On Mar 16, 8:39 am, "Paul McGuire" <[EMAIL PROTECTED]> wrote: > > Wow, are you still reading? Quit wasting time and go download a > Python dist and get started already! > I think you should extract that and spend twenty minutes tidying it up and then publish it to the Python for Programmers page

Re: Mastering Python

2007-03-16 Thread Dave Hansen
On Mar 16, 8:39 am, "Paul McGuire" <[EMAIL PROTECTED]> wrote: [...] > Stop thinking about *how* to start and *just start*. Python is pretty Indeed. Of all the fortune cookies I've eaten over the years, I've saved (and taped to my monitor) only one fortune. It reads: Begin...the rest is easy.

Re: String formatting with fixed width

2007-03-16 Thread Alexander Eisenhuth
Thanks for your fast reply. I'm fine with your "%7.03f" solution. (negatives are not significant) Alexander Eisenhuth schrieb: > Hello alltogether, > > is it possible to format stings with fixed width of let's say 7 > character. T need a floating point with 3 chars before dot, padded with >

Re: Writing python module in C: wchar_t or Py_UNICODE?

2007-03-16 Thread Carsten Haese
On Fri, 2007-03-16 at 04:04 -0700, Yury wrote: > I am new to python and programming generally, but someday it is time > to start :) > I am writing a python module in C and have a question about multibyte > character strings in python<=>C. > I want a C function which takes a string as argument from

Re: String formatting with fixed width

2007-03-16 Thread Steve Holden
Steve Holden wrote: > Alexander Eisenhuth wrote: >> Hello alltogether, >> >> is it possible to format stings with fixed width of let's say 7 character. T >> need a floating point with 3 chars before dot, padded with ' ' and 3 chars >> after >> dot, padded with '0'. >> >> Followingh is my approac

Re: Eureka moments in Python

2007-03-16 Thread Paul McGuire
On Mar 13, 2:16 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I'd be interested in hearing people's stories of Eureka moments in Python, > moments where you suddenly realise that some task which seemed like it > would be hard work was easy with Python. > The day I wrote a CORBA method intercept

Re: Mastering Python

2007-03-16 Thread Paul McGuire
On Mar 16, 6:41 am, "Gerald" <[EMAIL PROTECTED]> wrote: > Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my > curriculum did not include Python programming yet I see many vacancies > for Python developers.I studied programming Pascal,C++ and Delphi.So I > need to catch up quickly and ma

Re: Mastering Python

2007-03-16 Thread Paul McGuire
On Mar 16, 6:41 am, "Gerald" <[EMAIL PROTECTED]> wrote: > Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my > curriculum did not include Python programming yet I see many vacancies > for Python developers.I studied programming Pascal,C++ and Delphi.So I > need to catch up quickly and ma

Re: CSV module and "fileobj"

2007-03-16 Thread Bruno Desthuilliers
Jon Clements a écrit : > Hi Group, > > If I have a CSV reader that's passed to a function, is it possible for > that function to retrieve a reference to the "fileobj" like object > that was passed to the reader's __init__? For instance, if it's using > an actual file object, then depending on the

Re: String formatting with fixed width

2007-03-16 Thread Jon Clements
On 16 Mar, 13:20, Alexander Eisenhuth <[EMAIL PROTECTED]> wrote: > Hello alltogether, > > is it possible to format stings with fixed width of let's say 7 character. T > need a floating point with 3 chars before dot, padded with ' ' and 3 chars > after > dot, padded with '0'. > > Followingh is my a

Importing

2007-03-16 Thread HMS Surprise
Greetings, First I will admit I am new to Python but have experience with C++ and some Tcl/Tk. I am starting to use a tool called MaxQ that uses jython. I have been studying Rossum's tutorial but still am unclear on importing, the use of self, and calling functions with their own name in quotes.

Re: String formatting with fixed width

2007-03-16 Thread Steve Holden
Alexander Eisenhuth wrote: > Hello alltogether, > > is it possible to format stings with fixed width of let's say 7 character. T > need a floating point with 3 chars before dot, padded with ' ' and 3 chars > after > dot, padded with '0'. > > Followingh is my approach > >>> f = 21.1 > >>> s =

Re: Mastering Python

2007-03-16 Thread Bruno Desthuilliers
Gerald a écrit : > Hi ,Im a BSc4 Maths/Computer Science student.Unfortunately my > curriculum did not include Python programming yet I see many vacancies > for Python developers.I studied programming Pascal,C++ and Delphi.So I > need to catch up quickly and master Python programming.How do you > su

Re: To count number of quadruplets with sum = 0

2007-03-16 Thread Anton Vredegoor
n00m wrote: > 62.5030784639 Maybe this one could save a few seconds, it works best when there are multiple occurrences of the same value. A. from time import time def freq(L): D = {} for x in L: D[x] = D.get(x,0)+1 return D def test(): t = time() f = fil

Re: Mastering Python

2007-03-16 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Gerald wrote: > Can you recommend websites that feature a gentle introduction to Python? If you already know programming in general, `Dive Into Python`_ might be a good starting point. And of course the tutorial in the Python documentation. _Dive Into Python: http://www.

  1   2   >