Re: reading a column from a file

2006-05-08 Thread pyGuy
f = open("datafile.txt", "r") data = [line.split('\t') for line in f] f.close() pressure = [float(d[1]) for d in data] temp = [float(d[2]) for d in data] --- This will parse the file into a matrix stored in 'data'. The last two lines simply iterate t

Tkfont.families does not list all installed fonts

2006-05-08 Thread Atul
Hi, I have installed a truetype font (.ttf) on a linux machne (SUSE linux 10, KDE) by copying it to my .fonts folder. I can use the font in all applications like open-office and firefox browser. However, I cannot use the font in a python app that I am writing. The list returned by Tkfont.families

Re: Getting HTTP responses - a python linkchecking script.

2006-05-08 Thread Rene Pijlman
[EMAIL PROTECTED]: >with urllib2 it doesn't seem possible to get HTTP status codes. except urllib2.HTTPError, e: if e.code == 403: -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Why list.sort() don't return the list reference instead of None?

2006-05-08 Thread [EMAIL PROTECTED]
Thanks a lot! However, I wonder why L.sort() don't return the reference L, the performance of return L and None may be the same. If L.sort() return L, we shouldn't do the awful things such as: keys = dict.keys() keys.sort() for key in keys: ...do whatever with dict[key]... we can only write t

Re: why _import__ only works from interactive interpreter?

2006-05-08 Thread [EMAIL PROTECTED]
Sorry to follow up myself, I've finally used the execfile approach, passing an empty dict for capturing locals and then just processing it: new_settings = {} execfile(self.SETTINGS_MODULE, new_settings) # returns its locals in new_settings # assign UPPER_CASE vars for setting in new_settings.keys

ANN: progressbar 2.2 - Text mode progressbar for console applications

2006-05-08 Thread Nilton Volpato
Text progressbar library for python. http://cheeseshop.python.org/pypi/progressbar This library provides a text mode progressbar. This is tipically used to display the progress of a long running operation, providing a visual clue that processing is underway. The ProgressBar class manages the p

Re: Why list.sort() don't return the list reference instead of None?

2006-05-08 Thread Lawrence Oluyede
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > However, I wonder why L.sort() don't return the reference L, the > performance of return L and None may be the same. It's not "the same". sort() does not return anything. > Why? I've just explained to you and so the others: by default operation

Re: Getting HTTP responses - a python linkchecking script.

2006-05-08 Thread blair . bethwaite
Rene Pijlman wrote: > [EMAIL PROTECTED]: > >with urllib2 it doesn't seem possible to get HTTP status codes. > > except urllib2.HTTPError, e: > if e.code == 403: Thanks. Is there documentation for this available somewhere online, I can't see it to obviously in the library refer

Python's regular expression?

2006-05-08 Thread Davy
Hi all, I am a C/C++/Perl user and want to switch to Python (I found Python is more similar to C). Does Python support robust regular expression like Perl? And Python and Perl's File content manipulation, which is better? Any suggestions will be appreciated! Best regards, Davy -- http://mail.

Re: Python's regular expression?

2006-05-08 Thread Lawrence Oluyede
"Davy" <[EMAIL PROTECTED]> writes: > Does Python support robust regular expression like Perl? Yep, Python regular expression is robust. Have a look at the Regex Howto: http://www.amk.ca/python/howto/regex/ and the re module: http://docs.python.org/lib/module-re.html -- Lawrence - http://www.oluy

Re: Why list.sort() don't return the list reference instead of None?

2006-05-08 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: > However, I wonder why L.sort() don't return the reference L, the > performance of return L and None may be the same. It's probably because it would become confusing. Many people don't read the documentation. If L.sort() returns a sorted version of L, they w

printing out elements in list

2006-05-08 Thread micklee74
hi i have a list with contents like this alist = ['>QWER' , 'askfhs', '>REWR' ,'sfsdf' , '>FGDG', 'sdfsdgffdgfdg' ] how can i "convert" this list into a dictionary such that dictionary = { '>QWER':'askfhs' , '>REWR' : 'sfsdf' , '>FGDG', 'sdfsdgffdgfdg' } thanks -- http://mail.python.org/mailm

Re: Getting HTTP responses - a python linkchecking script.

