Re: Taking data from a text file to parse html page

2006-08-23 Thread Anthra Norell
DH, Could you be more specific describing what you have and what you want? You are addressing people, many of whom are good at stripping useless junk once you tell them what 'useless junk' is. Also it helps to post some of you data that you need to process and a sample of the same dat

Re: how to get file name of the running .py file

2006-08-23 Thread Fredrik Lundh
Larry Bates wrote: >> How to get the name of the running .py file like the macro _FILE_ in C? > import os > import sys > print sys.argv[0] > > or if you just want the script and not the full path > > print os.path.basename(sys.argv[0]) except that __FILE__ is the name of the current source fil

Re: sum and strings

2006-08-23 Thread Fredrik Lundh
Tim Chase wrote: > >>> q3 = q1 + q2 > >>> q3.n, q3.i, q3.j, q3.k > (8, 13, 16, 22) > >>> sum([q1,q2]) > Traceback (most recent call last): >File "", line 1, in ? > TypeError: unsupported operand type(s) for +: 'int' and 'q' > > Just because something is slow or sub-optimal doesn't mean it

Re: smtplib needs me to put from/to headers in the message?

2006-08-23 Thread Tim Roberts
tobiah <[EMAIL PROTECTED]> wrote: > >In the example at: > > http://docs.python.org/lib/SMTP-example.html > >The text of the email message ends up with the From: >and To: headers in it, and yet the call to sendmail() >on the server object requires me to specify them again. > >Shouldn't smptlib

Re: What do you want in a new web framework?

2006-08-23 Thread Cliff Wells
On Thu, 2006-08-24 at 04:04 +, Tim Roberts wrote: > Cliff Wells <[EMAIL PROTECTED]> wrote: > > > >But there are interesting things in Ruby (and Ruby 2 should take care of > >lots of warts Ruby 1.8 has) that Python could learn from. All-in-all, > >Ruby is mostly as good as Python in most ways a

Re: all ip addresses of machines in the local network

2006-08-23 Thread John Bokma
"damacy" <[EMAIL PROTECTED]> wrote: > hi, sandra. If you reply like is common on Usenet, there is no need to address someone, since the attribution line is just there: Sandra-24 wrote: ^^^ Google for top posting, and read why it's generally considered bad. > no, it's not as compli

Re: all ip addresses of machines in the local network

2006-08-23 Thread mbstevens
On Wed, 23 Aug 2006 21:46:21 -0700, damacy wrote: > hi, sandra. > > no, it's not as complicated as that. all i want to do is to load a > database onto different machines residing in the same network. i hope > there is a way doing it. or perhaps i have a poor understanding of how > networks work.

Re: all ip addresses of machines in the local network

2006-08-23 Thread John Bokma
"damacy" <[EMAIL PROTECTED]> wrote: > hi, there. i have a problem writing a program which can obtain ip > addresses of machines running in the same local network. > > say, there are 4 machines present in the network; [a], [b], [c] and [d] > and if i run my program on [a], it should be able to fin

Re: all ip addresses of machines in the local network

2006-08-23 Thread damacy
hi, sandra. no, it's not as complicated as that. all i want to do is to load a database onto different machines residing in the same network. i hope there is a way doing it. or perhaps i have a poor understanding of how networks work. regards, damacy Sandra-24 wrote: > damacy wrote: > > hi, ther

Re: Translating Javascript programs to python.

2006-08-23 Thread Vyz
Yes, this is a trimmed down version of padma, a generic indic transliteration tool Thanks for comments though. Terry Reedy wrote: > "Vyz" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Its a module to transliterate from telugu language written in roman > > script into native un

Re: how to get file name of the running .py file

2006-08-23 Thread Bill Pursell
Jason Jiang wrote: > Hi, > > How to get the name of the running .py file like the macro _FILE_ in C? There are many ways--IMO the easiest is with __file__: >>> print __file__ /home/bill/.pystart >>> [tmp]$ cat foo.py #!/usr/bin/env python print "The name of the file is:%s"%__file__ [tmp]$ ./foo

Re: all ip addresses of machines in the local network

