Re: 6 Pick Bet Grouping

2006-11-28 Thread Mark Peters
> The totalizator system allows us to merge or group these four bets as > follows: > > 5 + 7 / 3 / 11 / 7 + 14 / 1 / 9 - $50 ($200 total) I'm still trying to get my head around what you're trying to do, but here's some code: ---snip- data = ["5 / 3 / 11 / 7 / 1 / 9 -

Re: Python program that validates an url against w3c markup validator

2006-11-28 Thread Fredrik Lundh
Fredrik Lundh wrote: > >>> f = urllib.urlopen("http://validator.w3.org/check?uri="; + uri) > >>> print f.headers here's the specification, btw: http://validator.w3.org/docs/api.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Python program that validates an url against w3c markup validator

2006-11-28 Thread Fredrik Lundh
yaru22 wrote: > I'd like to create a program that validates bunch of urls against the > w3c markup validator (http://validator.w3.org/) and store the result in > a file. > > Since I don't know network programming, I have no idea how to start > coding this program. > > I was looking at the python

Re: ElementTree xmlns:xsi question

2006-11-28 Thread Fredrik Lundh
Craig wrote: > I'm generating an XML script using ElementTree which has the following > attributes in the root element: > > http://www.w3.org/2001/XMLSchema-instance"; > xsi:noNamespaceSchemaLocation="code/can.xsd"> those are namespace declarations, and mean that tags prefixed by "xsi" really

Re: 6 Pick Bet Grouping

2006-11-28 Thread bullockbefriending bard
Sorry, I perhaps didn't frame my initial post very well. I hope my reply to your other post below has answered these questions. -- http://mail.python.org/mailman/listinfo/python-list

Re: 6 Pick Bet Grouping

2006-11-28 Thread bullockbefriending bard
Your explanation is correct. It's important to realise that effectively the input many thousands of single bets come out of a black box and it is then necessary for me to merge them into the grouped format to make things more manageable. Given an arbitrary bucket of single bets, it is by no means o

Re: How to increase the speed of this program?

2006-11-28 Thread Klaas
Klaas wrote: > Klaas wrote: > > > In fact, you can make it about 4x faster by balancing: > > > > [EMAIL PROTECTED] ~]$ python -m timeit -s "from array import array" > > "array('c','\0'*200)*500" > > 1 loops, best of 3: 32.4 usec per loop > > This is an unclean minimally-tested patch which achi

Re: Question about import and sys.path

2006-11-28 Thread Frank Millman
Rob Wolfe wrote: > Frank Millman wrote: > > Hi all > > > > However, I want the ability to have duplicate program names stored in > > different subdirectories. At the time of selecting the menu option I > > know which company is active, so I know which directory I want to run > > the program from,

Re: Python program that validates an url against w3c markup validator

2006-11-28 Thread Bjoern Schliessmann
yaru22 wrote: > I was looking at the python library and thought urllib or urllib2 > may be used to make this program work. > > But I don't know how to send my urls to the w3c validator and get > the result. Another great alternative is using the Twisted framework:

Re: Python program that validates an url against w3c markup validator

2006-11-28 Thread [EMAIL PROTECTED]
urls = [("/tmp/validate1.html", "http://www.theage.com.au";)] for url, outputfile in urls: commandString = 'wget -o %s http://validator.w3.org/check?uri=%s' % (outputfile, url) system.exec(commandString) is one easy way. yaru22 wrote: > I'd like to create a program that validates bunch of

Python program that validates an url against w3c markup validator

2006-11-28 Thread yaru22
I'd like to create a program that validates bunch of urls against the w3c markup validator (http://validator.w3.org/) and store the result in a file. Since I don't know network programming, I have no idea how to start coding this program. I was looking at the python library and thought urllib or

Re: 6 Pick Bet Grouping

2006-11-28 Thread [EMAIL PROTECTED]
It seems straightforward: 1 / X / X ... and 4 / X / X ... becomes 1 + 4 / X / X If there were a 6 / X / X it would become 1 + 4 + 6 / X / X I think this means that all possible combinations for any particular amount may be grouped together in a single ticket. Cheers, -T -- http://mail.python

Re: 6 Pick Bet Grouping

