Re: Convertion of Unicode to ASCII NIGHTMARE

2006-04-03 Thread Roger Binns
"Paul Boddie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It looks like you may have Unicode objects that you're presenting to > sqlite. In any case, with earlier versions of pysqlite that I've used, > you need to connect with a special unicode_results parameter, He is using apsw

Re: Best way to create a copy of a list

2006-04-03 Thread Fredrik Lundh
Frank Millman wrote: > I have found two ways of doing it that seem to work. > > 1 - row = table[23][:] > > 2 - row = [] > row[:] = table[23] > > Are these effectively identical, or is there a subtle distinction which > I should be aware of. > > I did some timing tests, and 2 is quite a bit fa

Re: Best way to create a copy of a list

2006-04-03 Thread Rune Strand
Frank Millman wrote: > Hi all > > Assume a 2-dimensional list called 'table' - conceptually think of it > as rows and columns. > > Assume I want to create a temporary copy of a row called 'row', > allowing me to modify the contents of 'row' without modifying the > contents of 'table'. > > I used t

Best way to create a copy of a list

2006-04-03 Thread Frank Millman
Hi all Assume a 2-dimensional list called 'table' - conceptually think of it as rows and columns. Assume I want to create a temporary copy of a row called 'row', allowing me to modify the contents of 'row' without modifying the contents of 'table'. I used to fall into the newbie trap of 'row = t

Re: question about nasty regex

2006-04-03 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: >"Some people, when confronted with a problem, think ``I know, I'll use >regular expressions.'' Now they have two problems." --JWZ Regexes are good if you need a solution quickly, and you're not processing large amoun

Re: Loading a default browser under Windows

2006-04-03 Thread BartlebyScrivener
Philippe, import webbrowser webbrowser.open("http://groups.google.com/group/comp.lang.python";) rpd -- http://mail.python.org/mailman/listinfo/python-list

Re: what's going on here?

2006-04-03 Thread John Salerno
John Salerno wrote: > Ok, long story Ok, I guess I should have used a better title for the thread. I hope someone still sees this post! :) -- http://mail.python.org/mailman/listinfo/python-list

Loading a default browser under Windows

2006-04-03 Thread Philippe Martin
Hi, Is there (maybe through pywin) a way to call the default browser with a url as param ? Regards, Philippe -- http://mail.python.org/mailman/listinfo/python-list

what's going on here?

2006-04-03 Thread John Salerno
Ok, long story: I'm trying to solve level 4 of the Python Challenge. I hate to post here, but the hint forum over there is dead. Here's the link: http://www.pythonchallenge.com/pc/def/linkedlist.php Apparently you need to use a linked list to solve it, so I read up on them but I still don't und

Re: Sending C-c to Emacs

2006-04-03 Thread [EMAIL PROTECTED]
I figured out the problem, fix involves modifying one of the lines in the original program (from http://groups.google.com/group/comp.lang.python/msg/de40b36c6f0c53cc) to: raw_lflag = self.lflag & ~(termios.ICANON|termios.ECHO|termios.ISIG) (termios.ISIG was added) Lorin -- http://mail.python.o

Re: overloading constructor in python?

2006-04-03 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Alex Martelli wrote: >> I guess in python we use two idioms to cover most of the uses of >> mulltiple constructors: > > ... and classmethods. OK, _three_ idioms. Oh, and factory functions. > Among the idioms we use are the following... Nobody expects the Spanglis

Python and microsoft outlook-using com, can I interact with msoutlook?

2006-04-03 Thread brandon.mcginty
Hi All, I know that Microsoft Exchange has a com interface, CDO, but I can't seem to find one for Microsoft outlook. does anyone have code snippets for using msoutlook and python, or suggestions? I have looked on Google, and tried some code, but nothing has worked. I'm using outlook XP, and any inf

Re: overloading constructor in python?

2006-04-03 Thread Alex Martelli
Paddy <[EMAIL PROTECTED]> wrote: > I guess in python we use two idioms to cover most of the uses of > mulltiple constructors: > 1) Duck typing were for example if you do: > > class C1(object): > def __init__(self, n): > n = float(n) > > n could be an integer, a floating point number,, or

Re: MOO meets Python