2006-08-23 Thread Sandra-24
damacy wrote: > hi, there. i have a problem writing a program which can obtain ip > addresses of machines running in the same local network. > > say, there are 4 machines present in the network; [a], [b], [c] and [d] > and if i run my program on [a], it should be able to find "host names" > and "ip

Re: What do you want in a new web framework?

2006-08-23 Thread Tim Roberts
Cliff Wells <[EMAIL PROTECTED]> wrote: > >But there are interesting things in Ruby (and Ruby 2 should take care of >lots of warts Ruby 1.8 has) that Python could learn from. All-in-all, >Ruby is mostly as good as Python in most ways and better than Python in >a couple key ways. ...but you can't R

Re: smtplib needs me to put from/to headers in the message?

2006-08-23 Thread Tobiah
Thank you for the valuable clarification, and the pointers. I will look into the RFC's. I wonder though, whether that will solve my main question, which is why the python.org example mandates that I specify 'from' and 'to' twice. Thanks, Tobiah Ben Finney wrote: > tobiah <[EMAIL PROTECTED]> wri

all ip addresses of machines in the local network

2006-08-23 Thread damacy
hi, there. i have a problem writing a program which can obtain ip addresses of machines running in the same local network. say, there are 4 machines present in the network; [a], [b], [c] and [d] and if i run my program on [a], it should be able to find "host names" and "ip addresses" of the other

Re: Regex help...pretty please?

2006-08-23 Thread vbgunz
MooMaster Wrote: > I'm trying to develop a little script that does some string > manipulation. I have some few hundred strings that currently look like > this: > cond(a,b,c) > and I want them to look like this: > cond(c,a,b) I zoned out on your question and created a very simple flipper. Although

Can Python do Perl's print <

2006-08-23 Thread yichun . wei
Perl has the ability to do the following: print

Re: Accessing application data portably

2006-08-23 Thread Steve Holden
Tom E H wrote: > My Python application includes some data files that need to be accessed by > modules I distribute with it. > > Where can I put them, and how should I arrange my code, so that it works > across platforms? > > On Linux, I could install the data to "/usr/lib/myprogram/datafile", and

Re: Accessing application data portably

2006-08-23 Thread Steve Holden
Tom E H wrote: > My Python application includes some data files that need to be accessed by > modules I distribute with it. > > Where can I put them, and how should I arrange my code, so that it works > across platforms? > > On Linux, I could install the data to "/usr/lib/myprogram/datafile", and

Re: range of int() type.

2006-08-23 Thread Felipe Almeida Lessa
23 Aug 2006 17:28:48 -0700, KraftDiner <[EMAIL PROTECTED]>: > This is obvious... but how do I crop off the high order bits if > necessary? > a[0]&0x ? min(a[0], 0x) ? -- Felipe. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Aug 23)

2006-08-23 Thread Steve Holden
John Salerno wrote: > Jack Diederich wrote: > > >>David Wahler is no longer out of the office. >>http://groups.google.com/groups/search?q=David+Wahler+out+of+office > > > LOL. That's the best part this week! :) Can anyone remember when David Wahler got back? regards Steve -- St

Re: Translating Javascript programs to python.

2006-08-23 Thread Terry Reedy
"Vyz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Its a module to transliterate from telugu language written in roman > script into native unicode. right now its running in a browser window > at www.lekhini.org I Intend to translate it into python so that I can > integrate into

Re: how to get file name of the running .py file

2006-08-23 Thread Jason Jiang
Thank you guys. Jason "Simon Forman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Larry Bates wrote: >> Jason Jiang wrote: >> > Hi, >> > >> > How to get the name of the running .py file like the macro _FILE_ in C? >> > >> > Thanks. >> > Jason >> > >> > >> > >> import os >> impor

Re: Regex help...pretty please?

2006-08-23 Thread Paul McGuire
"MooMaster" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm trying to develop a little script that does some string > manipulation. I have some few hundred strings that currently look like > this: > > cond(a,b,c) > > and I want them to look like this: > > cond(c,a,b) Pyparsing

Re: range of int() type.

2006-08-23 Thread KraftDiner
Terry Reedy wrote: > "KraftDiner" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > So what type / class should one use to represent a 16 bit integers > > (signed or unsigned)? > > For most purposes, Python just has integers, with 'small' ones (depending > on the machine) handl