2006-11-28 Thread Paddy
bullockbefriending bard wrote: > e.g. we might have: > > 5 / 3 / 11 / 7 / 1 / 9 - $50 (5 to come 1st or 2nd in Race1, 3 to > come first or 2nd in Race 2, etc.) > 7 / 3 / 11 / 7 / 1 / 9 - $50 > 5 / 3 / 11 / 14 / 1 / 9 - $50 > 7 / 3 / 11 / 14 / 1 / 9 - $50 > > The totalizator system allows us

Re: why would anyone use python when java is there?

2006-11-28 Thread faulkner
functional programming, list comprehensions, decorators, duck typing, generators, dynamism, introspection, prettier code, simpler grammar [see digg and /. for the graphs], and, of course, the trolls. gavino wrote: > wtf -- http://mail.python.org/mailman/listinfo/python-list

Re: 6 Pick Bet Grouping

2006-11-28 Thread [EMAIL PROTECTED]
bullockbefriending bard wrote: > (I apologise in advance for posting something slightly OT, but plead in > mitigation that I'm trying to re-write an old, suboptimal VB6 (erk) > brute-force attack in a shiny, elegant, pythonic manner. I would really > appreciate some ideas about an appropriate algo

6 Pick Bet Grouping

2006-11-28 Thread bullockbefriending bard
(I apologise in advance for posting something slightly OT, but plead in mitigation that I'm trying to re-write an old, suboptimal VB6 (erk) brute-force attack in a shiny, elegant, pythonic manner. I would really appreciate some ideas about an appropriate algorithmic approach to this + pointers to a

Re: HTML Table-of-Content Extraction Script

2006-11-28 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > robert wrote: > > > I'm looking for a function which extracts a table of contents > > of HTML file(s) from ... > > and possibly auto-creates the ancors. > > Maybe something already exists? > > that's the kind of stuff you'll write in approximately two minutes using > Beaut

Re: why would anyone use python when java is there?

2006-11-28 Thread Jonathan Smith
gavino wrote: > wtf Java is a coffee, and coffee comes from exploited Ethiopians (they do have some damn fine coffee, though). Most of us prefer to exploit Englishmen instead. (damn them and their humor!) -smithj -- http://mail.python.org/mailman/listinfo/python-list

Re: Floating Exception

2006-11-28 Thread John Machin
Jeremy wrote: > Hi, > > I just changed some previously-working Python program to add a C++ > extension. > > Now, when I call __init__() in a Python class I did not change and with the > same arguments passed, I get the screen message 'Floating exception' and the > program seems to stop. The exact p

Re: Error handling. Python embedded into a C++ app.

2006-11-28 Thread [EMAIL PROTECTED]
You would use try: and then on the next line except: I am not sure what the best answer is but you could write your errors to a file and then load them if all else fails. https://sourceforge.net/projects/dex-tracker Wolfram wrote: > I have a problem with displaying errors in an embedded situat

Re: why would anyone use python when java is there?

2006-11-28 Thread gregarican
gavino wrote: > wtf You have to be trolling I would think. For most people I think they would like to code in Python if they had a personal choice. But for professional reasons they are likely forced to code in Java because of the sheep mentality of the large corporate drone-dom that's out there.

RE: why would anyone use python when java is there?

2006-11-28 Thread Éric Daigneault
> wtf a reasonable question... But before I run circle yelling "the trolls are here, the trolls are here" I got one for you... why would anyone use java when python is there?? ;-) .^_^. Eric :D, -- http://mail.python.org/mailman/listinfo/python-list

Re: why would anyone use python when java is there?

2006-11-28 Thread Martin P. Hellwig
Aahz wrote: > In article <[EMAIL PROTECTED]>, > gavino <[EMAIL PROTECTED]> wrote: >> wtf > > Because programming in Python makes me feel happy and contented, while > programming in Java just makes me want to scream in agony. Or in my case, Python made me code, Java made me brew java. ymmv -- mp

Re: why would anyone use python when java is there?

2006-11-28 Thread Aahz
In article <[EMAIL PROTECTED]>, gavino <[EMAIL PROTECTED]> wrote: > >wtf Because programming in Python makes me feel happy and contented, while programming in Java just makes me want to scream in agony. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ Usenet is not a

why would anyone use python when java is there?

2006-11-28 Thread gavino
wtf -- http://mail.python.org/mailman/listinfo/python-list

Re: "fork and exit" needed?

2006-11-28 Thread Vincent Delporte
On Tue, 28 Nov 2006 08:30:03 -0600, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >> import os,sys,time >> print "pre:", os.getpid() >> sys.stdout = open(os.devnull, 'w') >> print "post:", os.getpid() >> time.sleep(60) >> >> (Granted, I'm on WinXP; I also suspect the original stdout is still op

Re: Really closing stdout (was: "fork and exit" needed?)

2006-11-28 Thread Mitja Trampus
Nick Craig-Wood wrote: >>> open STDOUT, '>/dev/null'; >> sys.stdout = open(os.devnull, 'w') > $ ls -l /proc/32004/fd > total 4 > lrwx-- 1 ncw ncw 64 Nov 28 09:55 0 -> /dev/pts/17 > lrwx-- 1 ncw ncw 64 Nov 28 09:55 1 -> /dev/pts/17 > lrwx-- 1 ncw ncw 64 Nov 28 09:55 2 -> /dev/pts/17

ElementTree xmlns:xsi question

2006-11-28 Thread Craig
Hi there, I'm generating an XML script using ElementTree which has the following attributes in the root element: http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="code/can.xsd"> My python script I have written is: root = Element("CANmessages", xmlns:xsi="http://www.w3.

Re: Wrapping A Shell

2006-11-28 Thread [EMAIL PROTECTED]
Jeremy Moles wrote: > I'm not sure if this is really the right place to ask this question, but > since the implementation is in Python, I figured I'd give it a shot. > > I want to "wrap" a shell process using popen inside of python program > rather than creating a new shell process for each line I

Re: ANN: CherryPy 3.0 RC1

2006-11-28 Thread Ben Finney
"Christian Wyglendowski" <[EMAIL PROTECTED]> writes: > I'm happy to announce the first release candidate for CherryPy 3.0. Congratulations, I'm glad to see an announcement for CherryPy. Please, in future, don't send HTML message bodies to public forums; plain text is far better for such a wide a

Re: SPE (Stani's Python Editor) web site?

2006-11-28 Thread John DeRosa
On 28 Nov 2006 13:16:41 -0800, "Bernard" <[EMAIL PROTECTED]> wrote: > >I can send you the latest tar.gz ( SPE-0.8.3.c-wx2.6.1.0.tar ) file if >you want it :) I'm looking for SPE for Python 2.5 and wxPython 2.7.2.0, on Windows. Do you have that? -- http://mail.python.org/mailman/listinfo/python-l

Re: pyxpcom

2006-11-28 Thread Trent Mick
> My need is as follows: I have developed an activex component to access a > smart card on the client side / do some web site logon. > > Are xpcom / pyxpcom advanced/stable enough for such an implementation > under Linux / Windows ? You mean to provide the equivalent functionality for Firefox tha

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Jacob Rael
Thanks all. I think I'll follow the "don't do that" advice. jr Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full

Re: How to refer to Python?

2006-11-28 Thread Fredrik Lundh
Sebastian Bassi wrote: > I am writing a paper where I refer to Python. Is there a paper that I > can refer the reader to? Or just use the Python web page as a > reference? http://effbot.org/pyfaq/are-there-any-published-articles-about-python-that-i-can-reference.htm -- http://mail.python.org/

How to refer to Python?

2006-11-28 Thread Sebastian Bassi
I am writing a paper where I refer to Python. Is there a paper that I can refer the reader to? Or just use the Python web page as a reference? -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2 spinning CPU on read

2006-11-28 Thread kdotsky
> I didn't try looking at your example, but I think it's likely a bug > both in that site's HTTP server and in httplib. If it's the same one > I saw, it's already reported, but nobody fixed it yet. > > http://python.org/sf/1411097 > > > John Thanks. I tried the example in the link you gave, and

Re: How to increase the speed of this program?

2006-11-28 Thread Klaas
Klaas wrote: > In fact, you can make it about 4x faster by balancing: > > [EMAIL PROTECTED] ~]$ python -m timeit -s "from array import array" > "array('c','\0'*200)*500" > 1 loops, best of 3: 32.4 usec per loop This is an unclean minimally-tested patch which achieves reasonable performance (

wanna stop by my homemade glory hole?

2006-11-28 Thread WESTPAC851
have you used the cubby hole before? -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread John Machin
Tim Hochberg wrote: [snip] > I agree that mixing the line assembly and parsing is probably a mistake > although using next explicitly is fine as long as your careful with it. > For instance, I would be wary to use the mixed for-loop, next strategy > that some of the previous posts suggested. Here'

Re: SPE (Stani's Python Editor) web site?

2006-11-28 Thread Bernard
I can send you the latest tar.gz ( SPE-0.8.3.c-wx2.6.1.0.tar ) file if you want it :) Bernard John DeRosa wrote: > SPE's site (http://pythonide.stani.be/) has been inaccessible to me > for at least a day. Can anyone else get to it? > > I looked on Google and didn't see any new locations for SPE

Re: Reading text labels from a Win32 window

2006-11-28 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] schrieb: > Does anyone know of a way to read text labels from a Win32 application. > I am familiar with using pywin32 and the SendMessage function to > capture text from Buttons,text boxex, comboboxes, etc, however, the > text I am would like to capture doesn't appear to be in a

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Tim Hochberg
John Machin wrote: > Jacob Rael wrote: >> Hello, >> >> I have a simple script to parse a text file (a visual basic program) >> and convert key parts to tcl. Since I am only working on specific >> sections and I need it quick, I decided not to learn/try a full blown >> parsing module. My simple scri

Re: Modifying every alternate element of a sequence

2006-11-28 Thread bearophileHUGS
Leo Kislov: > input[1::2] = [-item for item in input[1::2]] > If you don't want to do it in-place, just make a copy: > wanted = input[:] > wanted[1::2] = [-item for item in wanted[1::2]] Very nice solution. I have tried few versions like: from itertools import imap, islice from operator import neg

IEC Controller and element

2006-11-28 Thread Danny Scaleno
Hello, using IEC Controller, anybody knows how to capture the head part of an html page like this one? Object=window.open('test.html','test1','name="test1"'); Object.focus() it seems IEC is able to capture only the part. I need to parse the string inside the tag

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread John Machin
Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full blown > parsing module. My simple script works well until it runs

Wrapping A Shell

2006-11-28 Thread Jeremy Moles
I'm not sure if this is really the right place to ask this question, but since the implementation is in Python, I figured I'd give it a shot. I want to "wrap" a shell process using popen inside of python program rather than creating a new shell process for each line I process in the app. For examp

Re: How to increase the speed of this program?

2006-11-28 Thread Klaas
John Machin wrote: > Thanks, that's indeed faster than array(t, [v]*n) but what I had in > mind was something like an additional constructor: > > array.filledarray(typecode, repeat_value, repeat_count) > > which I speculate should be even faster. Looks like I'd better get a > copy of arraymodule.c

Re: How to increase the speed of this program?

2006-11-28 Thread Fredrik Lundh
John Machin wrote: > Thanks, that's indeed faster than array(t, [v]*n) but what I had in > mind was something like an additional constructor: > > array.filledarray(typecode, repeat_value, repeat_count) > > which I speculate should be even faster. before you add a new API, you should probably st

Re: SPE (Stani's Python Editor) web site?

2006-11-28 Thread Fuzzyman
John DeRosa wrote: > SPE's site (http://pythonide.stani.be/) has been inaccessible to me > for at least a day. Can anyone else get to it? > > I looked on Google and didn't see any new locations for SPE. Has it > recently moved to somewhere else? I dimly recall a post by Stani > wherein he said

Re: How to increase the speed of this program?

2006-11-28 Thread John Machin
Fredrik Lundh wrote: > John Machin wrote: > > > I'm extremely agnostic about the spelling :-) IOW I'd be very glad of > > any way [pure Python; e.g. maintaining my own version of the array > > module doesn't qualify] to simply and rapidly create an array.array > > instance with typecode t and numbe

Re: pyxpcom

2006-11-28 Thread hg
Trent Mick wrote: > hg wrote: >> Hi, >> >> Can one tell me what the status of this project is ?. I did google ... >> but not much out there. > > PyXPCOM source is in the main Mozilla CVS tree. It is being maintained > by Mark Hammond (the original developer of the extension). There isn't a > lot o

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Roberto Bonvallet
Jacob Rael wrote: [...] > I would line to identify if a line continues (if line.endswith('_')) > and concate with the next line: > > line = line + nextLine > > How can I get the next line when I am in a for loop using readlines? Don't use readlines. # NOT TESTED program = open(fileName)

Reading text labels from a Win32 window

2006-11-28 Thread geskerrett
Does anyone know of a way to read text labels from a Win32 application. I am familiar with using pywin32 and the SendMessage function to capture text from Buttons,text boxex, comboboxes, etc, however, the text I am would like to capture doesn't appear to be in a control. -- http://mail.python.org

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Larry Bates
Jacob Rael wrote: > Hello, > > I have a simple script to parse a text file (a visual basic program) > and convert key parts to tcl. Since I am only working on specific > sections and I need it quick, I decided not to learn/try a full blown > parsing module. My simple script works well until it run

Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Jacob Rael
Hello, I have a simple script to parse a text file (a visual basic program) and convert key parts to tcl. Since I am only working on specific sections and I need it quick, I decided not to learn/try a full blown parsing module. My simple script works well until it runs into functions that straddle

Re: pyxpcom

2006-11-28 Thread Trent Mick
hg wrote: > Hi, > > Can one tell me what the status of this project is ?. I did google ... > but not much out there. PyXPCOM source is in the main Mozilla CVS tree. It is being maintained by Mark Hammond (the original developer of the extension). There isn't a lot of activity on it, I think, be

Re: Reading GDSII layouts

2006-11-28 Thread Jacob Rael
Funny, I started writing one this past weekend as a learning exercise (handling large files and start to use classes). If ipkiss does not work out, let me know specifically what you need and maybe my hack will work. jr Vincent Arnoux wrote: > Hello, > I am looking for a library for reading GDSII

Re: SPE (Stani's Python Editor) web site?

2006-11-28 Thread Larry Bates
John DeRosa wrote: > SPE's site (http://pythonide.stani.be/) has been inaccessible to me > for at least a day. Can anyone else get to it? > > I looked on Google and didn't see any new locations for SPE. Has it > recently moved to somewhere else? I dimly recall a post by Stani > wherein he said

SPE (Stani's Python Editor) web site?

2006-11-28 Thread John DeRosa
SPE's site (http://pythonide.stani.be/) has been inaccessible to me for at least a day. Can anyone else get to it? I looked on Google and didn't see any new locations for SPE. Has it recently moved to somewhere else? I dimly recall a post by Stani wherein he said he might move the site, but I c

Re: Reading GDSII layouts

2006-11-28 Thread Paddy
Vincent Arnoux wrote: > Hello, > I am looking for a library for reading GDSII layout files structures > (hierarchy, cells names, ...). > I found IPKISS > (http://www.photonics.intec.ugent.be/research/facilities/design/ipkiss/default.htm), > but it looks to be a generator and not a reader. > > Th

Re: HTML Table-of-Content Extraction Script

2006-11-28 Thread Fredrik Lundh
robert wrote: > I'm looking for a function which extracts a table of contents > of HTML file(s) from ... > and possibly auto-creates the ancors. > Maybe something already exists? that's the kind of stuff you'll write in approximately two minutes using BeautifulSoup (or if you prefer the Elemen

Error handling. Python embedded into a C++ app.

2006-11-28 Thread Wolfram
I have a problem with displaying errors in an embedded situation. The "main program" I want to embed Python into is a windows, MFC, non-console, C++ application. My issue is that I have not been able to "catch" error messages from python, for example syntax errors. PyRun_SimpleFile() crashed, pr

Re: Problem with imaplib (weird result if mailbox contains a %)

2006-11-28 Thread Leo Kislov
Antoon Pardon wrote: > This little program gives IMO a strange result. > > import imaplib > > user = "cpapen" > > cyr = imaplib.IMAP4("imap.vub.ac.be") > cyr.login("cyrus", "cOn-A1r") > rc, lst = cyr.list('""', "user/%s/*" % user) > for el in lst: > print "%r" % (el,) > > And the result is: > >

Re: Inheritance from builtin list and override of methods.

2006-11-28 Thread Fredrik Lundh
Carl Banks wrote: > Because the concerns of thousands of legitimate programmers who want > good performance out of their sorts outweigh the concerns of the one or > two hax0r d00ds who think it would be cool to hook into sort internals. ... and haven't yet realized that using sorted() and convert

Re: Inheritance from builtin list and override of methods.

2006-11-28 Thread Carl Banks
OKB (not okblacke) wrote: > Carsten Haese wrote: > > > You can change the behavior of a list's sort method by overriding > > sort. You can't change the behavior of sort by overriding > > __getitem__ and __setitem__, because sort does not call __getitem__ > > or __setitem__. > > Why doesn't it

Re: HTML Table-of-Content Extraction Script

2006-11-28 Thread Thomas Guettler
robert wrote: > I'm looking for a function which extracts a table of contents of HTML file(s) > from ... and possibly auto-creates the ancors. > Maybe something already exists? You can try mine: http://www.thomas-guettler.de/scripts/number-html-headings.py.txt -- Thomas Güttler, http://www.tho

Re: Inheritance from builtin list and override of methods.

2006-11-28 Thread Fredrik Lundh
Michalis Giannakidis wrote: > I perfectly understand that this adds significant penalty to the execution of > code. But in the way things are, I have to know ( or guess ?) how its > function has been implemented. and that's different from how object orientation usually works in exactly what wa

Re: Dynamic/runtime code introspection/compilation

2006-11-28 Thread Thomas W
Great !!! That works like charm. Thanks alot. Thomas Leo Kislov wrote: > Thomas W wrote: > > Maybe a stupid subject, but this is what I want to do : > > > > I got some python code stored in a string: > > > > somecode = """ > > > > from somemodule import ISomeInterface > > > > class Foo(ISomeIn

'locals' argument of PyEval_EvalCode

2006-11-28 Thread Daniel Trstenjak
Hi all, I would like to know the definition of the 'locals' object given to PyEval_EvalCode. Has 'locals' to be a python dictionary or a subtype of a python dictionary, or is it enough if the object implements the necessary protocols? The python implementation behaves different for the two follo

Re: Question about import and sys.path

2006-11-28 Thread Rob Wolfe
Frank Millman wrote: > Hi all > > I am writing a business/accounting application. Once a user has logged > in they are presented with a menu. Each menu option has a description > and an associated file name and program name. The file name is the name > of a .py file (impName) and the program name

Re: "fork and exit" needed?

2006-11-28 Thread Nick Craig-Wood
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Tue, 28 Nov 2006 04:30:09 -0600, Nick Craig-Wood > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > > > If you run this > > > > import os,sys,time > > print os.getpid() > > sys.stdout = open(os.devnull, 'w') > > tim

Re: Inheritance from builtin list and override of methods.

2006-11-28 Thread Michalis Giannakidis
On Tuesday 28 November 2006 06:12, OKB (not okblacke) wrote: > Carsten Haese wrote: > > You can change the behavior of a list's sort method by overriding > > sort. You can't change the behavior of sort by overriding > > __getitem__ and __setitem__, because sort does not call __getitem__ > > or __se

Re: Libgmail

2006-11-28 Thread Jussi Salmela
linuxfreak wrote: > Funny enough I find the same "Google" in my browser too. and if my > memory serves me correct I did the same search which you allude to. It > is only after series of exhaustive searches rummaging through websites > with incomplete (or non existent ) docs that i posed the questi

Re: Dynamic/runtime code introspection/compilation

2006-11-28 Thread Leo Kislov
Thomas W wrote: > Maybe a stupid subject, but this is what I want to do : > > I got some python code stored in a string: > > somecode = """ > > from somemodule import ISomeInterface > > class Foo(ISomeInterface): > param1 = ... > param2 = > > """ > > and I want to compile that code so

Problem with imaplib (weird result if mailbox contains a %)

2006-11-28 Thread Antoon Pardon
This little program gives IMO a strange result. import imaplib user = "cpapen" cyr = imaplib.IMAP4("imap.vub.ac.be") cyr.login("cyrus", "cOn-A1r") rc, lst = cyr.list('""', "user/%s/*" % user) for el in lst: print "%r" % (el,) And the result is: '(\\HasNoChildren) "/" "user/cpapen/Out"' '(\\H

Re: Dynamic/runtime code introspection/compilation

2006-11-28 Thread Fredrik Lundh
Thomas W wrote: > from somemodule import ISomeInteface > > d = compile(sourcecode) > > myfoo = d.Foo() > > print ISomeInterface in myfoo.__bases__ > > Any hints? Python is a dynamic language, so compiling something won't tell you much about what the code actually does. the only reliable way

Re: Accessing file metadata on windows XP

2006-11-28 Thread Roger Upole
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > When rightclicking a, for example, pdf file on windows, one normally > gets a screen with three or four tags. Clicking on one of the summary > tag one can get some info like "title", "Author", "category", "keyword" > etc.. > > My quest

Re: How to increase the speed of this program?

2006-11-28 Thread Peter Otten
Fredrik Lundh wrote: > John Machin wrote: > >> I'm extremely agnostic about the spelling :-) IOW I'd be very glad of >> any way [pure Python; e.g. maintaining my own version of the array >> module doesn't qualify] to simply and rapidly create an array.array >> instance with typecode t and number

Re: Accessing file metadata on windows XP

2006-11-28 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > When rightclicking a, for example, pdf file on windows, one normally > gets a screen with three or four tags. Clicking on one of the summary > tag one can get some info like "title", "Author", "category", "keyword" > etc.. > > My question

Dynamic/runtime code introspection/compilation

2006-11-28 Thread Thomas W
Maybe a stupid subject, but this is what I want to do : I got some python code stored in a string: somecode = """ from somemodule import ISomeInterface class Foo(ISomeInterface): param1 = ... param2 = """ and I want to compile that code so that I can use the Foo-class and check w

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > Wow, I was in fact searching for this syntax in the python tutorial. It > is missing there. > Is there a reference page which documents all possible list > comprehensions. There is actually only two forms of list comprehensions: http://docs.python.org/ref/lists.html [bl

Re: Python script and C++

2006-11-28 Thread Jorgen Grahn
On Tue, 28 Nov 2006 10:12:23 +0100, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Ravi Teja > wrote: > >>> I am new to python and currently I am working on a traffic simulation >>> which I plan to define the various agents using scripting. It's kind of like >>>

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Steven D'Aprano
On Tue, 28 Nov 2006 02:38:09 -0800, [EMAIL PROTECTED] wrote: > I have a list of numbers and I want to build another list with every > second element multiplied by -1. > > input = [1,2,3,4,5,6] > wanted = [1,-2,3,-4,5,-6] > > I can implement it like this: > > input = range(3,12) > wanted = [] >

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Roberto Bonvallet
[EMAIL PROTECTED] wrote: > I have a list of numbers and I want to build another list with every > second element multiplied by -1. [...] > But is there any other better way to do this. I think the best way is the one that uses slices, as somebody suggested in this thread. This is another (worse)

Re: SAX2 Download

2006-11-28 Thread Mike P
Fredrik Lundh wrote: > Mike P wrote: > > > Does anyone know where i can download acopy of the SAX2 module? > > the built-in xml.sax module implements the SAX 2 protocol, if that's > what you're looking for: > > http://docs.python.org/lib/module-xml.sax.html > > Perfect thanks -- http://m

Re: Modifying every alternate element of a sequence

2006-11-28 Thread [EMAIL PROTECTED]
Wow, I was in fact searching for this syntax in the python tutorial. It is missing there. Is there a reference page which documents all possible list comprehensions. -- Suresh Leo Kislov wrote: > [EMAIL PROTECTED] wrote: > > I have a list of numbers and I want to build another list with every > >

Re: How to increase the speed of this program?

2006-11-28 Thread Fredrik Lundh
John Machin wrote: > I'm extremely agnostic about the spelling :-) IOW I'd be very glad of > any way [pure Python; e.g. maintaining my own version of the array > module doesn't qualify] to simply and rapidly create an array.array > instance with typecode t and number of elements n with each elemen

Re: How to increase the speed of this program?

2006-11-28 Thread John Machin
Peter Otten wrote: > Peter Otten wrote: > > > Leo Kislov wrote: > > > >> > >> Peter Otten wrote: > >>> Peter Otten wrote: > >>> > >>> > HYRY wrote: > >>> > > >>> >> I want to join two mono wave file to a stereo wave file by only using > >>> >> the default python module. > >>> >> Here is my program

Re: os.walk return hex excapes

2006-11-28 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Alex S wrote: > os.walk return hex excape sequence inside a files name, and when i try > to feed it back to os.remove i get > > OSError: [Errno 22] Invalid argument: > 'C:\\Temp\\?p?\xbfS\xbf\xac?G\xaba ACDSee \xbb?a??n a???\xac\xb5\xbfn.exe' There is no hex escape in th

Re: os.walk return hex excapes

2006-11-28 Thread Leo Kislov
Alex S wrote: > Hi, > os.walk return hex excape sequence inside a files name, and when i try > to feed it back to os.remove i get > > OSError: [Errno 22] Invalid argument: > 'C:\\Temp\\?p?\xbfS\xbf\xac?G\xaba ACDSee \xbb?a??n a???\xac\xb5\xbfn.exe' It's not escape sequences that are the problem bu

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Antoon Pardon
On 2006-11-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have a list of numbers and I want to build another list with every > second element multiplied by -1. > > input = [1,2,3,4,5,6] > wanted = [1,-2,3,-4,5,-6] > > I can implement it like this: > > input = range(3,12) > wanted = [] > for (

Re: SAX2 Download

2006-11-28 Thread Fredrik Lundh
Mike P wrote: > Does anyone know where i can download acopy of the SAX2 module? the built-in xml.sax module implements the SAX 2 protocol, if that's what you're looking for: http://docs.python.org/lib/module-xml.sax.html -- http://mail.python.org/mailman/listinfo/python-list

Re: "fork and exit" needed?

2006-11-28 Thread Fredrik Lundh
Nick Craig-Wood wrote: > If you run this > > import os,sys,time > print os.getpid() > sys.stdout = open(os.devnull, 'w') > time.sleep(60) > > It prints its pid. and not only that, if you run print "world", print "hello" it prints "hello world" in the wrong order! --

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > I have a list of numbers and I want to build another list with every > second element multiplied by -1. > > input = [1,2,3,4,5,6] > wanted = [1,-2,3,-4,5,-6] > > I can implement it like this: > > input = range(3,12) > wanted = [] > for (i,v) in enumerate(input): > if

SAX2 Download

2006-11-28 Thread Mike P
Does anyone know where i can download acopy of the SAX2 module? Cheers Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying every alternate element of a sequence

2006-11-28 Thread John Hicken
[EMAIL PROTECTED] wrote: > I have a list of numbers and I want to build another list with every > second element multiplied by -1. > > input = [1,2,3,4,5,6] > wanted = [1,-2,3,-4,5,-6] > > I can implement it like this: > > input = range(3,12) > wanted = [] > for (i,v) in enumerate(input): > if

os.walk return hex excapes

2006-11-28 Thread Alex S
Hi, os.walk return hex excape sequence inside a files name, and when i try to feed it back to os.remove i get OSError: [Errno 22] Invalid argument: 'C:\\Temp\\?p?\xbfS\xbf\xac?G\xaba ACDSee \xbb?a??n a???\xac\xb5\xbfn.exe' -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Tim Chase
> I have a list of numbers and I want to build another list with every > second element multiplied by -1. > > input = [1,2,3,4,5,6] > wanted = [1,-2,3,-4,5,-6] > > I can implement it like this: > > input = range(3,12) > wanted = [] > for (i,v) in enumerate(input): > if i%2 == 0: > wa

Reading GDSII layouts

2006-11-28 Thread Vincent Arnoux
Hello, I am looking for a library for reading GDSII layout files structures (hierarchy, cells names, ...). I found IPKISS (http://www.photonics.intec.ugent.be/research/facilities/design/ipkiss/default.htm), but it looks to be a generator and not a reader. Thank you, Vincent -- http://mail.pyt

Re: How to increase the speed of this program?

2006-11-28 Thread Leo Kislov
HYRY wrote: > Peter Otten wrote: > > HYRY wrote: > > > > > I want to join two mono wave file to a stereo wave file by only using > > > the default python module. > > > Here is my program, but it is much slower than the C version, so how > > > can I increase the speed? > > > I think the problem is a

  1   2   >