2006-05-08 Thread Rene Pijlman
[EMAIL PROTECTED]: >Rene Pijlman wrote: >> [EMAIL PROTECTED]: >> >with urllib2 it doesn't seem possible to get HTTP status codes. >> >> except urllib2.HTTPError, e: >> if e.code == 403: > >Thanks. Is there documentation for this available somewhere online, I >can't see it to ob

Re: Python's regular expression?

2006-05-08 Thread Mirco Wahab
Hi Davy wrote: > I am a C/C++/Perl user and want to switch to Python OK > (I found Python is more similar to C). ;-) More similar than what? > Does Python support robust regular expression like Perl? It supports them fairly good, but it's not 'integrated' - at least it feels not integrated f

Re: printing out elements in list

2006-05-08 Thread Tim N. van der Leeuw
Using slices and built-in zip: >>> alist = ['>QWER' , 'askfhs', '>REWR' ,'sfsdf' , '>FGDG', 'sdfsdgffdgfdg' ] >>> dict(zip(alist[::2], alist[1::2])) {'>QWER': 'askfhs', '>FGDG': 'sdfsdgffdgfdg', '>REWR': 'sfsdf'} Slightly more efficient might be to use izip from itertools: >>> from itertools imp

Re: which is better, string concatentation or substitution?

2006-05-08 Thread Duncan Booth
Leif K-Brooks wrote: > fuzzylollipop wrote: >> niether .join() is the fastest > > Please quote what you're replying to. > > No, it's the slowest: > > [EMAIL PROTECTED]:~$ python -m timeit "'%s\n\n' % 'foobar'" > 100 loops, best of 3: 0.607 usec per loop > [EMAIL PROTECTED]:~$ python -m time

Re: printing out elements in list

2006-05-08 Thread I V
On Mon, 08 May 2006 00:44:39 -0700, micklee74 wrote: > i have a list with contents like this > alist = ['>QWER' , 'askfhs', '>REWR' ,'sfsdf' , '>FGDG', > 'sdfsdgffdgfdg' ] > > how can i "convert" this list into a dictionary such that > > dictionary = { '>QWER':'askfhs' , '>REWR' : 'sfsdf' , '>FGD

Re: printing out elements in list

2006-05-08 Thread micklee74
thanks for all your replies...I will go test them out.. I was wondering what does this mean alist[1::2]? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Why list.sort() don't return the list reference instead of None?

2006-05-08 Thread Tim N. van der Leeuw
So you write: for key in sorted(dict.iterkeys()): ... do it ... dict.iterkeys() returns an iterable which doesn't even have a sort-method; and somehow I find it unnatural to apply a 'sort' method to an iterator whereas I find it perfectly natural to feed an iterator to a function that does sor

Re: A critic of Guido's blog on Python's lambda

2006-05-08 Thread Anton Vredegoor
[EMAIL PROTECTED] wrote: > When you consider that there was just a big flamewar on comp.lang.lisp > about the lack of standard mechanisms for both threading and sockets in > Common Lisp (with the lispers arguing that it wasn't needed) I find it > "curious" that someone can say Common Lisp scales w

Re: python 2.5a2, gcc 4.1 and memory problems

2006-05-08 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: > Michele Petrazzo wrote: >> I haven't tried to recompile py 2.4 myself with gcc 4.1 because it >> is already compiled with it (4.0.3), so I think (only think) that >> is a py 2.5 problem. I'm right? or I have to compile it with >> something other switches? > > Sounds l

Re: Image SIG ML Moderator does not respond

2006-05-08 Thread Fredrik Lundh
Calvin Spealman wrote: > I have tried repeatedly to make a post to the Image SIG ML, and get nothing > but automated responses that I must wait for word from the moderator to > approve my posting on the list. I have gotten no reply, positive or not, in > over a month. I am assuming the Image SIG m

data entry tool

2006-05-08 Thread Peter
This post seeks advice on whether python would be appropriate for a task, or whether you can suggest another approach. The project is to transcribe historical records such as schools admissions, ship passenger lists, birth/death/marriages, etc for genealogy studies. What we need is a simple soft

RE: Need to send email on HIGH Disk usage

2006-05-08 Thread Tim Golden
[C Saha] | I am looking for a py script which will send me email when | ever my disk becomes more than 90% full. By the way my OS is Win XP. | | If anybody have already has written same type of script or | something very similar kind of script will also be great. You can certainly do this wi

Re: the tostring and XML methods in ElementTree

2006-05-08 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I wanted to see what would happen if one used the results of a tostring > method as input into the XML method. What I observed is this: > a) beforeCtag.text is of type > b) beforeCtag.text when printed displays: I'm confused > c) afterCtag.text is of type > d) afterCt