2006-04-03 Thread Alex Martelli
Jonathan Ellis <[EMAIL PROTECTED]> wrote: > Aahz wrote: > > http://playsh.org/ > > http://sourceforge.net/projects/playsh > > Damn, I thought you meant MOO as in Master of Orion. Naah, "Stars!", now *that* was a worthy game! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Robert Kern
Felipe Almeida Lessa wrote: > Em Seg, 2006-04-03 às 17:20 -0700, Erik Max Francis escreveu: > >>Felipe Almeida Lessa wrote: >> >> >>>IMHO, it's strange and ugly. Besides, AFAIK everybody uses "cls" or >>>"class_", this is the first place I see "klass", so this breaks >>>consistency, too. But that'

Re: [ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Peter Hansen
Felipe Almeida Lessa wrote: > $ pwd > /usr/lib/python2.4/site-packages > $ grep -re klass . | wc -l > 274 > $ grep -re class_ . | wc -l > 897 How many of those "class_" instances are really just substrings of "__class__" and "class_name" and such? On my machine, I see a handful in the standard

Sending C-c to Emacs

2006-04-03 Thread [EMAIL PROTECTED]
Hi all, I've written a Python script with functionality similar to the Unix "script" program, which keeps a record of shell commands issued (I capture some additional stuff like timestamps). The code is borrowed largely from http://groups.google.com/group/comp.lang.python/msg/de40b36c6f0c53cc Any

Re: [ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Felipe Almeida Lessa
Em Seg, 2006-04-03 às 17:20 -0700, Erik Max Francis escreveu: > Felipe Almeida Lessa wrote: > > > IMHO, it's strange and ugly. Besides, AFAIK everybody uses "cls" or > > "class_", this is the first place I see "klass", so this breaks > > consistency, too. But that's just my opinion... > > A quick

Re: [ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Scott David Daniels
Erik Max Francis wrote: > Felipe Almeida Lessa wrote: > >> IMHO, it's strange and ugly. Besides, AFAIK everybody uses "cls" or >> "class_", this is the first place I see "klass", so this breaks >> consistency, too. But that's just my opinion... > > A quick Google Groups search indicates that `kla

Re: [ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Erik Max Francis
Felipe Almeida Lessa wrote: > IMHO, it's strange and ugly. Besides, AFAIK everybody uses "cls" or > "class_", this is the first place I see "klass", so this breaks > consistency, too. But that's just my opinion... A quick Google Groups search indicates that `klass` is more commonly mentioned tha

Re: Is pwm Python MegaWidgets viable?

2006-04-03 Thread James Stroud
Paul Watson wrote: > gregarican wrote: > >> Paul Watson wrote: >> >> >>> Does pwm run well on Python 2.4? The last release appears to be in >>> 2003. The Manning discussion forum is dead. >>> >>> Is there a better path to learning and producing tkInter apps? >>> >>> >>> Has there been any discus

Re: [ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Felipe Almeida Lessa
Em Seg, 2006-04-03 às 17:57 -0500, Robert Kern escreveu: > Felipe Almeida Lessa wrote: > > Em Ter, 2006-04-04 às 00:09 +0200, Daniel Nogradi escreveu: > > [snip] > > > >>page.ul.open( klass='mylist' ) > >>page.li( items, klass='myitem' ) > > > > [/snip] > > > > "klass"? Why not "cls" or "class_"

Re: How to debug python code?

2006-04-03 Thread james . wondrasek
I don't have an example, but what I do is insert: import pdb pdb.set_trace() before the code that I think is causing the problem (or that the traceback barfed at). Then hit 'l' (lowercase L) to get a list of the code which is being executed. Use 'p' to look at variables. eg p some_local Use 'n

Re: wxpython in action book

2006-04-03 Thread Butternut squash
Tim Roberts wrote: > Dabo Thanks for the info. I'll check out dabo. I understand that web is easier to distribute and more likely easier to program. I loath CSS and HTML though and that's why I want a fat client program. We'll see -- http://mail.python.org/mailman/listinfo/python-list

Re: Registration Code

2006-04-03 Thread Steven D'Aprano
On Mon, 03 Apr 2006 19:29:14 +0200, Math wrote: > Hello, > > I wonder if I can ask this particular question here... > I'm writing this piece of Python Software and I'm almost done...:-) > But now I want the end-user to register this software with a registration > code or perhaps something like a

Re: question about nasty regex

2006-04-03 Thread Paul Rubin
Peter <[EMAIL PROTECTED]> writes: > >> What I mean is, I want to change, e.g.: > [snip regular expressions lesson] > > > > Whoa. That is super-duper extra cool. Thank you *very* much. "Some people, when confronted with a problem, think ``I know, I'll use regular expressions.'' Now they have two p

Re: [ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Jorge Godoy
Robert Kern <[EMAIL PROTECTED]> writes: > Why not "klass"? I was going to ask the same thing but I thought it was just me being too tired to find it "ugly" or "bad choice"... :-) -- Jorge Godoy <[EMAIL PROTECTED]> "Quidquid latine dictum sit, altum sonatur." - Qualquer coisa dita em latim

Re: question about nasty regex

2006-04-03 Thread Peter
Tim Chase wrote: >> What I mean is, I want to change, e.g.: [snip regular expressions lesson] > Whoa. That is super-duper extra cool. Thank you *very* much. -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Robert Kern
Felipe Almeida Lessa wrote: > Em Ter, 2006-04-04 às 00:09 +0200, Daniel Nogradi escreveu: > [snip] > >>page.ul.open( klass='mylist' ) >>page.li( items, klass='myitem' ) > > [/snip] > > "klass"? Why not "cls" or "class_"? Why not "klass"? -- Robert Kern [EMAIL PROTECTED] "I have come to belie

Re: string building

2006-04-03 Thread John Salerno
John Salerno wrote: > Out of curiosity, is there any kind of equivalent in Python to the > StringBuilder class in C#? Here's a quick description from the .NET > documentation: > > "This class represents a string-like object whose value is a mutable > sequence of characters. The value is said to

Re: MOO meets Python

2006-04-03 Thread Robert Kern
Jonathan Ellis wrote: > Aahz wrote: > >>http://playsh.org/ >>http://sourceforge.net/projects/playsh > > Damn, I thought you meant MOO as in Master of Orion. http://www.ospace.net -- Robert Kern [EMAIL PROTECTED] "I have come to believe that the whole world is an enigma, a harmless enigma tha

Re: [ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Felipe Almeida Lessa
Em Ter, 2006-04-04 às 00:09 +0200, Daniel Nogradi escreveu: [snip] > page.ul.open( klass='mylist' ) > page.li( items, klass='myitem' ) [/snip] "klass"? Why not "cls" or "class_"? -- Felipe. -- http://mail.python.org/mailman/listinfo/python-list

[ANN] markup.py - 1.2 - an HTML/XML generator

2006-04-03 Thread Daniel Nogradi
A new release of markup.py is available at the sourceforge project page: http://sourceforge.net/projects/markup/ Markup.py is a set of classes that attempts to make it easier to generate HTML/XML from a Python program in an intuitive, light-weight, customizable and pythonic way. Full documentatio

Re: COM Server & wxPython

2006-04-03 Thread Philippe Martin
Hi, I do not know what your constraints are ... but, having been through the same thought process (because there is not VB6 _free_ calendar) ... I feel that getting to that stage _might_ justify rewriting the application in Python/wxPython (and potentially gain cross-platform compatibility in the

Re: MOO meets Python

2006-04-03 Thread Peter Hansen
Istvan Albert wrote: > Quote from the webpage: "It's a buggy bundle of Python code that, by > default, opens interfaces to your computer and makes it insecure." So it's a way of using Python to emulate the Windows operating system, for people stuck using Linux? > ... just what I was looking for

Using Python to validate XML against an XSD schema

2006-04-03 Thread ric_deez
Hi there, I have just started looking into using Python to perform some XML processing and I need to ensure that it is capable of validating against a schema file (XSD not DTD!). The research done so far seems to indicate that it has native support for validating XML against DTDs but not against

Re: can I get the index number in for x in y loop?

2006-04-03 Thread Fuzzyman
JuHui wrote: > >>> a='String' > >>> for x in a: > ... print x > ... > S > t > r > i > n > g > >>> > > can I get the index number of a in the upon loop within for x in a > loop? Although enumerate is the 'right' answer, I personally prefer : i = 0 while i < len(some_sequence): val = som

Re: Registration Code

2006-04-03 Thread Fuzzyman
Dave Mandelin wrote: > Ken Seehart wrote: > > Math wrote: > > > Hello, > > I encypted the bytecode of a few important functions with a key based on > > information required from the user. Without the key, these functions > > can't be decrypted. This is somewhat more secure than just testing the

Re: Registration Code

2006-04-03 Thread Fuzzyman
Math wrote: > P..Philippe.. > Where can I find some sample code if any? > And I'm not a professional programmer... > This is going to be hard...and my native is Dutch.. > Thanks anyway Distributing your project using py2exe probably removes the need for bytecode encryption - unless you figure

Re: overloading constructor in python?

2006-04-03 Thread Paddy
I guess in python we use two idioms to cover most of the uses of mulltiple constructors: 1) Duck typing were for example if you do: class C1(object): def __init__(self, n): n = float(n) n could be an integer, a floating point number,, or a string representing a float. 2) Default values to

readline support

2006-04-03 Thread Rares Vernica
Hi, I am trying to get readline support in python. I am working on Linux and I have the latest version from svn. After I ./configure and make I can run python, but the readline support is not there. If I do: %./configure >& out.txt %grep readline out.txt checking for readline in -lreadline...

Re: COM Server & wxPython

2006-04-03 Thread Dave Mandelin
nelson wrote: > Hi all, > i'm doing a COM server that have to expose some graphics (panels and > configuration controls), that would be embedded in an application through > OLE. I was wondering if I can do this using wxPython. Another question is > if my COM server would inherits from one of the w

Re: Registration Code

2006-04-03 Thread Dave Mandelin
Ken Seehart wrote: > Math wrote: > > Hello, > I encypted the bytecode of a few important functions with a key based on > information required from the user. Without the key, these functions > can't be decrypted. This is somewhat more secure than just testing the > key with an "if" statement since

Re: MOO meets Python

2006-04-03 Thread Jonathan Ellis
Aahz wrote: > http://playsh.org/ > http://sourceforge.net/projects/playsh Damn, I thought you meant MOO as in Master of Orion. -Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: MOO meets Python

2006-04-03 Thread Istvan Albert
Quote from the webpage: "It's a buggy bundle of Python code that, by default, opens interfaces to your computer and makes it insecure." ... just what I was looking for ... -- http://mail.python.org/mailman/listinfo/python-list

MOO meets Python

2006-04-03 Thread Aahz
http://playsh.org/ http://sourceforge.net/projects/playsh -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "Look, it's your affair if you want to play with five people, but don't go calling it doubles." --John Cleese anticipates Usenet -- http://mail.python.org/mail

Re: overloading constructor in python?

2006-04-03 Thread Jarek Zgoda
Larry Bates napisał(a): > In python it is called duck typing but you don't need separate > constructors: > > def __init__(self, c): > if isinstance(c, int): ...do stuff... > elif isinstance(c, list): ...do stuff... > elif isinstance(c, tuple): ...do stuff... > else: > . >

Re: overloading constructor in python?

2006-04-03 Thread lennart
Larry Bates wrote: [...] > In python it is called duck typing but you don't need separate > constructors: > > def __init__(self, c): > if isinstance(c, int): ...do stuff... > elif isinstance(c, list): ...do stuff... > elif isinstance(c, tuple): ...do stuff... > else: > . >

Re: Merging Objects

2006-04-03 Thread Michael Spencer
Cloudthunder wrote: > Sorry, I don't understand, how does this solve my problem? > __getattr__ and __setattr__ allow you to set up dynamic delegation e.g., class Foo(object): def __init__(self, **kw): self.__dict__.update(kw) def methFoo(self, x): return "Foo.methFoo(%

Re: overloading constructor in python?

2006-04-03 Thread Larry Bates
[EMAIL PROTECTED] wrote: > This is probably a really stupid question, but I cant seem to find a > satisfying answer by myself so here it goes. In for example java we > could create a class dummie with several constructors, say one that > takes an int, and one that takes a String as argument. In pyt

Re: Registration Code

2006-04-03 Thread Ken Seehart
Math wrote: > Hello, > > I wonder if I can ask this particular question here... > I'm writing this piece of Python Software and I'm almost done...:-) > But now I want the end-user to register this software with a > registration code or perhaps something like an evaluation demo version > which ex

overloading constructor in python?

2006-04-03 Thread lennart
This is probably a really stupid question, but I cant seem to find a satisfying answer by myself so here it goes. In for example java we could create a class dummie with several constructors, say one that takes an int, and one that takes a String as argument. In python it doesnt seem possible to h

Re: Python 2.5 licensing: stop this change

2006-04-03 Thread Steve Holden
Philippe Martin wrote: > That was nasty Steve - at least I'm ready for any kind of bad new today ;-) > Sorry ;-) regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd www.holdenweb.com Love me, love my blog holdenweb.blogspot.com --

Re: Capturing stdout without waiting for the process end

2006-04-03 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Luigi" <[EMAIL PROTECTED]> wrote: > The question is that I have a C program (by third part) that streams > the logs into the stderr and stdout devices. I need to create an > envelopment that captures the outputs and puts them in a file > generating log events (for

Re: Merging Objects

2006-04-03 Thread Cloudthunder
Sorry, I don't understand, how does this solve my problem?On 4/3/06, Jesus Rivero - (Neurogeek) <[EMAIL PROTECTED] > wrote:-BEGIN PGP SIGNED MESSAGE-Hash: SHA1>>> help(getattr) help(setattr) Regards,  Jesus Rivero - (Neurogeek)Cloudthunder wrote:> Question: how do I merge two objects? I wou

Re: Registration Code

2006-04-03 Thread Philippe Martin
Hi, Use the DES example here (DES has been cracked but is definitly secure enough for your need): http://www.amk.ca/python/writing/pycrypt/pycrypt.html Can't help you with the Dutch ;-) Philippe Math wrote: > P..Philippe.. > Where can I find some sample code if any? > And I'm not

Re: Registration Code

2006-04-03 Thread Math
P..Philippe.. Where can I find some sample code if any? And I'm not a professional programmer... This is going to be hard...and my native is Dutch.. Thanks anyway Hi, A suggestion: I would use encryption (ex: AES): Hide a secret key in your code and generate an encrypted (readable: ex 07 7B

Re: can I get the index number in for x in y loop?

2006-04-03 Thread John Hunter
> "Scott" == Scott David Daniels <[EMAIL PROTECTED]> writes: Scott> I cannot find the distance in meters between Paris and Scott> London with: for i in range(10): print i Works for me def range(x): yield '332.8 km' for i in range(10): print i ...may not be considered b

Re: String pattern matching

2006-04-03 Thread Eddie Corns
Kent Johnson <[EMAIL PROTECTED]> writes: >Eddie Corns wrote: >> If I get time I'll try to get this working in Sam Wilmott's Python pattern >> matching library. >> >> What fun! >Cool! I have to get in on the fun :-) >This program uses Sam Wilmott's library to find one solution. It is a >simple

Vacuum World version 1e-6alpha ;) released

2006-04-03 Thread Brian Blais
Hello, I am just learning Python, and my first somewhat significant project is now available at http://web.bryant.edu/~bblais/python/vac.tgz What is it? Vacuum World is a simple simulation environment used to introduce some concepts in Artificial Intelligence (Norvig,

Re: Registration Code

2006-04-03 Thread Philippe Martin
Hi, A suggestion: I would use encryption (ex: AES): Hide a secret key in your code and generate an encrypted (readable: ex 07 7B 6F ) version of the correct info (such as full release, or demo expire in ...) with that very same key. Have your software input that encrypted info (some GUI di

Re: Registration Code

2006-04-03 Thread Math
[EMAIL PROTECTED] OKAY Sybren.. How does one get the job done? -- > Math enlightened us with: >> But now I want the end-user to register this software with a >> registration code or perhaps something like an evaluation demo >> version which expires after some period of time... > > Fair

Re: Registration Code

2006-04-03 Thread Sybren Stuvel
Math enlightened us with: > But now I want the end-user to register this software with a > registration code or perhaps something like an evaluation demo > version which expires after some period of time... Fair enough. What do you want to know from us? > Is this the right place to ask or does an

Re: Merging Objects

2006-04-03 Thread Jesus Rivero - (Neurogeek)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >>> help(getattr) help(setattr) Regards, Jesus Rivero - (Neurogeek) Cloudthunder wrote: > Question: how do I merge two objects? I would like to be able to > have an instance of Foo and an instance of Boo and then be able to > add them together an

Re: String pattern matching

2006-04-03 Thread Kent Johnson
Jim Lewis wrote: > Anyone have experience with string pattern matching? > I need a fast way to match variables to strings. Example: > > string - variables > > abcaaab - xyz > abca - xy > eeabcac - vxw > > x matches abc > y matches a > z matches aab > w maches ac > v maches ee > You

Re: New Python Logo Revealed

2006-04-03 Thread El Loco
Alec Jang wrote: > I guess it is absolutely a joke. If not, there will be a disaster, and > that means ruby will rule the world. Yes, we'll become slaves, our leaders crucified, and our culture will vanish forever... -- http://mail.python.org/mailman/listinfo/python-list

Re: Capturing stdout without waiting for the process end

2006-04-03 Thread [EMAIL PROTECTED]
Diez is correct, the C program is writting to stdout, you are reading from stdout. Default bahavior in most modern Unix like systems is to buffer std out. I stumbled on this a long time ago, so I am trying to remember the details. What I think is happening here, you call the child process, it do

Re: String pattern matching

2006-04-03 Thread Kent Johnson
Eddie Corns wrote: > Off topic I know but I've been learning snobol pattern matching recently so I > thought I'd give this one a bash. Here is my effort: > > define('foo(str)') > &fullscan = 1 > '/abcaaab/abca/eeabcac/' '/' arb $ x arb $ y arb $ z '/' *x *y '/' > +

Registration Code

2006-04-03 Thread Math
Hello, I wonder if I can ask this particular question here... I'm writing this piece of Python Software and I'm almost done...:-) But now I want the end-user to register this software with a registration code or perhaps something like an evaluation demo version which expires after some period of

Re: Capturing stdout without waiting for the process end

2006-04-03 Thread Diez B. Roggisch
> fin, fout = os.popen4(arg) > > this is executed asyncronously? And how can I intercept a fout.write() > event? You don't intercept anything, you read from the child process stdin, which from your POV is a readable stream. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: string building

2006-04-03 Thread sturlamolden
John Salerno wrote: > Out of curiosity, is there any kind of equivalent in Python to the > StringBuilder class in C#? You can just append each string to a list and call "".join(list) on the list. Here is a mock-up StringBuilder class: class StringBuilder: def __init__(self): self.strlis

Re: Capturing stdout without waiting for the process end

2006-04-03 Thread Luigi
I use Linux. So, if I modify my sdtout behaviour, when I execute: fin, fout = os.popen4(arg) this is executed asyncronously? And how can I intercept a fout.write() event? The question is that I have a C program (by third part) that streams the logs into the stderr and stdout devices. I need to

Merging Objects

2006-04-03 Thread Cloudthunder
Question: how do I merge two objects? I would like to be able to have an instance of Foo and an instance of Boo and then be able to add them together and create a new object that has the methods and properties of both objects. I am going to be doing a lot of this and I don't want to have to dynamic

Re: Best IDE for Python?

2006-04-03 Thread Szabolcs Nagy
ide unification effort: http://pyxides.stani.be/ (there are some useful links and it's more recent than the python.org wiki) -- http://mail.python.org/mailman/listinfo/python-list

Re: question about nasty regex

2006-04-03 Thread Tim Chase
> What I mean is, I want to change, e.g.: > > "Doremus v. Board of Education of Hawthorne, 342 U.S. 429, 434, 72 > S. Ct. 394, 397, 96 L.Ed. 475 (1952)." > > into: > > "Doremus v. Board of Education of Hawthorne, 342 U.S. 429, 434 (1952)." > > Generally, the beginning pattern would consist of:

Re: can I get the index number in for x in y loop?

2006-04-03 Thread Scott David Daniels
JuHui wrote: > which one has best performance? > > a:for i in range(0,len(a)) > b:for x in a > c:for x,y in enumerate(a) Read up on the timeit module and figure it out for yourself. The answer will depend on the distribution of your data. > but, it seems I can't get index number with b format..

Re: binascii.a2b_binary

2006-04-03 Thread Serge Orlov
Ed Swarthout wrote: > Why is there no binascii.a2b_binary(bitstr) which returns the binary data > represented by the bit string? Like: > > >>> binascii.a2b_binary('0011001100110101') > '35' > > perl has pack("B*", "0011001100110101"); > > What is the python way to do this? to post a question on c

Re: Oserror: [Errno 20]

2006-04-03 Thread Scott David Daniels
Peter Hansen wrote: > k r fry wrote: >> Hi, I am new to this list and also programming with python. >> I have an error: oserror [errno 20] not a directory "katiescint.py" >> The piece of code causing the problem is: >> [code] >> >> for subdir in os.listdir(DATADIR): #loop through list

Re: Convertion of Unicode to ASCII NIGHTMARE

2006-04-03 Thread Paul Boddie
Oh, and it occurs to me, as I seem to have mentioned a document about PgSQL rather than pysqlite (although they both have the same principal developer), that you might need to investigate the client_encoding parameter when setting up your connection. The following message gives some information (bu

Re: Convertion of Unicode to ASCII NIGHTMARE

2006-04-03 Thread Diez B. Roggisch
> Don't. You can't. Those characters don't exist in the ASCII character set. > SQLite 3.0 deals with UTF-8 encoded SQL statements, though. That is not entirely correct - one can, if losing information is ok. The OPs code that normalized UTF-8 to NFKD, an umlaut like ä is transformed to a two-chara

Re: can I get the index number in for x in y loop?

2006-04-03 Thread JuHui
thanks a lot! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Capturing stdout without waiting for the process end

2006-04-03 Thread [EMAIL PROTECTED]
What OS are you doing this on? I had an issue similar to this and it was due to default buffering behavior of my tty's. If I recall correctly I executed a bunch of settty to eliminate the buffering behavior of stdout. The set the terminal back to it's original setting when my program was done.

Re: binascii.a2b_binary

2006-04-03 Thread Scott David Daniels
Ed Swarthout wrote: > Why is there no binascii.a2b_binary(bitstr) which returns the binary data > represented by the bit string? Like: > binascii.a2b_binary('0011001100110101') > '35' > perl has pack("B*", "0011001100110101"); What, you mean like: int('0011001100110101', 2) Which you

Re: Convertion of Unicode to ASCII NIGHTMARE

2006-04-03 Thread Robert Kern
ChaosKCW wrote: > Hi > > I am reading from an oracle database using cx_Oracle. I am writing to a > SQLite database using apsw. > > The oracle database is returning utf-8 characters for euopean item > names, ie special charcaters from an ASCII perspective. I'm not sure that you are using those te

Re: Convertion of Unicode to ASCII NIGHTMARE

2006-04-03 Thread Paul Boddie
ChaosKCW wrote: > Hi > > I am reading from an oracle database using cx_Oracle. I am writing to a > SQLite database using apsw. > > The oracle database is returning utf-8 characters for euopean item > names, ie special charcaters from an ASCII perspective. And does cx_Oracle return those as Unicode

Re: can I get the index number in for x in y loop?

2006-04-03 Thread Felipe Almeida Lessa
Em Seg, 2006-04-03 às 08:47 -0700, JuHui escreveu: > which one has best performance? Let's see... > a:for i in range(0,len(a)) $ python2.4 -mtimeit -s 'a=[None]*100' 'for i in range(len(a)): j = a[i] ' 10 loops, best of 3: 17.7 usec per loop $ python2.4 -mtimeit -s 'a=[None]*100' 'for i

question about nasty regex

2006-04-03 Thread Peter
I'm wondering if someone can tell me whether the following set of regex substitutions is possible. I want to convert parallel legal citations into single citations. What I mean is, I want to change, e.g.: "Doremus v. Board of Education of Hawthorne, 342 U.S. 429, 434, 72 S. Ct. 394, 397, 96 L.E

Convertion of Unicode to ASCII NIGHTMARE

2006-04-03 Thread ChaosKCW
Hi I am reading from an oracle database using cx_Oracle. I am writing to a SQLite database using apsw. The oracle database is returning utf-8 characters for euopean item names, ie special charcaters from an ASCII perspective. I get the following error: >SQLiteCur.execute(sql, row) >UnicodeDe

Re: mod_python and PHP sharing same session

2006-04-03 Thread Jim Gallacher
Scott wrote: > I am trying to get a mod_python application to read an existing PHP > session. I need some data that was set in the session by the PHP > application. I am using the mod_python Session class but even when I > specify the session id that PHP uses the Sesssion(req, sid) call > returns

Re: can I get the index number in for x in y loop?

2006-04-03 Thread JuHui
which one has best performance? a:for i in range(0,len(a)) b:for x in a c:for x,y in enumerate(a) but, it seems I cann't get index number with b format..:( -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't detect EOF from stdin on windows console

2006-04-03 Thread Peter Hansen
Serge Orlov wrote: > Dmitry Anikin wrote: >>I want to read stdin in chunks of fixed size until EOF >>I want to be able (also) to supply data interactively in console >>window and then to hit Ctrl+Z when finished > > [snip fighting with windows] > >>Read at most size bytes from the file (less if t

Re: can I get the index number in for x in y loop?

2006-04-03 Thread Rune Strand
JuHui wrote: > >>> a='String' > >>> for x in a: > ... print x > ... > S > t > r > i > n > g > >>> > > can I get the index number of a in the upon loop within for x in a > loop? for x, y in enumerate(a) print x, y -- http://mail.python.org/mailman/listinfo/python-list

Re: can I get the index number in for x in y loop?

2006-04-03 Thread Paul McGuire
"JuHui" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >>> a='String' > >>> for x in a: > ... print x > ... > S > t > r > i > n > g > >>> > > can I get the index number of a in the upon loop within for x in a > loop? > Use enumerate. See example below. -- Paul >>> a = "Strin

Re: can I get the index number in for x in y loop?

2006-04-03 Thread Luigi
Try this: >>> a='String' >>> i=0 >>> for x in a: ... print i, x ... i+=1 ... 0 S 1 t 2 r 3 i 4 n 5 g -- http://mail.python.org/mailman/listinfo/python-list

Re: mod_python and PHP sharing same session

2006-04-03 Thread Diez B. Roggisch
Scott wrote: > I am trying to get a mod_python application to read an existing PHP > session. I need some data that was set in the session by the PHP > application. I am using the mod_python Session class but even when I > specify the session id that PHP uses the Sesssion(req, sid) call > return

Capturing stdout without waiting for the process end

2006-04-03 Thread Luigi
Hi to all! I'd like to execute an external program capturing the stdout/stderr messages at "real-time". I mean that I don't want to wait for the end of the process. If I write a code like this: import os import sys class Runner: def run(self, arg): try: fin, fout = os.po

can I get the index number in for x in y loop?

2006-04-03 Thread JuHui
>>> a='String' >>> for x in a: ... print x ... S t r i n g >>> can I get the index number of a in the upon loop within for x in a loop? -- http://mail.python.org/mailman/listinfo/python-list

Re: string building

2006-04-03 Thread Sion Arrowsmith
John Salerno <[EMAIL PROTECTED]> wrote: >Out of curiosity, is there any kind of equivalent in Python to the >StringBuilder class in C#? Here's a quick description from the .NET >documentation: > >"This class represents a string-like object whose value is a mutable >sequence of characters. The v

Re: Can't detect EOF from stdin on windows console

2006-04-03 Thread Serge Orlov
Dmitry Anikin wrote: > I want to read stdin in chunks of fixed size until EOF > I want to be able (also) to supply data interactively in console > window and then to hit Ctrl+Z when finished [snip fighting with windows] > Read at most size bytes from the file (less if the read hits EOF before >

Re: String pattern matching

2006-04-03 Thread Eddie Corns
"Jim Lewis" <[EMAIL PROTECTED]> writes: >Anyone have experience with string pattern matching? >I need a fast way to match variables to strings. Example: >string - variables > >abcaaab - xyz >abca - xy >eeabcac - vxw >x matches abc >y matches a >z matches aab >w maches ac >v maches ee

  1   2   >