Re: ignore specific data

2005-11-21 Thread Bengt Richter
On 21 Nov 2005 13:59:12 -0800, [EMAIL PROTECTED] wrote: >I tried the solutions you provided..these are not as robust as i >thought would be... >may be i should put the problem more clearly... > >here it goes > >I have a bunch of documents and each document has a header which is >common to all

Re: Backwards compatibility [was Re: is parameter an iterable?]

2005-11-21 Thread Fredrik Lundh
Alex Martelli wrote: > > In the specific case of iter(), are there good > > alternative ways of detecting an iterable without > > consuming it? > > Not a problem I've had often, but when I did, if I recall correctly, I > did something like: > > try: > iter > except NameError: > def isiterable(

Re: Any royal road to Bezier curves...?

2005-11-21 Thread Claudio Grondi
> http://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm > has a Python example implementation of qubic Bezier curves available. Here my port to Tkinter (doesn't need PIL) from Tkinter import * master = Tk() objTkCanvas = Canvas(master, width=110, height=180) objTkCanvas.pack() def midpoint((x1

Re: How to paste python code on wordpress?

2005-11-21 Thread could ildg
Thank you very much Dan.I settle the problem according to you tips.On 11/22/05, Dan Lowe <[EMAIL PROTECTED] > wrote:On Nov 22, 2005, at 12:30 AM, could ildg wrote:> Thank you~ > It works!> but how can paste "<" and ">", please?> these 2 symbols will also confuse wordpress and I can't publish> what

Re: Any royal road to Bezier curves...?

2005-11-21 Thread Claudio Grondi
http://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm has a Python example implementation of qubic Bezier curves available. Claudio "Warren Francis" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > I'm fairly new to Python (2-3 months) and I'm trying to figure out a simple >

Re: Any college offering Python short term course?

2005-11-21 Thread Neal Norwitz
There is the BayPiggies user group: [EMAIL PROTECTED] It meets monthly alternating between Mt. VIew (Google) and San Bruno (IronPort). n -- bruce wrote: > hey... > > i'm looking for classes (advanced) in python/php in the bay area as well... > actually i'm looking for the students/teachers/prof

Re: Command line

2005-11-21 Thread Bengt Richter
On Mon, 21 Nov 2005 19:39:42 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: >amfr wrote: >> Thanks for your help. Another question, is there an built in md5/sha1 >> function in python? > >Yes. > >Although it's a long list, it is worthwhile as a newbie for one to >peruse the list of standard modu

Re: How to paste python code on wordpress?

2005-11-21 Thread Dan Lowe
On Nov 22, 2005, at 12:30 AM, could ildg wrote: > Thank you~ > It works! > but how can paste "<" and ">", please? > these 2 symbols will also confuse wordpress and I can't publish > what I want. Replace < with < Replace > with > (where those abbreviations stand for "less than" and "greater t

Looking for magic method to override to prevent dict(d) from grabbing subclass inst d contents directly

2005-11-21 Thread Bengt Richter
Has anyone found a way besides not deriving from dict? Shouldn't there be a way? TIA (need this for what I hope is an improvement on the Larosa/Foord OrderedDict ;-) I guess I can just document that you have to spell it dict(d.items()), but I'd like to hide the internal shenanigans ;-) Regards, B

Re: Backwards compatibility [was Re: is parameter an iterable?]

2005-11-21 Thread Steven D'Aprano
Alex Martelli wrote: > "Consuming" didn't really come into consideration for the > backwards compatibility part because only objects indexable with > integers, 0 and up (and raising IndexError at some point) were usable in > for statements in old Pythons, there was no "consuming". Ah yes, of cour

Re: keys in dictionary