Re: printing out elements in list

2006-05-08 Thread Tim N. van der Leeuw
alist[::2] means taking a slice. You should look up slice-syntax in the tutorials and reference manual. in general, alist[1:5] means: take list elements position 1 up to (excluding) 5. (List indexing starts at position 0, so the first element in the list is not included!) alist[0:5] means: take l

Re: How can I do this with python ?

2006-05-08 Thread Tim N. van der Leeuw
Your question is insufficiently clear for me to answer. Do you want to know how to read from standard-input in a Python program? Do you want to know how to start an external program from Python, and then connect something to that programs standard input? Do you want to know something else? Plea

Re: A critic of Guido's blog on Python's lambda

2006-05-08 Thread Thomas F. Burdick
[EMAIL PROTECTED] writes: > Alex Martelli wrote: > > Steve R. Hastings <[EMAIL PROTECTED]> wrote: > >... > > > > But the key in the whole thread is simply that indentation will not > > > > scale. Nor will Python. > > > > > > This is a curious statement, given that Python is famous for scaling

Re: Python CHM Doc Contains Broken Links on Linux in xCHM.

2006-05-08 Thread Razvan Cojocaru
> Is this a problem with the chm docs themselves OR is it a problem with > xCHM? The same chm works just fine on Windows whereas on Linux I am > having problems. Anyone experiencing the same? is a fix coming? It's already been fixed. You're running an old version (the screenshot says 1.2). The lat

Re: Is this a good use of __metaclass__?

2006-05-08 Thread Michele Simionato
Answering to the title of your post, no, this is not a good use of metaclasses. Your problem seems a textbook example of multiple dispatch, so I suggest you to look at PEAK with has an implementation of multimethods/generic functions. Notice that Guido seems to be intentioned to add support for gen

Re: data entry tool

2006-05-08 Thread Diez B. Roggisch
Peter wrote: > > This post seeks advice on whether python would be appropriate for a task, > or whether you can suggest another approach. > > The project is to transcribe historical records such as schools > admissions, ship passenger lists, birth/death/marriages, etc for genealogy > studies. Wh

Re: Dispatching operations to user-defined methods

2006-05-08 Thread Hallvard B Furuseth
Michele Simionato writes: > Apparently Guido fell in love with generic functions, so > (possibly) in future Python versions you will be able to > solve dispatching problems in in an industrial strenght way. Looks interesting, I'll keep an eye on that. > Sometimes however the simplest possible way

Re: data entry tool

2006-05-08 Thread Tim Williams
On 08/05/06, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > > Make it a webapp. That will guarantee to make it runnable on the list of > OSses you gave. Use Django/TurboGears/ZOPE for the application itself- > whichever suits you best. based on the comment: > I'm not a programmer and have only don

Modifying PyObject.ob_type

2006-05-08 Thread Hallvard B Furuseth
I've got some fixed-size types with identical object layout defind in C. The only differences are: Which methods they have, the name, and some are subtypes of others. Can I modify the ob_type of their instances, to switch between which of these types an object has? -- Hallvard -- http://mail.py

How to get a part of string which follows a particular pattern using shell script

2006-05-08 Thread Hari
Hi all, I need to get a part of string which follows a pattern 'addr=' For example: a)test="192.168.1.17:/home/ankur/nios_fson/mnt/tmptype nfs(rw,addr=192.168.1.17)" b)test="/dev/root on / typr nfs (rw,v2,rsize=1024,wsize=1024,hard,udp,nolock,addr=192.168.1.93)" I need to get the ipaddress f

Re: printing out elements in list

2006-05-08 Thread micklee74
thanks for the detailed explaination... i know about basic lists slicing..just havn't seen one with "steps" yet.. thanks again...clp rocks. -- http://mail.python.org/mailman/listinfo/python-list

yahoo sender name