Taking data from a text file to parse html page

2006-08-23 Thread DH
Hi, I'm trying to strip the html and other useless junk from a html page.. Id like to create something like an automated text editor, where it takes the keywords from a txt file and removes them from the html page (replace the words in the html page with blank space) I'm new to python and could us

Re: setting a breakpoint in the module

2006-08-23 Thread Simon Forman
Jason Jiang wrote: > Great! It's working now. Thank you so much. > > Jason You're welcome, it's a pleasure! :-D ~Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get file name of the running .py file

2006-08-23 Thread Simon Forman
Larry Bates wrote: > Jason Jiang wrote: > > Hi, > > > > How to get the name of the running .py file like the macro _FILE_ in C? > > > > Thanks. > > Jason > > > > > > > import os > import sys > print sys.argv[0] > > or if you just want the script and not the full path > > print os.path.basename(sys.

Re: radio buttons in curses

2006-08-23 Thread Steve Holden
Fabian Braennstroem wrote: > Sorry, me again... > Does nobody have an idea or is it to stupid? > > * Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > >>Hi, >> >>I want to add some radio and check buttons to my curses >>script. As I understand it, there are no buttons in the >>'basic' curses modul

Re: Problem of function calls from map()

2006-08-23 Thread Steve Holden
Fredrik Lundh wrote: > Sion Arrowsmith wrote: > > >>>(you cannot really use "profile" to *benchmark* things written in Python >>>either; the >>>profiler tells you where a given program spends the time, not how fast it is >>>in com- >>>parision with other programs) >> >>Hmm. Playing around with

Re: smtplib needs me to put from/to headers in the message?

2006-08-23 Thread Ben Finney
tobiah <[EMAIL PROTECTED]> writes: > In the example at: > http://docs.python.org/lib/SMTP-example.html > > The text of the email message ends up with the From: and To: headers > in it, and yet the call to sendmail() on the server object requires > me to specify them again. [Pet hate issue:

Re: Accessing application data portably

2006-08-23 Thread Tom E H
Larry Bates wrote: >> Well that's great, but how do you access the ini file portably? > > From my original post: > > Then I use ConfigParser in my application... Thanks, but where in the directory structure do you put the ini file on different platforms? Presumably you have to hard-code that in

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Aug 23)

2006-08-23 Thread Georg Brandl
Jack Diederich wrote: > QOTW: "Because there's no chance that the original request is sane." - Georg > Brandl (responding to a question involving a Banana) Looks like I'm trying to fulfil my bot duties from time to time ;) > "this is one of your last chances to test the new code in 2.5 before th

Re: setting a breakpoint in the module

2006-08-23 Thread David M. Cooke
"Jason Jiang" <[EMAIL PROTECTED]> writes: > Hi, > > I have two modules: a.py and b.py. In a.py, I have a function called > aFunc(). I'm calling aFunc() from b.py (of course I import module a first). > The question is how to directly set a breakpoint in aFunc(). > > The way I'm doing now is to set

smtplib needs me to put from/to headers in the message?

2006-08-23 Thread tobiah
In the example at: http://docs.python.org/lib/SMTP-example.html The text of the email message ends up with the From: and To: headers in it, and yet the call to sendmail() on the server object requires me to specify them again. Shouldn't smptlib just make the headers for me, given the 'fr

Re: Accessing application data portably

2006-08-23 Thread Larry Bates
Tom E H wrote: > Larry Bates wrote: >> Tom E H wrote: >>> My Python application includes some data files that need to be accessed >>> by modules I distribute with it. >>> >>> Where can I put them, and how should I arrange my code, so that it works >>> across platforms? >>> >> I almost always send a

Re: how to get file name of the running .py file

2006-08-23 Thread Larry Bates
Jason Jiang wrote: > Hi, > > How to get the name of the running .py file like the macro _FILE_ in C? > > Thanks. > Jason > > > import os import sys print sys.argv[0] or if you just want the script and not the full path print os.path.basename(sys.argv[0]) -Larry Bates -- http://mail.python