2005-11-21 Thread Martin v. Löwis
Shi Mu wrote: > I run the following code and got wrong message, but I still want to > make [1,2],[4,3] and [6,9] to be keys of the dictionary or change the > style a little bit. How to do that? Make them tuples: >>> p=[[1,2],[4,3],[6,9]] >>> n=dict([(tuple(x),[]) for x in p]) >>> n {(6, 9): [

Re: linking one extension module to another (Mac OSX)

2005-11-21 Thread Martin v. Löwis
Simon Burton wrote: > I'm having some trouble linking one extension module to another because > the linker expects a "lib" prefix and my python modules cannot have > this prefix. This is a Good Thing (tm) :-) Don't link extension modules to each other; this is really asking for trouble. Instead, c

Re: IPv6 RFC 3542 with socket module?

2005-11-21 Thread Martin v. Löwis
Roy Smith wrote: > Is there any way to access the RFC 3542 defined macros such as > ICMP6_FILTER_SETPASSALL() from within the socket module? No. Not sure it would belong into the socket module, though: an icmp module could be developed independently from the socket module if needed. Regards, Ma

keys in dictionary

2005-11-21 Thread Shi Mu
I run the following code and got wrong message, but I still want to make [1,2],[4,3] and [6,9] to be keys of the dictionary or change the style a little bit. How to do that? Thanks! >>> p=[[1,2],[4,3],[6,9]] >>> n=dict([(x,[]) for x in p]) Traceback (most recent call last): File "", line 1, in ?

python gui using boa

2005-11-21 Thread Ashok
hi, i am trying to develop a small gui app using boa constructor. say this app has one frame which has one static text control. i want the frame to resize itself to the width of the text contrl when i change the label of the text control via SetLabel(). how can i do this in boa constructor? can an

Re: How to paste python code on wordpress?

2005-11-21 Thread could ildg
Thank you~It works!but how can paste "<" and ">", please?these 2 symbols will also confuse wordpress and I can't publish what I want.On 11/22/05, Dan Lowe <[EMAIL PROTECTED]> wrote: On Nov 21, 2005, at 8:17 PM, could ildg wrote:> Wordpress.com blog will eat up the spaces before a line,> just as it

Re: bsddb185 question

2005-11-21 Thread Martin v. Löwis
thakadu wrote: > So it seems I am forced to use the bsddb185 module > which does not have convenient record level methods. > Am I missing something here or have others eperienced > tha same? I think you are missing that bsddb185 implements the dictionary interface. So you can use [key] to access t

linking one extension module to another (Mac OSX)

2005-11-21 Thread Simon Burton
Hi, I'm having some trouble linking one extension module to another because the linker expects a "lib" prefix and my python modules cannot have this prefix. I found two ways of doing it on a linux box (either symlink or create a dummy .so that links to extension module) but I can get neither of

Re: ownership problem?

2005-11-21 Thread Alex Martelli
Jeffrey Schwab <[EMAIL PROTECTED]> wrote: ... > > You may be gratified to learn that Python's main storage model > > is reference counted objects, and when an object falls out of > > all referenced scopes its finalizers run immediately. > > Thanks, that's good to know! For some reason I had it

IPv6 RFC 3542 with socket module?

2005-11-21 Thread Roy Smith
Is there any way to access the RFC 3542 defined macros such as ICMP6_FILTER_SETPASSALL() from within the socket module? A dir() on the socket module (Python 2.4.1, built on a solaris box with IPv6 support) doesn't show anything that looks like it (and socket.has_ipv6 is True). -- http://mail.p

Application Plugin Framework

2005-11-21 Thread Ron
Hello, I'm attempting to develop a plugin framework for an application that I'm working on. I wish to develop something in which all plugins exist in a directory tree. The framework need only be given the root of the tree. The framework then uses os.path.walk to search all for all files nam

Re: Preventing modules to be read from current working directory

2005-11-21 Thread ssjassal
Great, thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Backwards compatibility [was Re: is parameter an iterable?]

2005-11-21 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: ... > In the specific case of iter(), are there good > alternative ways of detecting an iterable without > consuming it? Not a problem I've had often, but when I did, if I recall correctly, I did something like: try: iter except NameError: def i

Re: Preventing modules to be read from current working directory

2005-11-21 Thread Roy Smith
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Is there a way to instruct Python to import modules from standard > library even if there is one with the same name in the current working > directory? I was trying to import BaseHTTPServer.py from standard > library but was prevented by

Preventing modules to be read from current working directory

2005-11-21 Thread ssjassal
Is there a way to instruct Python to import modules from standard library even if there is one with the same name in the current working directory? I was trying to import BaseHTTPServer.py from standard library but was prevented by a python file with the same name in current working directory (but

Backwards compatibility [was Re: is parameter an iterable?]

2005-11-21 Thread Steven D'Aprano
Fredrik Lundh wrote: > Steven D'Aprano wrote: > > >>Alas and alack, I have to write code which is backwards >>compatible with older versions of Python: [snip] >>What should I do when I can't rely on functions that >>don't exist in older versions of Python? > > > python 2.1 doesn't support it

Re: path module / class

2005-11-21 Thread [EMAIL PROTECTED]
Peter Hansen wrote: > Okay, granted. I guess this is the same as in any other case of > deprecation (e.g. some people still have to work with code that uses > apply() or string module methods). Yup, this is exactly what will have to happen. Most or all of os.path and maybe some of os/glob/fnmatc

Re: Hot to split string literals that will across two or more lines ?

2005-11-21 Thread Mohammad Jeffry
On 11/22/05, Paul McGuire <[EMAIL PROTECTED]> wrote: Or for a large literal string:"""lots of text hundreds of characters long more text on another line but we really don't want any line breaksin our final stringso we replace newlines in this multiline stringwith an empty string thus""".replace('\n

Re: mxODBC sql MSAccess

2005-11-21 Thread BartlebyScrivener
Works!! Thank you all so much. I didn't know it was coming back as a tuple, and I'm sure that would have taken me four hours to figure out. Appreciate it! bs Chris Curvey wrote: > mxODBC implements the Python DB-API spec, which states that each "row" > of query results is returned as

pipe related question

2005-11-21 Thread David Reed
Is there any way to have one program run another arbitrary program with input from stdin and display the output as if you had run it in a shell (i.e., you'd see some of the output followed by the input they typed in and then a newline because they pressed return followed by subsequent outp

Re: How to paste python code on wordpress?

2005-11-21 Thread Dan Lowe
On Nov 21, 2005, at 8:17 PM, could ildg wrote: > Wordpress.com blog will eat up the spaces before a line, > just as it will trim every line of my article. So I can't paste > python code indentedly. > Does any one use wordpress blog here? > Please tell me how to leave the sapces as they are when

Re: mxODBC sql MSAccess

2005-11-21 Thread Chris Curvey
mxODBC implements the Python DB-API spec, which states that each "row" of query results is returned as a tuple. If you want the data displayed differently, you can do it yourself. for row in rows: print "\t".join(row) should do it. -- http://mail.python.org/mailman/listinfo/python-list

Re: mxODBC sql MSAccess

2005-11-21 Thread [EMAIL PROTECTED]
BartlebyScrivener wrote: > Hello, I'm new to python and trying to get records from an MSAccess > database using mxODBC. It works, but the output is not formatted the > way I want it. > > Here's the script: > > import mx.ODBC.Windows as odbc > > driv='DRIVER={Microsoft Access Driver (*.mdb)};DBQ=d:

Re: Any royal road to Bezier curves...?

2005-11-21 Thread Scott David Daniels
The Bezier gives control points with natural interpretations and a nice "within the convex hull" property. I happen to like Beziers to control curves which are aestheticly, rather than computationally defined. -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo

How to paste python code on wordpress?

2005-11-21 Thread could ildg
Wordpress.com blog will eat up the spaces before a line, just as it will trim every line of my article. So I can't paste python code indentedly. Does any one use wordpress blog here? Please tell me how to leave the sapces as they are when publishing ariticles on the blog, Thank you. -- http://mail

mxODBC sql MSAccess

2005-11-21 Thread BartlebyScrivener
Hello, I'm new to python and trying to get records from an MSAccess database using mxODBC. It works, but the output is not formatted the way I want it. Here's the script: import mx.ODBC.Windows as odbc driv='DRIVER={Microsoft Access Driver (*.mdb)};DBQ=d:/Access Databases/Quotations2005' conn =

Re: Python install minimum requirements

2005-11-21 Thread jepler
If I found the right "U3" when I googled, then maybe this is relevant: http://www.voidspace.org.uk/python/movpy/ Jeff pgp1AjuUdEskN.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Alex Martelli
Christoph Zwerschke <[EMAIL PROTECTED]> wrote: ... > But I think the following rule is "natural" enough to consider it as THE > standard behavior of ordered dictionaries: > > "Insertion: If the key exists: Don't change the order. If it does not > exist: Append it to the sequence of keys. Deleti

Re: Command line

2005-11-21 Thread Peter Hansen
amfr wrote: > Thanks for your help. Another question, is there an built in md5/sha1 > function in python? Yes. Although it's a long list, it is worthwhile as a newbie for one to peruse the list of standard modules from time to time, until you gain a familiarity with what is there. http://docs

Re: BaseHTTPServer module

2005-11-21 Thread amfr
Thanks, all I wanted to know where the post data was stored from the request -- http://mail.python.org/mailman/listinfo/python-list

Re: Command line

2005-11-21 Thread amfr
Thanks for your help. Another question, is there an built in md5/sha1 function in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: the name of a module in which an instance is created?

2005-11-21 Thread Mardy
Hi Steven, Le die Mon, 21 Nov 2005 11:37:37 -0700, Steven Bethard ha scribite: [...] > In the basic situation, where the instance is created in the same module > as the class, I can figure out 'mod' and 'name' like:: > > cls = type(self) > name = cls.__module__ > mod = __import__(c

Re: Advice on distutils and distribution policies

2005-11-21 Thread Mardy
Hi Magnus, thanks a lot for your posting, you made me clear several things. However, there something I still want to discuss: Le die Mon, 21 Nov 2005 20:08:24 +0100, Magnus Lycka ha scribite: [...] > In an apache cgi-bin directory: The main Python CGI script(s) that are > called by the web serve

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Bengt Richter
On 21 Nov 2005 01:54:38 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >Fredrik Lundh wrote: >> [EMAIL PROTECTED] wrote: >> >> > If I need the dict feature 90% of the time, and the list feature 10% of >> > the time. >> >> Wasn't your use case that you wanted to specify form fields in >> a

Re: setattr for secondary attribute

2005-11-21 Thread Bengt Richter
On 20 Nov 2005 20:34:39 -0800, "Alex" <[EMAIL PROTECTED]> wrote: >I apologize for asking maybe a very trivial question. >I have a new class object A with slots. One of the slots is, for >example, object spam. Object spam, in turn, also has slots and one of >them is attribute eggs. I need to assig

Re: best cumulative sum

2005-11-21 Thread Bengt Richter
On Mon, 21 Nov 2005 15:23:20 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >David (Alan) Isaac wrote: > >> What's the good way to produce a cumulative sum? >> E.g., given the list x, >> cumx = x[:] >> for i in range(1,len(x)): >> cumx[i] = cumx[i]+cumx[i-1] >> >> What's the better way? > >Is

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Bengt Richter
On Mon, 21 Nov 2005 01:27:22 +0100, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: >Fredrik Lundh wrote: >> if you restructure the list somewhat >> d = ( >> ('pid', ('Employee ID', 'int')), >> ('name', ('Employee name', 'varchar')), >> ('sal', ('Salary', 'float')) >>

Re: Tkinter's coordinates setting

2005-11-21 Thread Steve Juranich
On 11/17/05, Shi Mu <[EMAIL PROTECTED]> wrote: > why subtract 1 from max_y - original_y? Because in the computer science world we like starting to count at 0. image_size = 1000 original_y = 25 # Really the 26th pixel line. new_y = 1000 - 25 - 1 # 26 pixels from the bottom of the screen. -- Steve

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Bengt Richter
On 20 Nov 2005 21:12:52 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >Bengt Richter wrote: >> On Sun, 20 Nov 2005 22:03:34 +0100, Christoph Zwerschke <[EMAIL PROTECTED]> >> wrote: >> >> Ordering the keys isn't the normal case, and can be done easily when >> >> needed. >> > >> >That dep

Re: Command line

2005-11-21 Thread Bengt Richter
On 20 Nov 2005 12:00:02 -0800, "amfr" <[EMAIL PROTECTED]> wrote: >Hoe would I call something on the command line from python, e.g. "ls >-la"? > Depends on how much control you want over where the output goes. If you want the result as a multi-line string formatted the way the system utility (ls he

Re: Hot to split string literals that will across two or more lines ?

2005-11-21 Thread Paul McGuire
"Ben Finney" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Xiao Jianfeng <[EMAIL PROTECTED]> wrote: > > I need to print a long sting, which is two long so it must expand > > two lines. > > How is this string being constructed in the source? If it exists as a > single long string, wh

Re: need help about time.sleep, timer

2005-11-21 Thread Bengt Richter
On Mon, 21 Nov 2005 10:35:20 +0200, Sinan Nalkaya <[EMAIL PROTECTED]> wrote: >Dennis Lee Bieber wrote: > >>On Fri, 18 Nov 2005 22:45:37 -0500, Peter Hansen <[EMAIL PROTECTED]> >>declaimed the following in comp.lang.python: >> >> >> >>>It's quite unclear whether the last part, above, is one of yo

Re: Any royal road to Bezier curves...?

2005-11-21 Thread Tom Anderson
On Mon, 21 Nov 2005, Tom Anderson wrote: > On Sun, 20 Nov 2005, Warren Francis wrote: > >> Basically, I'd like to specify a curved path of an object through space. 3D >> space would be wonderful, but I could jimmy-rig something if I could just >> get 2D... Are bezier curves really what I want a

Re: Command line

2005-11-21 Thread amfr
What I am trying to do is call perl on the command line. Also, do any of these functions return the data recievved from the command? -- http://mail.python.org/mailman/listinfo/python-list

Python install minimum requirements

2005-11-21 Thread Philippe C. Martin
Hi, I am attemtping to package Python in a "U3" install program for Windows. I got Python to compile/link and prior to adding the necessary code for the U3 SDK registration, I would like to know where I can find the actual list of files needed for a minimum installation (are DLLs and libs enough

Re: Web-based client code execution

2005-11-21 Thread Kent Johnson
Paul Watson wrote: > My desire to have the code distributed through a web page is just to > ensure that the user is running the correct version and has not hacked > it in any way. I suppose I can checksum the local client application > and compare it with what is on the server. Then, make a wa

Re: Aproximative string matching

2005-11-21 Thread Irmen de Jong
javuchi wrote: > I'm searching for a library which makes aproximative string matching, > for example, searching in a dictionary the word "motorcycle", but > returns similar strings like "motorcicle". > > Is there such a library? > Perhaps the get_close_matches function that is presentt in the st

Re: compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
Thanks, Regards, Philippe "Martin v. Löwis" wrote: > Philippe C. Martin wrote: >>>My mistake: The makefile (as written in the readme!) looks for bzip 1.0.2 >>> >> >> PS: since bzip.org does not have 1.0.2 source anymore, can I just rename >> 1.0.3 ? > > That should work; alternatively, you c

Help with modal in Gtk::FileChooserDialog

2005-11-21 Thread Thierry Lam
Does anyone know how to set modal to True for Gtk::FileChooserDialog? Thanks Thierry -- http://mail.python.org/mailman/listinfo/python-list

Re: Aproximative string matching

2005-11-21 Thread Steven D'Aprano
On Mon, 21 Nov 2005 19:47:45 +0100, Diez B. Roggisch wrote: > The idea is that otherwise e.g. "cat" and "hippopothamus" have a > l-distance of only 3, which one would consider good at the first look. ??? I make it that the L-distance between cat and hippopothamus is twelve, not three. With len(

Piecewise-cubic lookup table generator

2005-11-21 Thread Will Ware
I needed to generate some C code for a fast lookup table using piecewise-cubic interpolation. If anybody else needs this, the Python code for it is at http://tinyurl.com/92zcs (alt.source, Google Groups). Will Ware -- http://mail.python.org/mailman/listinfo/python-list

bsddb185 question

2005-11-21 Thread thakadu
I have an application that needs to create and delete records in a Berkeley DB version 1.85 database. If I use the bsdddb185 module I dont see any of the record manipulation methods in there that are available in the newer bsddb module. (put(), get(), pop() etc) I know the docs say that one should

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Christoph Zwerschke
Fredrik Lundh wrote: > I'll repeat this one last time: for the use cases presented by Zwerschke > and "bonono", using a list as the master data structure, and creating the > dictionary on demand, is a lot faster than using a ready-made ordered > dict implementation. if you will access things via t

Re: running functions

2005-11-21 Thread [EMAIL PROTECTED]
Tom Anderson wrote: > > If you program threads with shared nothing and communication over Queues > > you are, in effect, using processes. If all you share is read-only > > memory, similarly, you are doing "easy" stuff and can get away with it. > > In all other cases you need to know things like "w

Re: ignore specific data

2005-11-21 Thread pkilambi
I tried the solutions you provided..these are not as robust as i thought would be... may be i should put the problem more clearly... here it goes I have a bunch of documents and each document has a header which is common to all files. I read each file process it and compute the frequency of w

Re: How to install python2.4.2 on IRIX6.5 ?

2005-11-21 Thread Martin v. Löwis
Xiao Jianfeng wrote: > self.assertEquals(result, expected) > AssertionError: '-0' != '0' > > Can somebody tell me what's the problem ? It looks like there is some minor bug in the floating point libraries of your operating system: Python expects that the strings for both numbers are the same in t

Re: compiling Python under Windows

2005-11-21 Thread Martin v. Löwis
Philippe C. Martin wrote: >>My mistake: The makefile (as written in the readme!) looks for bzip 1.0.2 >> > > PS: since bzip.org does not have 1.0.2 source anymore, can I just rename > 1.0.3 ? That should work; alternatively, you can change the project file. Regards, Martin -- http://mail.python

Re: ownership problem?

2005-11-21 Thread Jeffrey Schwab
Donn Cave wrote: > In article <[EMAIL PROTECTED]>, > Jeffrey Schwab <[EMAIL PROTECTED]> wrote: > > >>Yes it is. Memory is only one type of resource. There are still files >>and sockets to close, pipes to flush, log messages to be printed, GDI >>contexts to free, locks to release, etc. I

Re: Reading a subprocesses stdout on Windows

2005-11-21 Thread Do Re Mi chel La Si Do
Hi! Let down subprocess, and remember popen4. Here, an example (with CMD, under w-XP) : import os def lcmd(lst=None): a = os.popen4(lst[0]) for i in lst[1:]: if i!='': a[0].write(i+'\r\n') a[0].flush() return a[1].readlines() l=[ 'CMD /K', 'DIR *.c

Re: ownership problem?

2005-11-21 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Jeffrey Schwab <[EMAIL PROTECTED]> wrote: ... > Yes it is. Memory is only one type of resource. There are still files > and sockets to close, pipes to flush, log messages to be printed, GDI > contexts to free, locks to release, etc. In C++, these things are >

Re: Numeric array in unittest problem

2005-11-21 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Sorry Peter, > Try this > > import unittest > import Numeric > > class myTest(unittest.TestCase): > def runTest(self): > var1 = Numeric.array([1,22]) > var2 = Numeric.array([1,33]) > self.assertEqual(var1,var2) > > if __name__ == '__main

Re: ignore specific data

2005-11-21 Thread Mike Meyer
[EMAIL PROTECTED] writes: > thanks for that. But this will check for the exact content of the > "start of block.." or "end of block". How about if the content is > anywhere in the line? Then the test is '"start of block." in line'. You could also use the line.find or line.index methods, b

Re: Reading a subprocesses stdout on Windows

2005-11-21 Thread brolewis
commands is Unix only. This is Windows specific -- http://mail.python.org/mailman/listinfo/python-list

Re: Advice on distutils and distribution policies

2005-11-21 Thread Magnus Lycka
Mardy wrote: > Hi, > I've built a small project (http://eligante.sf.net) which I'm actually > trying to package using distutils. ... > However, I don't know if this directory layout is suitable for > site-packages, since at a first glance it looks to me that datafiles might > not be welcome under

Re: Reading a subprocesses stdout on Windows

2005-11-21 Thread Klaus Alexander Seistrup
BroLewis wrote: > I have been trying for several weeks now to write a program that > allows me to read the stdout of a process that I spawn and once > I receive feedback, act appropriately. Have you looked into the 'commands' module? Cheers, -- Klaus Alexander Seistrup Copenhagen, Denmark ht

Reading a subprocesses stdout on Windows

2005-11-21 Thread brolewis
I have been trying for several weeks now to write a program that allows me to read the stdout of a process that I spawn and once I receive feedback, act appropriately. More specifically, I need to create an SSH tunnel using plink on Windows XP. Once the tunnel is successfully created, then I need

Re: ignore specific data

2005-11-21 Thread pkilambi
thanks for that. But this will check for the exact content of the "start of block.." or "end of block". How about if the content is anywhere in the line? -- http://mail.python.org/mailman/listinfo/python-list

Help in File selector window in pygtk

2005-11-21 Thread Thierry Lam
Let's say I have a main window which has a File menu. When I click on the File menu and the open button, I have a File selector window which comes in front of my main window. How do I make the main window unselectable? Thanks Thierry -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Kay Schluehr
Fredrik Lundh wrote: > huh? if you want a list, use a list. > > d = [('a', {...}), ('b', {})] If one wants uniform access to a nested data structure like this one usually starts writing a wrapper class. I do not think the requirement is anyhow deeper than a standard wrapper around such a

Re: best cumulative sum

2005-11-21 Thread David Isaac
> Alan Isaac wrote: >> Like SciPy's cumsum. "Colin J. Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Doesn't numarray handle this? Sure. One might say that numarray is in the process of becoming scipy. But I was looking for a solution when these are available. Something

Re: ignore specific data

2005-11-21 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Hi I need help. What I want to do is If I read a file with some text > content... > I would like to ignore a block of lines and consider the rest.. > so if the block starts with > > "start of block." > fjesdgsdhfgdlgjklfjdgkd > jhcsdfskdlgjkljgkfdjkgj > "end

Re: compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
Philippe C. Martin wrote: > My mistake: The makefile (as written in the readme!) looks for bzip 1.0.2 > PS: since bzip.org does not have 1.0.2 source anymore, can I just rename 1.0.3 ? Regards, Philippe > Sorry, > > Philippe > > > > Philippe C. Martin wrote: > >> Hi, >> >> I'm currently

Re: Underscores in Python numbers

2005-11-21 Thread Eric Jacoboni
[EMAIL PROTECTED] (Bengt Richter) writes: >>Eric Jacoboni, ne il y a 1435938104 secondes > Um, about your sig ... ;-) Well, i confess it's Ruby code... Maybe, one day, i will try to write a Python Version (with DateTime, i guess?) but i'm afraid it doesn't change the result. -- Eric Jacoboni, ne

Re: compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
My mistake: The makefile (as written in the readme!) looks for bzip 1.0.2 Sorry, Philippe Philippe C. Martin wrote: > Hi, > > I'm currently blocking on bzip2: > > python is in c:\python.2.4.2 > and bz2 is in c:\bzip2-1.0.3 > > Since the readme say subprojects should be two directories abov

compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
Hi, I'm currently blocking on bzip2: python is in c:\python.2.4.2 and bz2 is in c:\bzip2-1.0.3 Since the readme say subprojects should be two directories above PCbuild, I assume I'm OK. I added c:\bzip2-1.0.3 to the include and link path, but I get: """ Performing Pre-Link Event ... The system

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Tom Anderson
On Sun, 20 Nov 2005, Alex Martelli wrote: > Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > >> The 'sorted' function does not help in the case I have indicated, where >> "I do not want the keys to be sorted alphabetically, but according to >> some criteria which cannot be derived from the keys

Re: Any royal road to Bezier curves...?

2005-11-21 Thread Tom Anderson
On Sun, 20 Nov 2005, Warren Francis wrote: > Basically, I'd like to specify a curved path of an object through space. > 3D space would be wonderful, but I could jimmy-rig something if I could > just get 2D... Are bezier curves really what I want after all? No. You want a natural cubic spline:

Re: Aproximative string matching

2005-11-21 Thread Diez B. Roggisch
Steven D'Aprano wrote: > [EMAIL PROTECTED] wrote: > >> This algorithm is called soundex. Here is one implementation example. >> >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52213 >> >> here is another: >> http://effbot.org/librarybook/soundex.htm > > > Soundex is *one* particular a

Re: ignore specific data

2005-11-21 Thread skip
pkilambi> I would like to ignore a block of lines and consider the pkilambi> rest.. so if the block starts with pkilambi> "start of block." pkilambi> fjesdgsdhfgdlgjklfjdgkd pkilambi> jhcsdfskdlgjkljgkfdjkgj pkilambi> "end of block" pkilambi> I want to ig

the name of a module in which an instance is created?

2005-11-21 Thread Steven Bethard
The setup: I'm working within a framework (designed by someone else) that requires a number of module globals to be set. In most cases, my modules look like: (1) a class definition (2) the creation of one instance of that class (3) binding of the instance methods to the appropriate module global

Re: Numeric array in unittest problem

2005-11-21 Thread Roman Bertle
* Alex Martelli <[EMAIL PROTECTED]>: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Sorry Peter, > > > > Try this > > > > import unittest > > import Numeric > > > > class myTest(unittest.TestCase): > > def runTest(self): > > var1 = Numeric.array([1,22]) > > var2 =

ignore specific data

2005-11-21 Thread pkilambi
Hi I need help. What I want to do is If I read a file with some text content... I would like to ignore a block of lines and consider the rest.. so if the block starts with "start of block." fjesdgsdhfgdlgjklfjdgkd jhcsdfskdlgjkljgkfdjkgj "end of block" I want to ignore this while proc

Advice on distutils and distribution policies

2005-11-21 Thread Mardy
Hi, I've built a small project (http://eligante.sf.net) which I'm actually trying to package using distutils. The directory structure is going to be like this: eligante/ eligante.py sitobase.py personas.py [...other python files...] modulos/

Re: Numeric array in unittest problem

2005-11-21 Thread Robert Kern
Alex Martelli wrote: import Numeric a=Numeric.array([1,22]) b=Numeric.array([1,33]) c = a==b c > > array([1, 0]) > assert(c) > > i.e., thanks to element-by-element evaluation, == will generally return > a true value for ANY comparison of Numeric arrays, causing a very >

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Aahz
In article <[EMAIL PROTECTED]>, Alex Martelli <[EMAIL PROTECTED]> wrote: > >I think you're wrong here. People in the past who have requested or >implemented stuff they called 'ordered dicts' in the past had in mind >drastically different things, based on some combination of insertion >orders, keys

Re: about sort and dictionary

2005-11-21 Thread George Sakkis
"Shi Mu" wrote: > Got confused by the following code: > >>> a [6, 3, 1] > >>> b [4, 3, 1] > >>> c > {1: [[6, 3, 1], [4, 3, 1]], 2: [[6, 3, 1]]} > >>> c[2].append(b.sort()) > >>> c > {1: [[6, 3, 1], [1, 3, 4]], 2: [[6, 3, 1], None]} > #why c can not append the sorted b?? In python 2.4, you can

Re: about sort and dictionary

2005-11-21 Thread George Sakkis
"Shi Mu" wrote: > Got confused by the following code: > >>> a [6, 3, 1] > >>> b [4, 3, 1] > >>> c > {1: [[6, 3, 1], [4, 3, 1]], 2: [[6, 3, 1]]} > >>> c[2].append(b.sort()) > >>> c > {1: [[6, 3, 1], [1, 3, 4]], 2: [[6, 3, 1], None]} > #why c can not append the sorted b?? In python 2.4, you can

Re: about sort and dictionary

2005-11-21 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > most built-in function/method don't return the "object" but None. This > I believe is the language creator's preference for everything being > explicit. The list methods .sort() and .reverse() don't create copies, but rather change the existing object. The reson for thi

Re: best cumulative sum

2005-11-21 Thread Colin J. Williams
David Isaac wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>He seems to want scanl > > > Yes. But it's not in Python, right? > (I know about Keller's version.) > > Robert Kern wrote: > >>Define better. More accurate? Less code? > > > Good point. > As Bonono (?) su

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Christoph Zwerschke
Alex Martelli wrote: > Note the plural in 'insertion orderS': some people care about the FIRST > time a key was added to a dict, some about the LAST time it was added, > some about the latest time it was 'first inserted' (added and wasn't > already there) as long as it's never been deleted since t

  1   2   >