2006-05-08 Thread I Made Putrama
You can go to Options menu, then klik Mail menu. Under Management tab, klik Mail Adresses Then edit your account there..     regards, faino     --- >> hey...I know this

Re: Python's regular expression?

2006-05-08 Thread Davy
Hi Mirco, Thank you! More similar than Perl ;-) And what's 'integrated' mean (must include some library)? I like C++ file I/O, is it 'low' or 'high'? Regards, Davy -- http://mail.python.org/mailman/listinfo/python-list

List of lists of lists of lists...

2006-05-08 Thread Ángel Gutiérrez Rodríguez
I would like to have a list of lists N times deep, and my solution is (in pseudocode): def deep(x): a=[x] return a mylist=[] for N: mylist=deep(mylist) Is there a more elegant way to do it? The maine idea is: from a list having the numbre of steps along N dimensions, generate a list with an

Re: Python's regular expression?

2006-05-08 Thread Davy
By the way, is there any tutorial talk about how to use the Python Shell (IDE). I wish it simple like VC++ :) Regards, Davy -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a part of string which follows a particular pattern using shell script

2006-05-08 Thread nikie
Hari wrote: > Hi all, > > I need to get a part of string which follows a pattern 'addr=' > > > For example: > > > a)test="192.168.1.17:/home/ankur/nios_fson/mnt/tmptype > nfs(rw,addr=192.168.1.17)" > b)test="/dev/root on / typr nfs > (rw,v2,rsize=1024,wsize=1024,hard,udp,nolock,addr=192.168.1.93)"

[ANN] PyYAML-3.01: YAML parser and emitter for Python

2006-05-08 Thread Kirill Simonov
PyYAML: YAML parser and emitter for Python == I am pleased to announce the initial release of PyYAML. YAML is a data serialization format designed for human readability and interaction with scripting languages. PyYAML is a YAML parser and emitter for Pytho

Web framework comparison video

2006-05-08 Thread Iain King
http://compoundthinking.com/blog/index.php/2006/03/10/framework-comparison-video/ Thought this might be interesting to y'all. (I can't watch it 'cos I'm at work, so any comments about it would be appreciated :) Iain -- http://mail.python.org/mailman/listinfo/python-list

get Windows file type

2006-05-08 Thread BartlebyScrivener
Using Python on Windows XP, I am able to get almost all file and path info using os.path or stat, but I don't see a way to retrieve the file type? E.g. Microsoft Word file, HTML file, etc, the equivalent of what is listed in the "Type" column in the Windows Explorer box. Thanks, rick -- http://

Re: Python Eggs Just install in *ONE* place? Easy to uninstall?

2006-05-08 Thread Damjan
> But not matter where eggs are installed they > are never spread across multiple places > on hard drive right? An egg is all under > one node of tree right? >From what I've seen, no. For example installing TurboGears will also install the tg-admin script in /usr/bin/ and there are a lot of other

Re: get Windows file type

2006-05-08 Thread Sybren Stuvel
BartlebyScrivener enlightened us with: > Using Python on Windows XP, I am able to get almost all file and > path info using os.path or stat, but I don't see a way to retrieve > the file type? E.g. Microsoft Word file, HTML file, etc, the > equivalent of what is listed in the "Type" column in the Wi

Logging vs printing

2006-05-08 Thread Leo Breebaart
"alisonken1" <[EMAIL PROTECTED]> writes: > Leo Breebaart wrote: > > > I am writing fairly large console scripts in Python. They > > have quite a few command-line options, which lead to > > configuration variables that are needed all over the program > > (e.g. the "--verbose" option alone is used b

Re: Logging vs printing

2006-05-08 Thread Sybren Stuvel
Leo Breebaart enlightened us with: > I think the main reason why I am not using it by default is because, > when all is said and done, it still comes easier to me to resort to > guarded print statements then to set up and use the logging > machinery. The logging "machinery" isn't that huge nor is

Re: A critic of Guido's blog on Python's lambda

2006-05-08 Thread Ken Tilton
Adam Jones wrote: > Ken Tilton wrote: > >>Alexander Schmolck wrote: >> >>>[trimmed groups] >>> >>>Ken Tilton <[EMAIL PROTECTED]> writes: >>> >>> >>> yes, but do not feel bad, everyone gets confused by the /analogy/ to spreadsheets into thinking Cells /is/ a spreadsheet. In fact, for a br

Re: Python's regular expression?

2006-05-08 Thread Mirco Wahab
Hi Davy > > More similar than Perl ;-) But C has { }'s everywhere, so has Perl ;-) > > And what's 'integrated' mean (must include some library)? Yes. In Python, regular expressions are just another function library - you use them like in Java or C. In Perl, it's part of the core language, you