how to get file name of the running .py file

2006-08-23 Thread Jason Jiang
Hi, How to get the name of the running .py file like the macro _FILE_ in C? Thanks. Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Class instantiation

2006-08-23 Thread Colin J. Williams
Fredrik Lundh wrote: > Colin J. Williams wrote: > >> In the example below, with the disassembly following that, we run into >> trouble with the line: >> self.connect(fileID, mode= 'r') # open sheet in the read mode >> >> the traceback is: >> Traceback (most recent call last): >>File

Re: range of int() type.

2006-08-23 Thread Terry Reedy
"KraftDiner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > So what type / class should one use to represent a 16 bit integers > (signed or unsigned)? For most purposes, Python just has integers, with 'small' ones (depending on the machine) handled more efficiently. For specia

Re: Python and STL efficiency

2006-08-23 Thread Neil Cerutti
On 2006-08-23, Amanjit Gill <[EMAIL PROTECTED]> wrote: > you should also include for ostream_operator. , actually. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: callable to disappear?

2006-08-23 Thread Terry Reedy
"faulkner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > what's wrong with hasattr(obj, '__call__')? I have the impression that this is not currently true for all callables . If not, this may be improved in the future. >> Antoon Pardon >> Is there a chance this will be reconsid

Re: in-memory-only file object from string

2006-08-23 Thread bobrik
> See the standard modules: StringIO and cStringIO Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to construct an email - attach a html file and send

2006-08-23 Thread a
hey larry thanks Larry Bates wrote: > a wrote: > > What is the best way to construct an email in python and also attach a > > html file > > > > the html file to be attached is not on disk, but should be dynamically > > constructed in the python script > > > > I want to attach the django debug error

Re: Translating Javascript programs to python.

2006-08-23 Thread Vyz
Its a module to transliterate from telugu language written in roman script into native unicode. right now its running in a browser window at www.lekhini.org I Intend to translate it into python so that I can integrate into other tools I have. I am able to pass arguments and get output from the scr

Re: range of int() type.

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 18:53, KraftDiner wrote: > |>> import sys > |>> sys.maxint > 2147483647 > So what type / class should one use to represent a 16 bit integers (signed or unsigned)? Plain int. If you need the overflow at 32K/64K, try: x & 0x Gabriel Genellina Softlab SRL

Re: in-memory-only file object from string

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 18:56, bobrik wrote: how to create a file object whose contents I initialize from a string and which is purely in memory? See the standard modules: StringIO and cStringIO Gabriel Genellina Softlab SRL

RE: in-memory-only file object from string

2006-08-23 Thread Caolan
Title: in-memory-only file object from string The mmap module should do what you are looking for. It allows you to store data in memory (hence the name memory map) and treat it as both a string and a file. From: [EMAIL PROTECTED] on behalf of bobrikSent: Wed 8/23/2006 2:56 PMTo: python

Re: text editor suggestion?

2006-08-23 Thread Ravi Teja
John Salerno wrote: > Ravi Teja wrote: > > > ??? > > > > In the same file, near the top. > > > > keywordclass.python=and assert break class continue def del elif \ > > else except exec finally for from global if import in is lambda None \ > > not or pass print raise return try while yield > > > >

in-memory-only file object from string

2006-08-23 Thread bobrik
Hello, how to create a file object whose contents I initialize from a string and which is purely in memory? I can make a workaround like this: filecontents = "Very interesting stuff ... " file = os.tmpfile () file.write (filecontents) file.seek (0) procedure (fileobject = file) but this creates

Re: range of int() type.

2006-08-23 Thread KraftDiner
Simon Forman wrote: > KraftDiner wrote: > > What is the range of a variable of type int() > > > > eg: > > i = int() > > print i.max() # 0x > > print i.min() # 0x > > > > is it a signed 16 bit or 32 bit or is it unsigned 16 or 32... > > I've noticed that it can be incremented into

Re: Problem with tokenize module and indents

2006-08-23 Thread Simon Forman
Tim wrote: > I ran into a problem with a script i was playing with to check code > indents and need some direction. It seems to depend on if tabsize is > set to 4 in editor and spaces and tabs indents are mixed on consecutive > lines. Works fine when editors tabsize was 8 regardless if indents ar

