Re: triple quoted strings as comments

2006-01-30 Thread Steve Holden
dmh2000 wrote: > I recently complained elsewhere that Python doesn't have multiline > comments. Personally I think it's a win that you couldn't find anything more serious to complain about :-) regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC

Re: Collecting IP range

2006-01-30 Thread David Murmann
yawgmoth7 schrieb: > Well, I seem to have a bit of a problem: > >>>import IPy > >>>ip =IP('127.0.0.1/30') > Traceback (Most recent call last): > File "". line `, in ? > NameError: name 'IP' is not defined > >>> to make this work with "import IPy" you need to use "ip = IPy.IP('127.0.0.1/30')". > I

Re: Tk.quit() now working!

2006-01-30 Thread al pacino
>how do you run your Tkinter program ? like? i was testing it in windows (interactive interpreter) -- http://mail.python.org/mailman/listinfo/python-list

Re: determinant

2006-01-30 Thread Robert Kern
Tuvas wrote: > I am trying to find a nice function that quickly determines the > determanant in python. Anyone have any recommendations? I've heard > about numpy, but I can't get it to work (It doesn't seem to like the > import Matrix statement...). Thanks! That's a new one on me. Have you tried t

determinant

2006-01-30 Thread Tuvas
I am trying to find a nice function that quickly determines the determanant in python. Anyone have any recommendations? I've heard about numpy, but I can't get it to work (It doesn't seem to like the import Matrix statement...). Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Having Trouble with Scoping Rules

2006-01-30 Thread Fredrik Lundh
Charles Krug wrote: > > def ExpensiveObject(): > > global _expensiveObject > > if not(_expensiveObject): > > _expensiveObject = "A VERY Expensive object" > > > > return _expensiveObject > > > > The documentation will no doubtedly explain it better than I have > Okay, that

Re: Using non-ascii symbols

2006-01-30 Thread Alex Martelli
Dave Hansen <[EMAIL PROTECTED]> wrote: > On Fri, 27 Jan 2006 20:27:40 -0500 in comp.lang.python, Dan Sommers > <[EMAIL PROTECTED]> wrote: > > >On Fri, 27 Jan 2006 22:29:20 GMT, > >Neil Hodgson <[EMAIL PROTECTED]> wrote: > > > >> ... I'm so used to "/" for division that "÷" now looks strange. > >

Re: about spawn flag

2006-01-30 Thread Alex Martelli
Sinan Nalkaya <[EMAIL PROTECTED]> wrote: > hi, i am using os.spawn function, it works well but i need a flag that > allows function return the process id with exit/error code, is there > any or how can i do it, i can replace spawn with fork/exec if > necessary. os.P_WAIT waits until the spawned p

wxPython Conventions

2006-01-30 Thread Jared Russell
I've recently decided to try my hand at GUI programming with wxPython, and I've got a couple questions about the general conventions regarding it. To mess around with it, I decided to create a small app to check my Gmail. I want something that will just sit in my system tray checking for new emai

Re: Having Trouble with Scoping Rules

2006-01-30 Thread Charles Krug
On 2006-01-31, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > You need to declare _expensiveObject as global inside your function. > Whenever you assign something to a variable that resides in the global > scope inside a function, you need to declare it as global at the > beginning of the functio

Re: A simple question string.replace

2006-01-30 Thread I V
Haibao Tang wrote: > Is it possible to substitue all '1.1' to some value else without using > re. You could try: import sys values = sys.stdin.readline().split() while values: results = [] for value in values: if value != '1.1': results.append(value) else:

Re: A simple question string.replace

2006-01-30 Thread Emile van Sebille
"Haibao Tang" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have a two-column data file like this > 1.12.3 > 2.211.1 > 4.31.1 > ... > Is it possible to substitue all '1.1' to some value else without using > re. > Yes -- data = """1.12.3 2.211.1 4.31.1"""

Re: Collecting IP range

2006-01-30 Thread David Murmann
yawgmoth7 schrieb: > Hello, I'm sure that this has been discussed before, but I have a > question. I have written a few port scanners, banner grabbers in the > past and have never found a good way to get a range of IP's. > Obviously, in my opinion the best and simplest way to do somethign > like an

A simple question string.replace

2006-01-30 Thread Haibao Tang
I have a two-column data file like this 1.12.3 2.211.1 4.31.1 ... Is it possible to substitue all '1.1' to some value else without using re. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Fuzzy Lookups

2006-01-30 Thread Gregory Piñero
Ok, ok, I got it! The Pythonic way is to use an existing library ;-) import difflib CloseMatches=difflib.get_close_matches(AFileName,AllFiles,20,.7) I wrote a script to delete duplicate mp3's by filename a few years back with this. If anyone's interested in seeing it, I'll post a blog entry on

Re: beta.python.org content

2006-01-30 Thread robin
Steve Holden <[EMAIL PROTECTED]> wrote: >How does > > http://beta.python.org/about/beginners/ > >look? There are several things wrong with the interface. First, I count seven ways of formatting a link. This is approximately five too many and can be fixed as follows. "For Beginners" is italici

Re: Deterministic destruction and RAII idioms in Python

2006-01-30 Thread plahey
Hi Paul, > I didn't understand then. I thought by "deterministic destruction" > you meant relying on what CPython does now, which is reference > counting with destruction when the last reference is released. I effectively do mean that. In C++ it is guaranteed that a destructor will be called

Get Rich

2006-01-30 Thread Daun Johnson
Take advantage of a great deal -- http://mail.python.org/mailman/listinfo/python-list

Re: Can a test case tell if VERBOSE is used in pyunit test?

2006-01-30 Thread Peter Hansen
Noah wrote: > Is there a way for a test case method in a class derived > from unittest.TestCase to tell if the harness was started > with the verbose option? I would like my test cases to > print out a little extra information if the tests were run with > -v or -vv. Looking at the source, it doesn

Re: Deterministic destruction and RAII idioms in Python

2006-01-30 Thread Paul Rubin
[EMAIL PROTECTED] writes: > >> I looked at pep-0343, it looks interesting. It is not what I really > >> want (deterministic destruction) > >I think it's better. > Is there something specific you have in mind that makes you say that?... > Which, looks like you have a constructor (__enter__) and a d

ANN: Rur-ple 0.95 has been released

2006-01-30 Thread André
RUR-PLE 0.95 has been released. A link to the download page can be found at http://rur-ple.sourceforge.net (The site is slightly out of date, and there is no plan to update it in the future as it provides an excellent idea of what RUR-PLE is about.) This new version contains a few bug fixes and

Re: Having Trouble with Scoping Rules

2006-01-30 Thread Michael Spencer
Charles Krug wrote: > List: > ... > # expensive Object Module > > _expensiveObject = None > def ExpensiveObject(): > > if not(_expensiveObject): > _expensiveObject = "A VERY Expensive object" > > return _expensiveObject > ... > I obviously missed some part of the scoping rules.

Re: Having Trouble with Scoping Rules

2006-01-30 Thread Farshid Lashkari
You need to declare _expensiveObject as global inside your function. Whenever you assign something to a variable that resides in the global scope inside a function, you need to declare it as global at the beginning of the function. So your function should look like this def ExpensiveObject():

Re: instance references?

2006-01-30 Thread Alex Martelli
Scott David Daniels <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > My favourite way to use weakref is slightly different: I would have > >aptbase.drawables = weakref.WeakValueDictionary > typo here: > aptbase.drawables = weakref.WeakValueDictionary() > > then in each __init__ > >

Re: Deterministic destruction and RAII idioms in Python

2006-01-30 Thread plahey
Hi Paul, >> I looked at pep-0343, it looks interesting. It is not what I really >> want (deterministic destruction) > >I think it's better. Is there something specific you have in mind that makes you say that? I am not a python expert, so I probably do not understand all the implications of the

Re: incompatible with

2006-01-30 Thread James Stroud
James Stroud wrote: > Luke wrote: > >> Thanks James, though from the output of b.x() it appears that x is a >> class method (ie the class is passed as the first parameter rather than >> the instance)... >> > > Sorry, the one line was probably supposed to be > > b = bob() > > I forgot the parens

Having Trouble with Scoping Rules

2006-01-30 Thread Charles Krug
List: I've a module that's not doing what I expect. My guess is that I don't quite understand the scoping rules the way I should. I have an object that's costly to create. My thought was to create it at the module level like this: # expensive Object Module _expensiveObject = None def Expensiv

Re: incompatible with

2006-01-30 Thread James Stroud
Luke wrote: > Thanks James, though from the output of b.x() it appears that x is a > class method (ie the class is passed as the first parameter rather than > the instance)... > Sorry, the one line was probably supposed to be b = bob() I forgot the parens: py> b = bob() py> b.x = types.MethodT

Can a test case tell if VERBOSE is used in pyunit test?

2006-01-30 Thread Noah
Is there a way for a test case method in a class derived from unittest.TestCase to tell if the harness was started with the verbose option? I would like my test cases to print out a little extra information if the tests were run with -v or -vv. yours, Noah -- http://mail.python.org/mailman/listi

Re: Collecting IP range

2006-01-30 Thread Emile van Sebille
"yawgmoth7" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > for ips in range(startip,endip): > > Here's one way: def iterIPs(startip,endip): import socket, struct sip = struct.unpack('>L',socket.inet_aton(startip))[0] eip = struct.unpack('>L',socket.inet_aton(endi

Re: templates

2006-01-30 Thread thakadu
I have used PyMeld (http://www.entrian.com/PyMeld/) which is one of very few that gives a 100% separation of code and presentation, in fact PyMeld is not strictly speaking a template system at all. I have also used Cheetah. (http://www.cheetahtemplate.org/) However for a recent project (http://muti

Re: incompatible with

2006-01-30 Thread Luke
Thanks James, though from the output of b.x() it appears that x is a class method (ie the class is passed as the first parameter rather than the instance)... -- http://mail.python.org/mailman/listinfo/python-list

Re: templates

2006-01-30 Thread Christoph Zwerschke
Christoph Zwerschke wrote: > It must not always be templating systems. E.g. > > Nevow: http://divmod.org/projects/nevow Just saw that Newvow provides templates and a tag attribute language as well, not only the "Stan" part which is more like XIST. -- Christoph -- http://mail.python.org/mailman

Re: triple quoted strings as comments

2006-01-30 Thread Roy Smith
"dmh2000" <[EMAIL PROTECTED]> wrote: > I recently complained elsewhere that Python doesn't have multiline > comments. Of course it has multi-line comments. They look like this: # This is the first line # and this is the second. Why is that a problem? -- http://mail.python.org/mailman/listinfo/

Re: templates

2006-01-30 Thread Christoph Zwerschke
projecktzero wrote: > For some of the web programming I've done in Python, I've used > htmltmpl. I had some experience with it in Perl, and found a Python > version. > What web templating systems do you use and why? BTW, there are also a couple of other very clever concepts for creating web pages

Re: templates

2006-01-30 Thread Christoph Zwerschke
projecktzero wrote: > I like that there's nearly a complete separation between the > presentation and the code. This is great when one person is designing > the pages and another is writing the code to drive those pages. > ... > What web templating systems do you use and why? A plethora of such Py

Re: loading modules in debug

2006-01-30 Thread [EMAIL PROTECTED]
[I haven't seen an answer for this older question, so I figured I'd go ahead and post one] Andras Balogh wrote: > > The problem is that, in debug mode, Python expects every module name to > be postfixed with _d, which makes my dynamic loading (using LoadLibrary) > not work, unless I #ifdef it ever

Re: triple quoted strings as comments

2006-01-30 Thread André
dmh2000 wrote: > I recently complained elsewhere that Python doesn't have multiline > comments. i was told to use triple quoted strings to make multiline > comments. My question is that since a triple quoted string is actually > a language construct, does it use cause a runtime construction of a >

Re: triple quoted strings as comments

2006-01-30 Thread Terry Hancock
On 30 Jan 2006 16:29:15 -0800 "dmh2000" <[EMAIL PROTECTED]> wrote: > I recently complained elsewhere that Python doesn't have > multiline comments. i was told to use triple quoted > strings to make multiline comments. My question is that > since a triple quoted string is actually a language > const

Re: triple quoted strings as comments

2006-01-30 Thread Peter Hansen
dmh2000 wrote: > I recently complained elsewhere that Python doesn't have multiline > comments. i was told to use triple quoted strings to make multiline > comments. My question is that since a triple quoted string is actually > a language construct, does it use cause a runtime construction of a >

Re: Fuzzy Lookups

2006-01-30 Thread ajones
BBands wrote: > I have some CDs and have been archiving them on a PC. I wrote a Python > script that spans the archive and returns a list of its contents: > [[genre, artist, album, song]...]. I wanted to add a search function to > locate all the versions of a particular song. This is harder than y

Re: incompatible with

2006-01-30 Thread James Stroud
Luke wrote: > Built-in functions don't bind to classes like regular functions. Is > this intended? (I do notice that the Python Reference Manual sec 3.2 > under "Class Instance" refers to a "user-defined function"). Any ideas > what the reason is for this distinction between build-in functions a

Re: incompatible with

2006-01-30 Thread gmane
"Luke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Built-in functions don't bind to classes like regular functions. Is > this intended? (I do notice that the Python Reference Manual sec 3.2 > under "Class Instance" refers to a "user-defined function"). Any ideas > what the re

Collecting IP range

2006-01-30 Thread yawgmoth7
Hello, I'm sure that this has been discussed before, but I have a question. I have written a few port scanners, banner grabbers in the past and have never found a good way to get a range of IP's. Obviously, in my opinion the best and simplest way to do somethign like and simple port scanner is to d

Re: triple quoted strings as comments

2006-01-30 Thread [EMAIL PROTECTED]
as i know, the triple quoted string does cause a runtime construction, and will not be discarded, and it's a benefit of python language. here is sth. useful. _http://diveintopython.org/power_of_introspection/index.html best regard -- http://mail.python.org/mailman/listinfo/python-list

Re: Deterministic destruction and RAII idioms in Python

2006-01-30 Thread Paul Rubin
[EMAIL PROTECTED] writes: > I looked at pep-0343, it looks interesting. It is not what I really > want (deterministic destruction) I think it's better. > As far as my comment about "mainstream" Python, I have always taken > CPython as "Python". I guess this will have to change as Jython and >

Re: Deterministic destruction and RAII idioms in Python

2006-01-30 Thread plahey
Thanks to all who replied. This has definitely given me something to chew on. I looked at pep-0343, it looks interesting. It is not what I really want (deterministic destruction) but it is a lot more than most GC'ed languages give me (Java, I am looking at you... :-) ). As far as my comment abo

incompatible with

2006-01-30 Thread Luke
Built-in functions don't bind to classes like regular functions. Is this intended? (I do notice that the Python Reference Manual sec 3.2 under "Class Instance" refers to a "user-defined function"). Any ideas what the reason is for this distinction between build-in functions and normal functions?

Re: Needing a WinXP Python variant of a line of code

2006-01-30 Thread Ron Rogers Jr.
John Zenger wrote: > import os, os.path > > path_to_nethack_logfile = "" > for root, dirs, files in os.walk("c:\\"): > if 'nethackdir' in root: > logs = [x for x in files if 'logfile' in x] > if len(logs) > 0: > path_to_nethack_logfile = os.path.join(root, logs[0])

Re: Needing a WinXP Python variant of a line of code

2006-01-30 Thread Ron Rogers Jr.
Tim Golden wrote: > [Ron Rogers Jr.] > > | I have this line of code that's written with Linux in mind: > | > | path_to_nethack_logfile = os.popen("locate logfile | grep > | nethackdir").read() > | > | and I'm wanting a Windows equivalent, any suestions? > > Well, you could obviously use os

triple quoted strings as comments

2006-01-30 Thread dmh2000
I recently complained elsewhere that Python doesn't have multiline comments. i was told to use triple quoted strings to make multiline comments. My question is that since a triple quoted string is actually a language construct, does it use cause a runtime construction of a string which is then disc

Re: Fuzzy Lookups

2006-01-30 Thread gene tani
BBands wrote: > Diez B. Roggisch wrote: > > I did a levenshtein-fuzzy-search myself, however I enhanced my version by > > normalizing the distance the following way: > > Thanks for the snippet. I agree that normalizing is important. A > distance of three is one thing when your strings are long, bu

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Bengt Richter
On 30 Jan 2006 14:39:29 -0800, "Paul Boddie" <[EMAIL PROTECTED]> wrote: >Peter Hansen wrote: >> >> I'd agree. I suspect this ought to be reported as a security flaw, >> though it would be nice to know what the fix should be before doing so. >> Anyone know a more suitable approach on Windows tha

Re: Deterministic destruction and RAII idioms in Python

2006-01-30 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Giving up deterministic destruction in Python would be a real blow for > me, since it is one of its unique features among GC'ed languages. > > So what's the deal, can I rely on it in "mainstream" Python or am > I out of luck here? IMO you shouldn't rely on it. I belie

Re: StringIO proposal: add __iadd__

2006-01-30 Thread Tom Anderson
On Sun, 29 Jan 2006, Alex Martelli wrote: > Paul Rubin wrote: > >> Maybe the standard versions of some of these things can be written in >> RPython under PyPy, so they'll compile to fast machine code, and then >> the C versions won't be needed. > > By all means, the C

Re: Unicode strings and ascii regular expressions

2006-01-30 Thread Fredrik Lundh
Fuzzyman wrote: > Can someone confirm that compiled regular expressions from ascii > strings will always (and safely) yield unicode values when matched > against unicode strings ? > > I've tested it and it works - but can someone confirm that this is > consistent and safe ? (No lurking encode erro

Marked-Up Text Viewer for Python/Tkinter

2006-01-30 Thread James Stroud
Hello All, I'm wondering if there is something that already exists that can take marked up text in some format (hopefully reStructuredText or HTML) and can convert it into something that can be displayed with Tkinter (maybe with Text), either dynamically or otherwise. Minimal functionality woul

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Peter Hansen
Bengt Richter wrote: > How about finding the browser via .html association and then letting that > handle the url? E.g., slong the lines of > > >>> import os > >>> ft = os.popen('assoc .html').read().split('=',1)[1].strip() > >>> ft > 'MozillaHTML' > >>> os.popen('ftype %s'%ft).read().split('

Re: dynamic class instantiation

2006-01-30 Thread Kent Johnson
Ognen Duzlevski wrote: > I have a parser that will go through the language definition > file and produce the following as a separate .py file: > > class page(object): > def __init__(): > self.name = None > self.caption = None > self.functions = [] >

Re: simple perl program in python gives errors

2006-01-30 Thread Tom Anderson
On Mon, 30 Jan 2006, Grant Edwards wrote: > On 2006-01-30, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> i was hoping one didnt have to initialize variables because perl >> defaults their value to zero. Also I noticed if I initialize a variable >> as 0 , then I can only do integer math not f

Unicode strings and ascii regular expressions

2006-01-30 Thread Fuzzyman
Hello all, Can someone confirm that compiled regular expressions from ascii strings will always (and safely) yield unicode values when matched against unicode strings ? I've tested it and it works - but can someone confirm that this is consistent and safe ? (No lurking encode errors - I assume it

Re: "Intro to Pyparsing" Article at ONLamp

2006-01-30 Thread Peter Hansen
Terry Reedy wrote: > "Peter Hansen" <[EMAIL PROTECTED]> wrote: >>Christopher Subich wrote: >>>"The horse raced past the barn fell." >>> >>>It's just one of many "garden path sentences," where something that >>>occurs late in the sentence needs to trigger a reparse of the entire >>>sentence. >> >>I

Re: "Intro to Pyparsing" Article at ONLamp

2006-01-30 Thread Steve Holden
Bengt Richter wrote: > On Mon, 30 Jan 2006 16:39:51 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: [...] > > The computer at CMU is pretty good at parsing. You can try it at > http://www.link.cs.cmu.edu/link/submit-sentence-4.html > > Here's what it did with "The horse raced past the barn fel

Re: "Intro to Pyparsing" Article at ONLamp

2006-01-30 Thread Bengt Richter
On Mon, 30 Jan 2006 16:39:51 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: >Christopher Subich wrote: >> Using English, because that's the only language I'm fluent in, consider >> the sentence: >> >> "The horse raced past the barn fell." >> >> It's just one of many "garden path sentences," whe

Re: Newbie question: Unicode hiccup on reading file i just wrote

2006-01-30 Thread Fredrik Lundh
Diez B. Roggisch wrote: > Just don't do any fancy encoding stuff at all, a simple > > rrr=xml.dom.minidom.parseString(open("tt.xml").read()) > > should do. or rrr = xml.dom.minidom.parse("tt.xml") -- http://mail.python.org/mailman/listinfo/python-list

Re: Deterministic destruction and RAII idioms in Python

2006-01-30 Thread Giovanni Bajo
[EMAIL PROTECTED] wrote: > Giving up deterministic destruction in Python would be a real blow for > me, since it is one of its unique features among GC'ed languages. > > So what's the deal, can I rely on it in "mainstream" Python or am > I out of luck here? Most people rely on that. I do that *a

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Paul Boddie
Peter Hansen wrote: > > I'd agree. I suspect this ought to be reported as a security flaw, > though it would be nice to know what the fix should be before doing so. > Anyone know a more suitable approach on Windows than just passing > things off to startfile()? I wouldn't mind knowing if os.sta

Re: "Intro to Pyparsing" Article at ONLamp

2006-01-30 Thread Dave Hansen
On Mon, 30 Jan 2006 16:39:51 -0500 in comp.lang.python, Peter Hansen <[EMAIL PROTECTED]> wrote: >Christopher Subich wrote: >> Using English, because that's the only language I'm fluent in, consider >> the sentence: >> >> "The horse raced past the barn fell." >> >> It's just one of many "garden

Re: Have you any idea how to make window transparent using pygame?

2006-01-30 Thread Diez B. Roggisch
Terry Hancock schrieb: > On 30 Jan 2006 08:52:04 -0800 > "kishkin" <[EMAIL PROTECTED]> wrote: >> I just want to make window transparent. ;) At this moment >> I've found only ideas of taking screenshots to make >> background... Anything else? > > You are looking for "alpha" surfaces. In a full RGB

Re: Newbie question: Unicode hiccup on reading file i just wrote

2006-01-30 Thread Diez B. Roggisch
Darcy schrieb: > hi all, i have a newbie problem arising from writing-then-reading a > unicode file, and i can't work out what syntax i need to read it in. > > the syntax i'm using now (just using quick hack tmp files): > BEGIN > f=codecs.open("tt.xml","r","utf8") > fwrap=codecs.EncodedFile(f,"as

Re: templates

2006-01-30 Thread Bruno Desthuilliers
projecktzero a écrit : > For some of the web programming I've done in Python, I've used > htmltmpl. I had some experience with it in Perl, and found a Python > version. > > http://htmltmpl.sourceforge.net/ > > I like that there's nearly a complete separation between the > presentation and the cod

Re: "Intro to Pyparsing" Article at ONLamp

2006-01-30 Thread Terry Reedy
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Christopher Subich wrote: >> Using English, because that's the only language I'm fluent in, consider >> the sentence: >> >> "The horse raced past the barn fell." >> >> It's just one of many "garden path sentences," where

Re: dynamic class instantiation

2006-01-30 Thread Larry Bates
Ognen Duzlevski wrote: > Larry Bates <[EMAIL PROTECTED]> wrote: >>> Now I want to use something like xml.dom.minidom to "parse" the >>> .xml file into a set of classes defined according to the "language >>> definition" file. The parse() method from the xml.dom.minidom >>> package will return a d

Re: Deterministic destruction and RAII idioms in Python

2006-01-30 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The problem is that other implementations of > Python (Jython and IronPython) do not support deterministic > destruction. So we are left with a problem: is deterministic > destruction an implementation detail of CPython that can go a

Re: winsound.MessageBeep

2006-01-30 Thread 3c273
"Larry Bates" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > You need to call winsound.MessageBeep(winsound.MB_OK) > > (e.g. MB_OK isn't automatically bound to anything). > Thanks so much Louis -- http://mail.python.org/mailman/listinfo/python-list

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Bengt Richter
On Mon, 30 Jan 2006 16:00:25 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: >Blair P. Houghton wrote: >> I'm going to try it out on a remote server later today. > >Don't bother. I've confirmed the behaviour you saw, and that it is not >what I'd expect either. My Firefox certainly isn't configur

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread olsongt
Http protocol give the content-type in the http headers, so the originating server determines how your browser is going to handle it, not the client browser. I think the problem is that the 'file://' protocol probably does use the registry keys above since it's not getting any HTTP headers. -- h

Re: Module imports

2006-01-30 Thread Gary Herron
[EMAIL PROTECTED] wrote: >I have written a number of functions and stored them in a file named >myFunctions.py. This keeps all my functions under one roof, and if I >want to use or one or more of them in a program, I can start the >program off with > >from myFunctions import f1,f2 > >Some of these

Re: "Intro to Pyparsing" Article at ONLamp

2006-01-30 Thread Peter Hansen
Christopher Subich wrote: > Using English, because that's the only language I'm fluent in, consider > the sentence: > > "The horse raced past the barn fell." > > It's just one of many "garden path sentences," where something that > occurs late in the sentence needs to trigger a reparse of the e

Re: winguiauto

2006-01-30 Thread Peter Hansen
puff wrote: > You'll have to give me a bit of slack as I'm new to python. Much > python development seems to be hosted on sourceforge. There are a > couple of copies there with a number of modifications that seem to > center on waiting for windows to exist. There is also the copy on > Brunning's

Re: Find directory name of file?

2006-01-30 Thread Peter Hansen
Blair P. Houghton wrote: > Wanna see something freaky? > > In IDLE, I type the following: > > >>> import sys > >>> import os.path > >>> os.path.abspath(sys.argv[0]) > 'C:\\Program Files\\Python\\2.4' > > Pretty normal, right? Depends on your definition of normal. That doesn't

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Peter Hansen
Peter Hansen wrote: > I'd agree. I suspect this ought to be reported as a security flaw, > though it would be nice to know what the fix should be before doing so. > Anyone know a more suitable approach on Windows than just passing > things off to startfile()? It appears the correct approach mi

Re: Jython on the Palm OS?

2006-01-30 Thread Khalid Zuberi
gregarican gmail.com> writes: > > I have completed recoding my CRM app into Python so that it will run on > Win32, ARM Linux, and ARM Windows Mobile platforms. Now I am looking to > try to roll it into the Palm OS platform. Since Pippy is based on an > older version of Python than I am using for

Re: dynamic class instantiation

2006-01-30 Thread Ognen Duzlevski
Larry Bates <[EMAIL PROTECTED]> wrote: > > Now I want to use something like xml.dom.minidom to "parse" the > > .xml file into a set of classes defined according to the "language > > definition" file. The parse() method from the xml.dom.minidom > > package will return a document instance and I ca

Re: winguiauto

2006-01-30 Thread puff
You'll have to give me a bit of slack as I'm new to python. Much python development seems to be hosted on sourceforge. There are a couple of copies there with a number of modifications that seem to center on waiting for windows to exist. There is also the copy on Brunning's site without these mo

Re: instance references?

2006-01-30 Thread Scott David Daniels
Alex Martelli wrote: > My favourite way to use weakref is slightly different: I would have >aptbase.drawables = weakref.WeakValueDictionary typo here: aptbase.drawables = weakref.WeakValueDictionary() > then in each __init__ >aptbase.drawables[len(aptbase.drawables)] = self > then in

Module imports

2006-01-30 Thread tkpmep
I have written a number of functions and stored them in a file named myFunctions.py. This keeps all my functions under one roof, and if I want to use or one or more of them in a program, I can start the program off with from myFunctions import f1,f2 Some of these functions require various math ro

Re: winsound.MessageBeep

2006-01-30 Thread Larry Bates
3c273 wrote: > Hello, > I was trying to use the MessageBeep fuction to play different system sounds, > but using the syntax in the docs, all I can get is the default sound.. While > I finally got my sounds to play using PlaySound, I am curious as to what I > was doing wrong with MessageBeep. (Win20

Re: "Intro to Pyparsing" Article at ONLamp

2006-01-30 Thread Christopher Subich
Anton Vredegoor wrote: > And pave the way for a natural language parser. Maybe there's even some > (sketchy) path now to link computer languages and natural languages. In > my mind Python has always been closer to human languages than other > programming languages. From what I learned about it, lan

Re: dynamic class instantiation

2006-01-30 Thread Larry Bates
Ognen Duzlevski wrote: > Hi, I have a "language definition" file, something along the lines of: > > page :: > name : simple > caption : simple > function : complex > > function :: > name : simple > code : simple > > component :: > name : simple > type :

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Peter Hansen
Blair P. Houghton wrote: > I'm going to try it out on a remote server later today. Don't bother. I've confirmed the behaviour you saw, and that it is not what I'd expect either. My Firefox certainly isn't configured to run .py scripts even when invoked with the "file:" protocol, so webbrowser

winsound.MessageBeep

2006-01-30 Thread 3c273
Hello, I was trying to use the MessageBeep fuction to play different system sounds, but using the syntax in the docs, all I can get is the default sound.. While I finally got my sounds to play using PlaySound, I am curious as to what I was doing wrong with MessageBeep. (Win2000 & XP) >From the doc

Re: winguiauto

2006-01-30 Thread Peter Hansen
puff wrote: > There seem to be a number of winguiauto(s) available on the net. Is > there any 'offical' version? More official than the author's own site? -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Blair P. Houghton
Sorry...should read: "I did use the script to fetch remote HTML (url='http://www.python.org') before I tried the local file, and it opened the webpage in Firefox." Too many chars, too few fingers. --Blair -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible memory leak?

2006-01-30 Thread Tuvas
The reason it's done in width and heigth is that there is some other non-related processing functions that were going on in the mean time with the problem. I found the source of the slow-down, when 2 non-important lines of code were commented out, the program worked perfectly.

Re: Find directory name of file?

2006-01-30 Thread Blair P. Houghton
Grant Edwards wrote: > Try something like this at the beginning of your program and > see if it does what you want: > > print os.path.abspath(sys.argv[0]) Wanna see something freaky? In IDLE, I type the following: >>> import sys >>> import os.path >>> os.path.abspath(sys.argv[0])

Deterministic destruction and RAII idioms in Python

2006-01-30 Thread plahey
I have been dabbling in Python for a while now. One of the things that really appeals to me is that I can seem to be able to use C++-style RAII idioms to deal with resource management issues. For those that have no idea what I am talking about (I learn a lot reading posts on subjects in which I a

dynamic class instantiation

2006-01-30 Thread Ognen Duzlevski
Hi, I have a "language definition" file, something along the lines of: page :: name : simple caption : simple function : complex function :: name : simple code : simple component :: name : simple type : simple dataset : complex

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-30 Thread Blair P. Houghton
I'm going to try it out on a remote server later today. I did use this script to fetch remote HTML (url='http://www.python.org') before I tired the remote file, and it opened the webpage in Firefox. I may also try to poke around in webbrowser.py, if possible, to see if I can see whether it's sele

Re: Language Semantics: @ symbol??

2006-01-30 Thread James Stroud
Peter Hansen wrote: > Steven D'Aprano wrote: > >> James Stroud wrote: >> >>> http://www.google.com/search?q=@ >> >> >> Doesn't work for me, I just get an (almost) empty Google page. Doesn't >> even say "No results were found", just a Google logo, some standard >> links in the footer, text box, e

  1   2   >