A better way to split up a list

2006-05-08 Thread fidtz
The code below works fine, but it is less than nice to look at and somewhat long winded. Is there a better way to do the docstring task? This is the first working version, and can proabably be "compacted" a bit (list comprehensions etc) but I am looking for a better basic approach. Any help much ap

Re: Designing Plug-in Systems in Python

2006-05-08 Thread Jorge Godoy
mystilleef wrote: > > Are there any good tutorials on how to design good plug-in > systems with Python, or any language? What are the best > practices for designing plug-in systems in Python? How would > you go about designing one? What are common pitfalls in > designing one? Any pointers, suggest

Re: Logging vs printing

2006-05-08 Thread Leo Breebaart
Sybren Stuvel <[EMAIL PROTECTED]> writes: > Leo Breebaart enlightened us with: > > I think the main reason why I am not using [logging] by > > default is because, when all is said and done, it still comes > > easier to me to resort to guarded print statements then to > > set up and use the loggin

Re: Python's regular expression?

2006-05-08 Thread John Machin
On 8/05/2006 10:31 PM, Mirco Wahab wrote: [snip] > > Lets see - a really simple find/match > would look like this in Python: > >import re > >t = 'blue socks and red shoes' >p = re.compile('(blue|white|red)') >if p.match(t): What do you expect when t == "green socks and red shoes

Re: A critic of Guido's blog on Python's lambda