Re: What do you want in a new web framework?

2006-08-23 Thread Cliff Wells
On Wed, 2006-08-23 at 22:13 +0200, Peter Maas wrote: > Alex Martelli wrote: > > Indeed, it has been truthfully observed that Python's the only language > > with more web frameworks than keywords. > > > > I have already suggested to the BDFL that he can remedy this situation > > in Py3k: all he has

Re: What do you want in a new web framework?

2006-08-23 Thread Cliff Wells
On Wed, 2006-08-23 at 02:28 -0700, Paul Boddie wrote: > Cliff Wells wrote: > > No, the reason Rails is successful is due to being a decent, focused > > product with *great* marketing (screencasts, anyone?). > > Screencasts? Perhaps, like a great showman, they draw in the punters > effectively eno

Re: setting a breakpoint in the module

2006-08-23 Thread Jason Jiang
Great! It's working now. Thank you so much. Jason "Simon Forman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jason Jiang wrote: >> "Simon Forman" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > Jason Jiang wrote: >> >> Hi, >> >> >> >> I have two modules: a.p

Re: Accessing application data portably

2006-08-23 Thread Tom E H
Larry Bates wrote: > Tom E H wrote: >> My Python application includes some data files that need to be accessed >> by modules I distribute with it. >> >> Where can I put them, and how should I arrange my code, so that it works >> across platforms? >> > I almost always send along an application.ini

Re: range of int() type.

2006-08-23 Thread Simon Forman
KraftDiner wrote: > What is the range of a variable of type int() > > eg: > i = int() > print i.max() # 0x > print i.min() # 0x > > is it a signed 16 bit or 32 bit or is it unsigned 16 or 32... > I've noticed that it can be incremented into a new class of type > long... |>> import

Problem with tokenize module and indents

2006-08-23 Thread Tim
I ran into a problem with a script i was playing with to check code indents and need some direction. It seems to depend on if tabsize is set to 4 in editor and spaces and tabs indents are mixed on consecutive lines. Works fine when editors tabsize was 8 regardless if indents are mixed. Below

Re: setting a breakpoint in the module

2006-08-23 Thread Simon Forman
Jason Jiang wrote: > "Simon Forman" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Jason Jiang wrote: > >> Hi, > >> > >> I have two modules: a.py and b.py. In a.py, I have a function called > >> aFunc(). I'm calling aFunc() from b.py (of course I import module a > >> first). > >>

range of int() type.

2006-08-23 Thread KraftDiner
What is the range of a variable of type int() eg: i = int() print i.max() # 0x print i.min() # 0x is it a signed 16 bit or 32 bit or is it unsigned 16 or 32... I've noticed that it can be incremented into a new class of type long... -- http://mail.python.org/mailman/listinfo/py

Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote: > Great to know that my model of how the world works is still correct! > (at least in relation to Python and C++!) :) So please explain my results. I loop the same number of times. -- blog: http://www.akropolix.net/rik0/blogs | Uccidete i filosofi, site: http://

Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote: > I have to admit to a stupid mistake, for which I feel quite ashamed - I > got the loop-size wrong in the Python code. So all Python results > posted by me were off by a factor of 10 :-( > I feel quite bad about that! Well, this makes *my* results

Re: sum and strings

2006-08-23 Thread Tim Chase
> Maybe he's just insisting on the principle of least surprise? > Personally, I'd rather expect sum() to work for strings and Python to > issue a warning instead of raising a type error. That warning might > also be appropriate when using sum() on other builtin sequence types. In its own way, it m

Re: Python and STL efficiency

2006-08-23 Thread Amanjit Gill
> Hi, I'm learning STL and I wrote some simple code to compare the > efficiency of python and STL. Hi, you are benching heap allocations and of course heap fragmentation. this is what devpartner c++ profiler had to say: Method %in % with Called Average Real Name Method Children

Re: Best way to construct an email - attach a html file and send

2006-08-23 Thread Larry Bates
a wrote: > where is the link > thanks a lot for your kind help > Larry Bates wrote: >> a wrote: >>> What is the best way to construct an email in python and also attach a >>> html file >>> >>> the html file to be attached is not on disk, but should be dynamically >>> constructed in the python scrip

Re: setting a breakpoint in the module

2006-08-23 Thread Jason Jiang
I'm using Python pdb module pdb.py. "Simon Forman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jason Jiang wrote: >> Hi, >> >> I have two modules: a.py and b.py. In a.py, I have a function called >> aFunc(). I'm calling aFunc() from b.py (of course I import module a >> first).

Re: CONSTRUCT - Module Attributes and Execution Environment

2006-08-23 Thread Larry Bates
Georg Brandl wrote: > Larry Bates wrote: >> lazaridis_com wrote: >>> I would like to change the construct: >>> >>> if __name__ == '__main__': >>> >>> to something like: >>> >>> if exec.isMain(): >>> >>> My (OO thought) is to place a class in an separate code module and to >>> instantiate an singlet

Re: setting a breakpoint in the module

2006-08-23 Thread Simon Forman
Jason Jiang wrote: > Hi, > > I have two modules: a.py and b.py. In a.py, I have a function called > aFunc(). I'm calling aFunc() from b.py (of course I import module a first). > The question is how to directly set a breakpoint in aFunc(). > > The way I'm doing now is to set a breakpoint in b.py at

Re: Accessing application data portably

2006-08-23 Thread Larry Bates
Tom E H wrote: > My Python application includes some data files that need to be accessed by > modules I distribute with it. > > Where can I put them, and how should I arrange my code, so that it works > across platforms? > > On Linux, I could install the data to "/usr/lib/myprogram/datafile", and

Re: Regex help...pretty please?

2006-08-23 Thread Simon Forman
MooMaster wrote: > I'm trying to develop a little script that does some string > manipulation. I have some few hundred strings that currently look like > this: > > cond(a,b,c) > > and I want them to look like this: > > cond(c,a,b) > > but it gets a little more complicated because the conds themselv

Re: Python and STL efficiency

2006-08-23 Thread Amanjit Gill
> I was using VC++.net and IDLE, respectively. I had expected C++ to be > way faster. However, while the python code gave the result almost - This code runs amortized 100ms on my machien (vc.net 2003 pro, dinkumware stl, p4m 2.2GHz thinkpad, windows 2003 server), (10 loops in 1000ms) - with STLPo

Re: How to download a web page just like a web browser do ?

2006-08-23 Thread Andre Meyer
You get websucker.py in the standard Python installation. On Win look at C:\Python24\Tools\webchecker or similar.regardsAndre -- http://mail.python.org/mailman/listinfo/python-list

Re: sum and strings

2006-08-23 Thread neophyte
Fredrik Lundh wrote: > do you often write programs that "sums" various kinds of data types, and > for which performance issues are irrelevant? > > or are you just stuck in a "I have this idea" loop? Maybe he's just insisting on the principle of least surprise? Personally, I'd rather expect sum() t

Re: Help don't know what problem is Newbie

2006-08-23 Thread Peter Otten
len wrote: > Have the following code: Short variable names increase the likelihood of name clashes: > c = db.cursor() > c = '' > c = csz[0] > c = csz[0] + ' ' + csz[1] > c.execute("insert into Producer \ > (Producer_Sid,

Re: What do you want in a new web framework?

2006-08-23 Thread Peter Maas
Alex Martelli wrote: > Indeed, it has been truthfully observed that Python's the only language > with more web frameworks than keywords. > > I have already suggested to the BDFL that he can remedy this situation > in Py3k: all he has to do, of course, is to add a LOT more keywords. Here is anothe

Help don't know what problem is Newbie

2006-08-23 Thread len
Have the following code: import os import csv import re import mx.ODBC import mx.ODBC.Windows currdir = os.getcwd() db = mx.ODBC.Windows.DriverConnect('dsn=UICPS Test') c = db.cursor() sid = 315 matchstr = re.compile(r'\(*\)*-*,*') reader = csv.reader(open(currdir + r'\\IBI Brokers List 8-21-06.

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Aug 23)

2006-08-23 Thread John Salerno
Jack Diederich wrote: > David Wahler is no longer out of the office. > http://groups.google.com/groups/search?q=David+Wahler+out+of+office LOL. That's the best part this week! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python-like C++ library

2006-08-23 Thread Simon Forman
Will McGugan wrote: > Hi folks, > > I'm forced to use C++ and STL at work, and consequently miss the ease > of use of Python. I was wondering if there was a C++ library that > implemented the fundamental objects of Python as close as possible, > perhaps using STL underneath the hood. > > Too clarif

setting a breakpoint in the module

2006-08-23 Thread Jason Jiang
Hi, I have two modules: a.py and b.py. In a.py, I have a function called aFunc(). I'm calling aFunc() from b.py (of course I import module a first). The question is how to directly set a breakpoint in aFunc(). The way I'm doing now is to set a breakpoint in b.py at the line to call aFunc(), 'c' t

Re: Class instantiation

2006-08-23 Thread Fredrik Lundh
Colin J. Williams wrote: > In the example below, with the disassembly following that, we run into > trouble with the line: > self.connect(fileID, mode= 'r') # open sheet in the read mode > > the traceback is: > Traceback (most recent call last): >File "C:\Documents and Settings\cjw

Re: Class instantiation

2006-08-23 Thread Paul McNett
Colin J. Williams wrote: > class arSpread(object): >def __init__(self, fileId= None, ar= None): > if fileId: >if ar is not None: > print fileId > self.connect(fileID, mode= 'r') # open sheet in the read mode >else: > self.connect(fileID, mod

Re: Class instantiation

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 16:21, Colin J. Williams wrote: In the example below, with the disassembly following that, we run into trouble with the line: NameError: global name 'fileID' is not defined At line 26, location 31, why is LOAD_GLOBAL generated for fileId, when LOAD_FAST has done the job a

Re: running windows 'start' cmd using spawnl

2006-08-23 Thread Michel Claveau
Hi! You can use (exemple) : "cmd /cSTART notepad" -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

setting a breakpoint in the function of my module

2006-08-23 Thread Jason Jiang
Hi, I have two modules: a.py and b.py. In a.py, I have a function called aFunc(). I'm calling aFunc() from b.py (of course I import module a first). The question is how to directly set a breakpoint in aFunc(). The way I'm doing now is to set a breakpoint in b.py at the line to call aFunc(), 'c

Re: swapping numeric items in a list

2006-08-23 Thread Jiang Nutao
Thanks. But the thing I need to swap is [0x12, 0x34, 0x56, 0x78], not [0x1234, 0x5678]. - Original Message - From: "Gabriel Genellina" <[EMAIL PROTECTED]> To: "Jiang Nutao" <[EMAIL PROTECTED]> Cc: "Gabriel Genellina" <[EMAIL PROTECTED]>; Sent: Wednesday, August 23, 2006 12:19 PM Subject

Class instantiation

2006-08-23 Thread Colin J. Williams
In the example below, with the disassembly following that, we run into trouble with the line: self.connect(fileID, mode= 'r') # open sheet in the read mode the traceback is: Traceback (most recent call last): File "C:\Documents and Settings\cjw\My Documents\OODev\tArray.py", line 26

Re: swapping numeric items in a list

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 15:32, Jiang Nutao wrote: This is what I got in the debugger: (Pdb) aa=array('b', [126, 55, 71, 112]) (Pdb) aa array('b', [126, 55, 71, 112]) (Pdb) aa.byteswap() (Pdb) aa array('b', [126, 55, 71, 112]) Oh, sorry, to swap by two bytes "H" was the right typecode. But your

Re: Regex help...pretty please?

2006-08-23 Thread Tim Chase
> cond(a,b,c) > > and I want them to look like this: > > cond(c,a,b) > > but it gets a little more complicated because the conds themselves may > have conds within, like the following: > > cond(0,cond(c,cond(e,cond(g,h,(ahttp://mail.python.org/mailman/listinfo/python-list

Re: swapping numeric items in a list

2006-08-23 Thread Fredrik Lundh
Jiang Nutao wrote: > array.byteswap() won't work for me easily. I tried this before my 1st post. > I defined > > aa = array('H', [0x12, 0x34, 0x56, 0x78]) > > Then did byteswap aa.byteswap(). The result was > > array('H', [0x1200, 0x3400, 0x5600, 0x7800]) > > You can see it byteswappe

Re: Python + Java Integration

2006-08-23 Thread Fredrik Lundh
Ben Sizer wrote: > Java itself never deserved to be the 'next' anything anyway. I've had a lot of developers come up to me and say, "I haven't had this much fun in a long time. It sure beats writing Cobol" -- James Gosling -- http://mail.python.org/mailman/listinfo/python-list

Dr. Dobb's Python-URL! - weekly Python news and links (Aug 23)

2006-08-23 Thread Jack Diederich
QOTW: "Because there's no chance that the original request is sane." - Georg Brandl (responding to a question involving a Banana) "this is one of your last chances to test the new code in 2.5 before the final release. *Please* try this release out and let us know about any problems you find" - An

Re: how do you get the name of a dictionary?

2006-08-23 Thread Fredrik Lundh
Steve Holden wrote: > Right. Plus it's fun to imagine the effbot hitting itself as hard as > some people would obviously have liked to hit it in the past :-) you mean the guy who's spent the last six months downrating every single post I've made on this list over at googlegroups ? I'd say it's

Re: running windows 'start' cmd using spawnl

2006-08-23 Thread Fredrik Lundh
Tor Erik wrote: > I need to start a program in a new cmd-window. To do this I need to > execute: start [command] > With os.system this is straight-forward. > But I need to do it with spawnl and P_NOWAIT. I.e, asynchronously. > The problem is that I need to know the path where start resides, > whi

Re: how do you get the name of a dictionary?

2006-08-23 Thread Fredrik Lundh
jojoba wrote: >> the fact that despite all attempts to explain how things work, you're >> still haven't realized that if you want the names of things, you should >> pass *namespaces* to your object viewer, not individual objects. > > And what im saying is that isnt it silly that we need pass an e

Regex help...pretty please?

2006-08-23 Thread MooMaster
I'm trying to develop a little script that does some string manipulation. I have some few hundred strings that currently look like this: cond(a,b,c) and I want them to look like this: cond(c,a,b) but it gets a little more complicated because the conds themselves may have conds within, like the

Re: swapping numeric items in a list

2006-08-23 Thread Jiang Nutao
This is what I got in the debugger: (Pdb) aa=array('b', [126, 55, 71, 112]) (Pdb) aa array('b', [126, 55, 71, 112]) (Pdb) aa.byteswap() (Pdb) aa array('b', [126, 55, 71, 112]) - Original Message - From: "Gabriel Genellina" <[EMAIL PROTECTED]> To: "Jiang Nutao" <[EMAIL PROTECTED]> Cc: Se

Re: swapping numeric items in a list

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 14:44, Jiang Nutao wrote: array.byteswap() won't work for me easily. I tried this before my 1st post. I defined aa = array('H', [0x12, 0x34, 0x56, 0x78]) Then did byteswap aa.byteswap(). The result was array('H', [0x1200, 0x3400, 0x5600, 0x7800]) You can see it

Re: running windows 'start' cmd using spawnl

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 14:22, Tor Erik wrote: I need to start a program in a new cmd-window. To do this I need to execute: start [command] With os.system this is straight-forward. But I need to do it with spawnl and P_NOWAIT. I.e, asynchronously. The problem is that I need to know the path where

Re: callable to disappear?

2006-08-23 Thread faulkner
what's wrong with hasattr(obj, '__call__')? Antoon Pardon wrote: > I have been reading http://www.python.org/dev/peps/pep-3100/ > en there is written: > > To be removed: > ... > > callable(): just call the object and catch the exception > > ... > > But that doesn't seem to be a ge

Re: swapping numeric items in a list

2006-08-23 Thread Jiang Nutao
Thank you all guys for the help. Guess I'm gonna pick bearophile's way. It's fast, neat, and easy to read. array.byteswap() won't work for me easily. I tried this before my 1st post. I defined aa = array('H', [0x12, 0x34, 0x56, 0x78]) Then did byteswap aa.byteswap(). The result was ar

  1   2   >