2006-05-08 Thread David C.Ullrich
On Sun, 07 May 2006 10:36:00 -0400, Ken Tilton <[EMAIL PROTECTED]> wrote: >[...] > >Your spreadsheet does not have slots ruled by functions, it has one slot >for a dictionary where you store names and values/formulas. > >Go back to your example and arrange it so a and b are actual slots (data >m

Re: Python's regular expression?

2006-05-08 Thread Duncan Booth
Mirco Wahab wrote: > Lets see - a really simple find/match > would look like this in Python: > >import re > >t = 'blue socks and red shoes' >p = re.compile('(blue|white|red)') >if p.match(t): > print t > > which prints the text 't' because of > the positive pattern match.

Re: How can I do this with python ?

2006-05-08 Thread Xiao Jianfeng
Tim N. van der Leeuw wrote: > Your question is insufficiently clear for me to answer. > > Do you want to know how to read from standard-input in a Python > program? > > Do you want to know how to start an external program from Python, and > then connect something to that programs standard input? >

Re: Python CHM Doc Contains Broken Links on Linux in xCHM.

2006-05-08 Thread vbgunz
Thank you Razvan. You're right. I downloaded the 1.7.1 source and built it and the links do work just fine. Thank you for pointing that out! -- http://mail.python.org/mailman/listinfo/python-list

Re: A better way to split up a list

2006-05-08 Thread Tim Chase
> The code below works fine, but it is less than nice to > look at and somewhat long winded. Is there a better way > to do the docstring task? This is the first working > version, and can proabably be "compacted" a bit (list > comprehensions etc) but I am looking for a better basic > approach. Any

Re: Logging vs printing

2006-05-08 Thread Sybren Stuvel
Leo Breebaart enlightened us with: > Okay, you say, that's still easy. It's just: > > logging.basicConfig(level=logging.DEBUG, > format='%(message)s') I always use a separate logger, as per my example. That would then just require an additional line: log.setLeveL(logging.DEBUG

Re: Python's regular expression?

2006-05-08 Thread Mirco Wahab
Hi John >>import re >> >>t = 'blue socks and red shoes' >>p = re.compile('(blue|white|red)') >>if p.match(t): > > What do you expect when t == "green socks and red shoes"? Is it possible > that you mean to use search() rather than match()? This is interesting. What's in this exam

Re: Web framework comparison video

2006-05-08 Thread Sybren Stuvel
Iain King enlightened us with: > http://compoundthinking.com/blog/index.php/2006/03/10/framework-comparison-video/ > > Thought this might be interesting to y'all. (I can't watch it 'cos > I'm at work, so any comments about it would be appreciated :) It's a nice video, I really enjoyed it. Even th

Re: A better way to split up a list

2006-05-08 Thread John Machin
On 8/05/2006 10:45 PM, [EMAIL PROTECTED] wrote: > The code below works fine, but it is less than nice to look at and > somewhat long winded. Is there a better way to do the docstring task? > This is the first working version, and can proabably be "compacted" a > bit (list comprehensions etc) but I

Re: reading a column from a file

2006-05-08 Thread Larry Bates
Check out the csv module. -Larry Bates Gary Wessle wrote: > Hi > > I have a file with data like > location pressure temp > str flootfloot > > I need to read pressure and temp in 2 different variables so that I > can plot them as lines. is there a package which reads from file with > a

Re: Python's regular expression?

2006-05-08 Thread Mirco Wahab
Hi Duncan > There is no need to compile the regular expression in advance in Python > either: > ... > The only advantage to compiling in advance is a small speed up, and most of > the time that won't be significant. I read 'some' introductions into Python Regexes and got confused in the first

Re: which is better, string concatentation or substitution?

2006-05-08 Thread Roy Smith
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: > My initial feeling is that concatenation might take longer than > substitution, but that it is also easier to read: > > > def p(self, paragraph): > self.source += '' + paragraph + '\n\n' > > vs. > > def p(self, pa

Re: Web framework comparison video

2006-05-08 Thread Sybren Stuvel
Sybren Stuvel enlightened us with: > Perhaps I'll look into Plone for my site in the future ;-) I take that back. The Plone webserver is hosted by XS4ALL, the best ISP in The Netherlands, which resides in Amsterdam. I happen to live in Amsterdam too, so you'd expect the site to be fast. Well, it t

Re: Using time.sleep() in 2 threads causes lockup when hyper-threading is enabled

2006-05-08 Thread OlafMeding
Tim > I did this under a debug build of Python Perhaps this is the reason why you were not able to reproduce the problem. Could you try again with a standard build of Python? I am a bit surprised that nobody else has tried running the short Python program above on a hyper-threading or dual core

Re: Python's regular expression?

2006-05-08 Thread John Machin
On 8/05/2006 11:13 PM, Mirco Wahab wrote: > Hi John > >>>import re >>> >>>t = 'blue socks and red shoes' >>>p = re.compile('(blue|white|red)') >>>if p.match(t): >> What do you expect when t == "green socks and red shoes"? Is it possible >> that you mean to use search() rather than

PYTHONPATH vs PATH?

2006-05-08 Thread Michael Yanowitz
Hello: Someone on my team tried out installing my Python code and found that setting PYTHONPATH does not work, but setting PATH environment variable works the way PYTHONPATH should. Is that how it supposed to be, or is that a bug or feature? -Original Message- (parts deleted) Subject:

Re: utility functions within a class?

2006-05-08 Thread John Salerno
[EMAIL PROTECTED] wrote: > John Salerno wrote: >> What I originally meant was that they would not be called from an >> instance *outside* the class itself, i.e. they won't be used when >> writing another script, they are only used by the class itself. > > Yep, so you want to encapsulate the functi

Re: A better way to split up a list

2006-05-08 Thread fidtz
Argh, embarassment on my part due to incomplete spec. movelist is used to store a list of chess moves and splitting it up in this way is so it can be printed in a space that is 3 lines high but quite wide. Thus the way the list grows as it is appended to in chopupmoves is intended. -- http://mail

Re: which is better, string concatentation or substitution?

2006-05-08 Thread John Salerno
Roy Smith wrote: > One may be marginally faster, but they both require copying the source > string, and are thus both O(n). Sorry, I'm not familiar with the O(n) notation. > If you're just doing one or a small fixed > number of these, it really doesn't matter. Pick whichever one you think is

Re: A better way to split up a list

2006-05-08 Thread Larry Bates
[EMAIL PROTECTED] wrote: > The code below works fine, but it is less than nice to look at and > somewhat long winded. Is there a better way to do the docstring task? > This is the first working version, and can proabably be "compacted" a > bit (list comprehensions etc) but I am looking for a better

Re: A better way to split up a list

2006-05-08 Thread Larry Bates
[EMAIL PROTECTED] wrote: > The code below works fine, but it is less than nice to look at and > somewhat long winded. Is there a better way to do the docstring task? > This is the first working version, and can proabably be "compacted" a > bit (list comprehensions etc) but I am looking for a better

Re: PYTHONPATH vs PATH?

2006-05-08 Thread Fredrik Lundh
Michael Yanowitz wrote: > Someone on my team tried out installing my Python code and > found that setting PYTHONPATH does not work, but setting PATH > environment variable works the way PYTHONPATH should. Is that > how it supposed to be PATH is used by the operating system to find executables,

Scaled Vector Graphics

2006-05-08 Thread Greg Lindstrom
I have been asked to write a routine to merge documents in pfd and svg formats into a single file (preferably pfd format).  Currently we send the pdf image to the printer followed by the svg image (a scan of a health care claim) but this is not a satisfactory solution.  We have as many as 3000 docu

Re: reading a column from a file

2006-05-08 Thread Larry Bates
Check out the csv module. -Larry Bates Gary Wessle wrote: > Hi > > I have a file with data like > location pressure temp > str flootfloot > > I need to read pressure and temp in 2 different variables so that I > can plot them as lines. is there a package which reads from file with > a

Re: A critic of Guido's blog on Python's lambda

2006-05-08 Thread David C.Ullrich
On Mon, 08 May 2006 08:05:38 -0500, David C. Ullrich <[EMAIL PROTECTED]> wrote: >[...] > >def acall(cell, value): > cell.owner.slots['b'].value = value + 1 Needing to say that sort of thing every time you define a callback isn't very nice. New and improved version: """PyCells.py""" class Cell:

Re: Python's regular expression?

2006-05-08 Thread Mirco Wahab
Hi John >> But what would be an appropriate use >> of search() vs. match()? When to use what? > > ReadTheFantasticManual :-) >From the manual you mentioned, i don't get the point of 'match'. So why should you use an extra function entry match(), re.match('whatever', t): which is, according

Re: which is better, string concatentation or substitution?

2006-05-08 Thread John Salerno
Duncan Booth wrote: > If you build a > list of lines to join then you don't have to repeat '\n' on the end of each > component line. How would that work? Wouldn't the last line in the list still need the newlines? -- http://mail.python.org/mailman/listinfo/python-list

Re: utility functions within a class?

2006-05-08 Thread John Salerno
John Salerno wrote: > [EMAIL PROTECTED] wrote: >> John Salerno wrote: >>> What I originally meant was that they would not be called from an >>> instance *outside* the class itself, i.e. they won't be used when >>> writing another script, they are only used by the class itself. >> >> Yep, so you wan

Re: Scaled Vector Graphics

2006-05-08 Thread Phil Thompson
On Monday 08 May 2006 2:58 pm, Greg Lindstrom wrote: > I have been asked to write a routine to merge documents in pfd and svg > formats into a single file (preferably pfd format). Currently we send the > pdf image to the printer followed by the svg image (a scan of a health care > claim) but this

hyperthreading locks up sleeping threads

2006-05-08 Thread OlafMeding
Below are 2 files. The first is a Python program that isolates the problem within less than 1 hour (often just a few minutes). The second is a C++ program that shows that the Win32 Sleep() function works as expected (ran from Friday afternoon until Monday morning). Note, the Python programs hang

Re: How can I do this with python ?

2006-05-08 Thread Philippe Martin
Xiao Jianfeng wrote: > Tim N. van der Leeuw wrote: >> Your question is insufficiently clear for me to answer. >> >> Do you want to know how to read from standard-input in a Python >> program? >> >> Do you want to know how to start an external program from Python, and >> then connect something to t

Re: PYTHONPATH vs PATH?

2006-05-08 Thread Rene Pijlman
Fredrik Lundh: >PATH is used by the operating system to find executables, and PYTHONPATH >is used by Python to find Python modules. Yes, but Python also finds modules in its own installation. So changing PATH may cause another installation of Python to be run, which may have some other set of inst

Retrieving event descriptors in Tkinter

2006-05-08 Thread Avi Kak
Does Tkinter provide a function that returns all the event descriptors for a given widget class? I am looking for something similar to what you get in Perl/Tk when you call bind() with a single explicit argument. For example, in Perl/Tk, $widget->bind( Tk::Button ) returns a list like

Re: Python's regular expression?

2006-05-08 Thread Nick Craig-Wood
Mirco Wahab <[EMAIL PROTECTED]> wrote: > After some minutes in this NG I start to get > the picture. So I narrowed the above regex-question > down to a nice equivalence between Perl and Python: > > Python: > > import re > > t = 'blue socks and red shoes' > if re.match('blue|white

regular expressions, substituting and adding in one step?

2006-05-08 Thread John Salerno
Ok, this might look familiar. I'd like to use regular expressions to change this line: self.source += '' + paragraph + '\n\n' to read: self.source += '%s\n\n' % paragraph Now, matching the middle part and replacing it with '%s' is easy, but how would I add the extra string to the end of the l

Re: Active Directory Authentication

2006-05-08 Thread D
Thanks to everyone for your help..I'm not familiar with the packages mentioned, so this will definitely be a learning experience! -- http://mail.python.org/mailman/listinfo/python-list

Python Graphics Library

2006-05-08 Thread utab
Dear all, Could you please recommend me a graphics library for python. I saw PYX which has nice screenshots on the webpage. My first ambition is to be able to draw 2D or 3D graphs for my mathematical results. Maybe later, I can handle other types of graphical operations. Regards. -- http://mai

Re: A better way to split up a list

2006-05-08 Thread Tim Chase
> Argh, embarassment on my part due to incomplete spec. > movelist is used to store a list of chess moves and > splitting it up in this way is so it can be printed in a > space that is 3 lines high but quite wide. Thus the way > the list grows as it is appended to in chopupmoves is > intended. Per

Re: Retrieving event descriptors in Tkinter

2006-05-08 Thread Fredrik Lundh
Avi Kak wrote: > Does Tkinter provide a function that returns all the event descriptors > for a given widget class? I am looking for something similar to what > you get in Perl/Tk when you call bind() with a single explicit > argument. For example, in Perl/Tk, > > $widget->bind( Tk::Button )

Re: which is better, string concatentation or substitution?

2006-05-08 Thread Peter Otten
John Salerno wrote: > Duncan Booth wrote: > >> If you build a >> list of lines to join then you don't have to repeat '\n' on the end of >> each component line. > > How would that work? Wouldn't the last line in the list still need the > newlines? >>> chunks = ["alpha", "beta", "gamma"] >>> "\n"

Re: Job opportunity in France

2006-05-08 Thread Rony Steelandt
Well that would be one less, and countng > Rony Steelandt wrote: > >> We have a vacancy for a python programmer for a 6 months assignement. >> >> If interested, please visit www.bucodi.com >> >> And don't worry we speak english :) >> >> R_ >> > seriously, a job opportunity in France?? I he

Re: Python Graphics Library

2006-05-08 Thread Steve Juranich
utab wrote: > Dear all, > > Could you please recommend me a graphics library for python. I saw PYX > which has nice screenshots on the webpage. > > My first ambition is to be able to draw 2D or 3D graphs for my > mathematical results. Maybe later, I can handle other types of > graphical operatio

Re: regular expressions, substituting and adding in one step?

2006-05-08 Thread John Salerno
John Salerno wrote: > So the questions are, how do you use regular expressions to add text to > the end of a line, even if you aren't matching the end of the line in > the first place? Or does that entail using separate regexes that *do* do > this? If the latter, how do I retain the value of th

Re: Designing Plug-in Systems in Python

2006-05-08 Thread mystilleef
Thanks for the pointers. -- http://mail.python.org/mailman/listinfo/python-list

Re: A better way to split up a list

2006-05-08 Thread fidtz
Thanks very much, that is a far tidier solution!! -- http://mail.python.org/mailman/listinfo/python-list

ANN: iTorrent alpha-2

2006-05-08 Thread Michael Hobbs
Announcing the second alpha release of iTorrent. iTorrent allows you to download BitTorrent podcasts from iTunes. It transforms BitTorrent podcasts so that you can update them just like any other podcast in iTunes. Details can be found at http://www.itorrent.cc. iTorrent is written in Python an

  1   2   3   >