Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread John Bokma
David Eppstein wrote: > In article <[EMAIL PROTECTED]>, > "Xah Lee" <[EMAIL PROTECTED]> wrote: > >> a absolute requirement in this problem is to minimize the number of >> comparison made between files. This is a part of the spec. > > You need do no comparisons between files. Just use a suffici

Re: Is there a short-circuiting dictionary "get" method?

2005-03-10 Thread Terry Reedy
"Skip Montanaro" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >value = d.get('x') or bsf() > > Of course, this bsf() will get called if d['x'] evaluates to false, not > just > None, value = (d.get('x') is not None) or bsf() #?? tjr -- http://mail.python.org/mailman/listi

Re: shuffle the lines of a large file

2005-03-10 Thread Heiko Wundram
On Tuesday 08 March 2005 15:55, Simon Brunning wrote: > Ah, but that's the clever bit; it *doesn't* store the whole list - > only the selected lines. But that means that it'll only read several lines from the file, never do a shuffle of the whole file content... When you'd want to shuffle the fil

Re: split a string with quoted parts into list

2005-03-10 Thread Paul McGuire
Oliver - Here is a simpler approach, hopefully more readable, using pyparsing (at http://pyparsing.sourceforge.net). I also added another test word to your sample input line, one consisting of a lone pair of double quotes, signifying an empty string. (Be sure to remove leading '.'s from Python t

How to launch pdf viewer on Mac?

2005-03-10 Thread Paul McNett
Hi, On Windows, os.startfile() does what I want: os.startfile("myDocument.pdf") That launches the default PDF viewer on the system in a separate process. Perfect. On Linux, I understand that there really isn't a standard for determining a default application for a given file type (indeed, there

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread David Eppstein
In article <[EMAIL PROTECTED]>, "Xah Lee" <[EMAIL PROTECTED]> wrote: > a absolute requirement in this problem is to minimize the number of > comparison made between files. This is a part of the spec. You need do no comparisons between files. Just use a sufficiently strong hash algorithm (SHA-2

Re: injecting "set" into 2.3's builtins?

2005-03-10 Thread Stephen Thorne
On Wed, 9 Mar 2005 19:49:36 -0600, Skip Montanaro <[EMAIL PROTECTED]> wrote: > > I use sets a lot in my Python 2.3 code at work and have been using this > hideous import to make the future move to 2.4's set type transparent: > > try: > x = set > except NameError: > from se

Re: modifiable config files in compiled code?

2005-03-10 Thread Stephen Thorne
On 10 Mar 2005 06:02:22 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi All, > > I've been trying to come up with an elegant solution to this problem, > but can't seem to think of anything better than my solution below. > > I have a Python program that needs to be converted into an execu

injecting "set" into 2.3's builtins?

2005-03-10 Thread Skip Montanaro
I use sets a lot in my Python 2.3 code at work and have been using this hideous import to make the future move to 2.4's set type transparent: try: x = set except NameError: from sets import Set as set else: del x Of course, while it's transparent at one

Re: select random entry from dictionary

2005-03-10 Thread Skip Montanaro
>> d.popitem() Removes and returns an arbitrary (key, value) pair from d >> If this isn't random enough, then you can generate a random number in >> range(len(d)) Peter> Although this idea may suit the OP, "arbitrary" is most Peter> definitely not "random". Correct. The libr

Re: Is there a short-circuiting dictionary "get" method?

2005-03-10 Thread Skip Montanaro
Dave> In this snippet: Dave> d = {'x': 1} Dave> value = d.get('x', bigscaryfunction()) Dave> the bigscaryfunction is always called, even though 'x' is a valid Dave> key. I sometimes use value = d.get('x') or bsf() Of course, this bsf() will get called if d['x'] evaluat

Re: PyAsm

2005-03-10 Thread Stephen Thorne
On 10 Mar 2005 12:35:36 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hey Roger, > > I didn't realize that Stefan replied to the list and sent a private > email reply. There seemed to be a lag in google groups today. I > basically told him that I might be crazy enough to write an assembl

Re: modifiable config files in compiled code?

2005-03-10 Thread Tom Willis
ConfigParser works on linux I'm pretty sure. I just ran Ipython imported it and loaded a config file. I don't remember anything in the docs that said otherwise. I would prefer an xml style config file myself. But I can get by with and ini right now. The logging framework seems to me to be the h

Re: FW: list reduction

2005-03-10 Thread Stephen Thorne
I think you mean, newlist = [y for y in industrylist if y.cap < x] otherwise you've got a list of caps, not a list of objects with the cap attribute. On Thu, 10 Mar 2005 12:10:31 -0800, James Stroud <[EMAIL PROTECTED]> wrote: > newlist = [y.cap for y in industrylist if y.cap < x] > > On Thursd

Re: __getitem__ on new-style classes

2005-03-10 Thread Michael Spencer
[EMAIL PROTECTED] wrote: What i'm trying to do is tie special methods of a "proxy" instance to another instance: ... new style classes: def test2(): print "test2" class Container(object): def __init__( self, data ): self.data = data # self.__dict__["__getitem__"] = self.data.__ge

Re: modifiable config files in compiled code?

2005-03-10 Thread [EMAIL PROTECTED]
Since this utility will also be ported to the linux world, does anyone know what the linux/unix counterpart of a Windows .INI configuration file is? I suppose I could get away with using XML for my config files and avoid having two different tools altogether. -- http://mail.python.org/mailman/li

Re: looking up dictionaries by values

2005-03-10 Thread Steve Holden
Sandman wrote: Hi there, I'm still a bit new to Python, and had a question. I have a dictionary that looks like: PWD = \ { "root": 0, "joe": 200, "susan": 201, .. } In other words, the values are unique as well as the keys. I've run into a situation where I need to lookup t

Re: 'Browse' button for *.txt file?

2005-03-10 Thread Steve Holden
Fred wrote: Sorry if my choice of words is not very clear to you, but as english is not my first language, I put it this way because of a lack of better words. I will try it differently: What I meant is that I am searching for a module, that would allow me to select a file by not using a typed path

__getitem__ on new-style classes

2005-03-10 Thread simon
What i'm trying to do is tie special methods of a "proxy" instance to another instance: def test1(): class Container: def __init__( self, data ): self.data = data self.__getitem__ = self.data.__getitem__ data = range(10) c = Container(data) print "test1" print c[3] This

Re: looking up dictionaries by values

2005-03-10 Thread James Stroud
See the thread from earlier today, this list (python-list@python.org). "newbie: dictionary - howto get key value" On Thursday 10 March 2005 06:26 pm, Sandman wrote: > Hi there, > I'm still a bit new to Python, and had a question. > I have a dictionary that looks like: > PWD = \ > { >"root

Re: modifiable config files in compiled code?

2005-03-10 Thread [EMAIL PROTECTED]
Larry, I am using py2exe to package my application into an executable, but did not have the need for an installer such as Inno Installer. This is definately good info for future use, though. Thank you! Tom, No, I didn't know about the ConfigParser module and was exactly what I was trying to fi

Re: thread end and make main program end also?

2005-03-10 Thread martinnitram
Sorry that i had't show my code clearly. The exception try and catch at the module function (i.e. myClass.myfunction(), which like: start code within myClass.py def myfunction(self, dbconnection): sql_query= 'update table set col=value' try: dbconnection.query(sql_query)

looking up dictionaries by values

2005-03-10 Thread Sandman
Hi there, I'm still a bit new to Python, and had a question. I have a dictionary that looks like: PWD = \ { "root": 0, "joe": 200, "susan": 201, .. } In other words, the values are unique as well as the keys. I've run into a situation where I need to lookup the item by val

[Python-Dev] Re: Adding any() and all()

2005-03-10 Thread Michael Spencer
Guido van Rossum wrote: See my blog: http://www.artima.com/forums/flat.jsp?forum=106&thread=98196 Do we even need a PEP or is there a volunteer who'll add any() and all() for me? Surely these can be written easily with existing constructs: def any(S): return reduce(lambda x, y: bool(x or y), fi

Behaviour of htmllib's HTML parser and formatter

2005-03-10 Thread Morten W. Petersen
Hi, I have an HTML page that displays some content, and a part of that content is HTML changed into regular text. The encoding of the page is UTF-8. Here's the code that makes the change (the HTML in self.contents is UTF-8 encoded): file = cStringIO.StringIO() parser = htmllib.HTMLParser(format

how to absolute import?

2005-03-10 Thread Qiangning Hong
>From Guido's PEP8: - Relative imports for intra-package imports are highly discouraged. Always use the absolute package path for all imports. Does it mean I should put my develop directory into PYTHONPATH (e.g. /home/hongqn/devel/python) and use "import myproj1.package1.module

Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1

2005-03-10 Thread "Martin v. Löwis"
Anthony Baxter wrote: On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.1 (release candidate 1). Python 2.4.1 is a bug-fix release. See the release notes at the website (also available as Misc/NEWS in the source distribution) for deta

Re: Etiquette on job posts

2005-03-10 Thread Mike Wimpe
If you are interested in doing some freelance Python development, please take a look at http://www.pythonian.com/info.htm to view our business model. Qualifications: Must have been working with Python for at least a year (though not professionally necessarily) Understand and write OOP Pythonic c

Re: Python 2.4, distutils, and pure python packages

2005-03-10 Thread "Martin v. Löwis"
Thomas Heller wrote: This means that if you build a windows installer using distutils - it *requires* msvcr7.dll in order to run. This is true even if your package is a pure python package. This means that when someone tries to use a windows installer created with Python 2.4, on a machine with only

Re: 'Browse' button for *.txt file?

2005-03-10 Thread Mike Wimpe
Are you trying to do this within a GUI? If so, wxPython, PyGTK, and PyQT all have ways to do this. You can also use EasyDialogs for this as well. If not, flush... -- http://mail.python.org/mailman/listinfo/python-list

Re: Etiquette on job posts

2005-03-10 Thread Robert Kern
Mike Wimpe wrote: I know on some boards it's perfectly acceptable to post jobs, but on others its not at all. If I wanted to post a job (Python-related) here, is this OK? I believe it is okay. Be sure to put [JOB] or something in the Subject. Also, post it to the Python Job Board. http://www.py

Re: 'Browse' button for *.txt file?

2005-03-10 Thread Fred
Sorry if my choice of words is not very clear to you, but as english is not my first language, I put it this way because of a lack of better words. I will try it differently: What I meant is that I am searching for a module, that would allow me to select a file by not using a typed path, but by cho

Etiquette on job posts

2005-03-10 Thread Mike Wimpe
I know on some boards it's perfectly acceptable to post jobs, but on others its not at all. If I wanted to post a job (Python-related) here, is this OK? Thought I'd ask. Thanks, Mike Wimpe -- http://mail.python.org/mailman/listinfo/python-list

Distutils spawn on unix acting strange

2005-03-10 Thread Travis Oliphant
I have a normal looking setup.py file with a single extension module. When distutils runs (python setup.py build), the module compiles fine, but an error is issued that seems to indicate that gcc is being called with a "blank" input file (and gives an error). It appears that the spawn proces

Re: multiple buffers management

2005-03-10 Thread Bengt Richter
On 10 Mar 2005 15:18:08 -0800, [EMAIL PROTECTED] wrote: >Hello, > >I need to create 6 buffers in python and keep track of it. >I need to pass this buffer, say buffer 1 as an index to a test app. Has > >any one tried to do this. Any help with buffer management appreciated. > >Each buffer needs to h

Re: multiple buffers management

2005-03-10 Thread Jaime Wyant
Again, your being vague. You need to be more specific about what you're trying to accomplish. I have no idea what "buffer management" is. If you explain exactly what you're doing then maybe I or someone else could provide you with more meaningful answers. jw On 10 Mar 2005 15:18:08 -0800, [EMA

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote: That's fast and good. Nice to hear. A minor nit-pick: `fdups.py -r .` does nothing (at least on Linux). I'll look into that. Have you found any way to test if two files on NTFS are hard linked without opening them first to get a file handle? No. And even then, I wo

Re: modifiable config files in compiled code?

2005-03-10 Thread Ksenia Marasanova
You can also do: settings = {} execfile('/path/to/file/myconfig.conf', settings) myconfig.conf is a Python file. After this all variables from myconfig.conf are stored in settings dictionary. -- Ksenia -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote: On POSIX filesystems, one has also to avoid comparing files having same (st_dev, st_inum), because you know that they are the same file. I then have a bug here - I consider all files with the same inode equal, but according to what you say I need to consider the

Re: instantiate new objects

2005-03-10 Thread Felix Steffenhagen
The default mutual parameters in the method bayes.generate_cpd(...) was the problem, thanks alot for the hint and for this code snippet to find such problems :-). Greetings, Felix Michael Spencer wrote: Without looking in the slightest at what you are implementing or how, this implies that state i

Re: RELEASED Python 2.4.1, release candidate 1

2005-03-10 Thread Roger Upole
Does the workaround for the crash do anything for this problem ? Mark has changed the makepy code to break up long lines, and a new build of Pywin32 should be out before long. Roger "Tim N. van der Leeuw" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I have a

multiple buffers management

2005-03-10 Thread doodle4
Hello, I need to create 6 buffers in python and keep track of it. I need to pass this buffer, say buffer 1 as an index to a test app. Has any one tried to do this. Any help with buffer management appreciated. Each buffer needs to hold 512 bytes of data. Thanks, -Joe -- http://mail.python.org

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-03-10 Thread Carl Banks
Carl Banks wrote: > I could, however, see myself > using the slightly more complicated descriptor such as this (for a > wholly different reason, though): > > . def call_with_open_file(filename): > . def descriptor(func): > . flo = open(filename) > . try: f(flo) > . fi

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-03-10 Thread Carl Banks
Nick Coghlan wrote: > Anyway, if others agree that the ability to execute a suite at def exeuction > time to preinitialise a function's locals without resorting to bytecode hacks is > worth having, finding a decent syntax is the next trick :) Workarounds: 1. Just use a freaking global, especially

Re: 'Browse' button for *.txt file?

2005-03-10 Thread Peter Hansen
Fred wrote: I am searching for a module, that would allow me to call files by using a 'browse' button. Is there any uniform module for browsing files, or is there a special module for *.txt files? I think you'll want to take some time to put your requirements into different words. Much of what you

char buffer

2005-03-10 Thread doodle4
Hello all, I need to create 6 buffers in python and keep track of it. I need to pass this buffer, say buffer 1 as an index to a test app. Has any one tried to do this. Any help with buffer management appreciated. Thanks, -Joe -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 2.4.1, release candidate 1

2005-03-10 Thread Tim N. van der Leeuw
Hi, I have a problem with Python2.4 and win32com extensions, from Mark Hammond's win32all package... I posted a few days back about a crash when compiling files generated by win32com's 'makepy.py' utility. Now these generated files, which are fine in Python 2.3.5, give a syntax error on compile.

Re: Start new process by function ?

2005-03-10 Thread Mathias Waack
George Sakkis wrote: > Is it possible to start a new process by specifying a function call > (in similar function to thread targets) instead of having to write > the function in a separate script and call it through os.system or > os.spawn* ? That is, something like > > def foo(): pass > os.spawn

'Browse' button for *.txt file?

2005-03-10 Thread Fred
Hi I am searching for a module, that would allow me to call files by using a 'browse' button. Is there any uniform module for browsing files, or is there a special module for *.txt files? Thanks Fred -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterate using tuple as index

2005-03-10 Thread Roy Smith
James Stroud <[EMAIL PROTECTED]> wrote: >I would like something more like this: > >for list1_item, list2_item in (some_kind_of_expression): > do_something(list1_item, list2_item) I believe you want: for list1_item, list2_item in zip (list1, list2): blah -- http://mail.python.org/mailman/li

Re: instantiate new objects

2005-03-10 Thread Michael Spencer
Felix Steffenhagen wrote: [snip] > In: http://www.informatik.uni-freiburg.de/~steffenh/bayes.py > [bayes.test gives different results each time it is called] Without looking in the slightest at what you are implementing or how, this implies that state is maintained between calls to test The quest

Start new process by function ?

2005-03-10 Thread George Sakkis
Is it possible to start a new process by specifying a function call (in similar function to thread targets) instead of having to write the function in a separate script and call it through os.system or os.spawn* ? That is, something like def foo(): pass os.spawn(foo) Thanks in advance, George

Re: char buffer

2005-03-10 Thread doodle4
Each buffer need to hold 512 bytes of data. Thanks, -Joe -- http://mail.python.org/mailman/listinfo/python-list

Re: char buffer

2005-03-10 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello all, > > I need to create 6 buffers in python and keep track of it. > I need to pass this buffer, say buffer 1 as an index to a test app. Has > any one tried to do this. Any help with buffer management appreciated. Use the module array. -- Regards, Diez B. Rog

Re: char buffer

2005-03-10 Thread Jaime Wyant
You'll probably want to be more specific. First thing that comes to mind is how do you plan on passing the `buffer' to your `test app'. I can think of a couple of ways off hand -- socket, stdin or maybe as a command line argument. If you're doing one of those, then I don't think you'll need a bu

Re: Recognizing the Arrival of a New File

2005-03-10 Thread John Lenton
On Tue, Mar 08, 2005 at 08:43:04AM -0600, Greg Lindstrom wrote: > I am writing an application where I need to recognize when a file > arrives in a given directory. Files may arrive at any time during the > course of the day. Do I set up a cron job to poll the directory every > few minutes? Wr

Re: Iterate using tuple as index

2005-03-10 Thread Bengt Richter
On Thu, 10 Mar 2005 13:12:31 -0800, James Stroud <[EMAIL PROTECTED]> wrote: >Hello, > >Its not obvious to me how to do this. I would like to iterate using a tuple as >an index. Say I have two equivalently sized arrays, what I do now seems >inelegant: > >for index, list1_item in enumerate(firstli

Re: Iterate using tuple as index

2005-03-10 Thread James Stroud
Thank you everyone for pointing me to "zip". Very Handy! James -- James Stroud, Ph.D. UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterate using tuple as index

2005-03-10 Thread Tim Jarman
James Stroud wrote: > Hello, > > Its not obvious to me how to do this. I would like to iterate using a > tuple as an index. Say I have two equivalently sized arrays, what I do now > seems inelegant: > > for index, list1_item in enumerate(firstlist): > do_something(list1_item, secondlist[index]

Re: Iterate using tuple as index

2005-03-10 Thread F. Petitjean
Le Thu, 10 Mar 2005 13:12:31 -0800, James Stroud a écrit : > Hello, > > Its not obvious to me how to do this. I would like to iterate using a tuple > as > an index. Say I have two equivalently sized arrays, what I do now seems > inelegant: > > for index, list1_item in enumerate(firstlist): >

Re: Iterate using tuple as index

2005-03-10 Thread Terry Reedy
"James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Its not obvious to me how to do this. I would like to iterate using a > tuple as > an index. Say I have two equivalently sized arrays, what I do now seems > inelegant: Sounds like you want zip(firstlist, secondlist).

Re: Iterate using tuple as index

2005-03-10 Thread Michael Spencer
James Stroud wrote: Hello, Its not obvious to me how to do this. I would like to iterate using a tuple as an index. Say I have two equivalently sized arrays, what I do now seems inelegant: for index, list1_item in enumerate(firstlist): do_something(list1_item, secondlist[index]) I would like s

Iterate using tuple as index

2005-03-10 Thread James Stroud
Hello, Its not obvious to me how to do this. I would like to iterate using a tuple as an index. Say I have two equivalently sized arrays, what I do now seems inelegant: for index, list1_item in enumerate(firstlist): do_something(list1_item, secondlist[index]) I would like something more like

Re: How can I Read/Write multiple sequential Binary/Text data files

2005-03-10 Thread Bengt Richter
On 10 Mar 2005 09:41:05 -0800, "Albert Tu" <[EMAIL PROTECTED]> wrote: >Dear there, > >We have an x-ray CT system. The acquisition computer acquires x-ray >projections and outputs multiple data files in binary format (2-byte >unsigned integer) such as projection0.raw, projection1.raw, >projection2.

Re: How can I Read/Write multiple sequential Binary/Text data files

2005-03-10 Thread John Machin
On Thu, 10 Mar 2005 20:06:29 +0200, Christos "TZOTZIOY" Georgiou <[EMAIL PROTECTED]> wrote: >On 10 Mar 2005 09:41:05 -0800, rumours say that "Albert Tu" ><[EMAIL PROTECTED]> might have written: > >>Dear there, >> >>We have an x-ray CT system. The acquisition computer acquires x-ray >>projections a

instantiate new objects

2005-03-10 Thread Felix Steffenhagen
Hello @ all, i'm a newbie in python and have written a module for computations in a bayesian network. The module can be found at: http://www.informatik.uni-freiburg.de/~steffenh/bayes.py In this module i define four classes. - cdp (conditional probability [distribution]) consisting of cdp_entry

Re: PyAsm

2005-03-10 Thread olsongt
Hey Roger, I didn't realize that Stefan replied to the list and sent a private email reply. There seemed to be a lag in google groups today. I basically told him that I might be crazy enough to write an assembler in python, but I'm not crazy enough to start using those function decorators. I'm

Re: FW: list reduction

2005-03-10 Thread James Stroud
newlist = [y.cap for y in industrylist if y.cap < x] On Thursday 10 March 2005 12:00 pm, Leeds, Mark wrote: > I have a structure in python that I think is a list > > with elements .Cap and .Ticker > > where Cap is a float and Ticker is string. > > > > So, I reference things like > > industrylist[i

FW: list reduction

2005-03-10 Thread Leeds, Mark
  I have a structure in python that I think is a list with elements .Cap and .Ticker where Cap is a float and Ticker is string.   So, I reference things like industrylist[i].cap and industrylist[i].ticker and this works fine.   What I want to do is reduce the list so that it only

Re: python cvs interface?

2005-03-10 Thread corey
Well, the problem is that there are a lot of files to deal with, and I'm already running in parallel, but it still takes a while. Also, cvs uses some sort of locking scheme to stop parallel updates, so it's hard to parallelize effectively. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie : prune os.walk

2005-03-10 Thread Scott David Daniels
Rory Campbell-Lange wrote: Hi. How can I list root and only one level down? I've tried setting dirs = [] if root != start root, but it doesn't work. I clearly don't understand how the function works. I'd be grateful for some pointers. base = '/tmp/test' for root, dirs, files in os.walk(base

Re: os.walk(entire filesystem)

2005-03-10 Thread Uwe Becher
rbt wrote: More of an OS question than a Python question, but it is Python related so here goes: When I do os.walk('/') on a Linux computer, the entire file system is walked. On windows, however, I can only walk one drive at a time (C:\, D:\, etc.). Is there a way to make os.walk() behave on Wi

Re: python cvs interface?

2005-03-10 Thread Lonnie Princehouse
Unless your CVS repository is local, the overhead associated with calling CVS through system calls isn't going to be a bottleneck, and even then it shouldn't be too bad. Using one of the varieties of os.popen instead of os.system will make it easier to avoid disk I/O when communicating with the cv

Re: modifiable config files in compiled code?

2005-03-10 Thread Tom Willis
On Thu, 10 Mar 2005 13:01:28 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: > Larry Bates wrote: > > Note: my comments assume Windows distribution. > > > > Why do you think you can't you have a config file after you convert > > your program to an executable? I do it all the time and so do many >

Re: PyAsm

2005-03-10 Thread Roger Binns
"Stefan Behnel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Meaning: Put the assembler into the doc-string of a function. That has several issues. One is that you can't do string operations with it. Say you wanted some %d, %s etc in the string. If you use a documentation gene

Re: newbie: dictionary - howto get key value

2005-03-10 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > test = 3 #find person with this number > for x in xrange(len(phone.keys())): > print x >if phone[phone.keys()[x]] == test: > print phone.keys()[x] > break > >Being a newbie myself, I'd love a little critique on the

Re: newbie: dictionary - howto get key value

2005-03-10 Thread bruno modulix
[EMAIL PROTECTED] wrote: (top-post corrected) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of G. Völkl Sent: Thursday, March 10, 2005 12:19 PM To: python-list@python.org Subject: newbie: dictionary - howto get key value Hello, I use a dictionary: phon

Re: How can I Read/Write multiple sequential Binary/Text data files

2005-03-10 Thread TZOTZIOY
On 10 Mar 2005 09:41:05 -0800, rumours say that "Albert Tu" <[EMAIL PROTECTED]> might have written: >Dear there, > >We have an x-ray CT system. The acquisition computer acquires x-ray >projections and outputs multiple data files in binary format (2-byte >unsigned integer) such as projection0.raw,

Re: Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

2005-03-10 Thread Bengt Richter
# presets.py -- a decorator to preset function local variables without a default-argument hack or closure # also does currying, with adjustment of argument count, eliminating named arguments from right. # 20050310 09:22:15 -- alpha 0.01 release -- bokr # Released to the public domain WITH

Re: newbie: dictionary - howto get key value

2005-03-10 Thread Jeremy Jones
G. Völkl wrote: Hello, I use a dictionary: phone = {'mike':10,'sue':8,'john':3} phone['mike'] --> 10 I want to know who has number 3? 3 --> 'john' How to get it in the python way ? Thanks Gerhard How 'bout a list comprehension: In [1]:phone = {'mike':10,'sue':8,'john':3, 'billy':3} In [

Re: modifiable config files in compiled code?

2005-03-10 Thread Steve Holden
Larry Bates wrote: Note: my comments assume Windows distribution. Why do you think you can't you have a config file after you convert your program to an executable? I do it all the time and so do many I suspect the OP's config file is a Python module. regards Steve -- http://mail.python.org/mailm

Re: newbie: dictionary - howto get key value

2005-03-10 Thread bruno modulix
G. Völkl wrote: Hello, I use a dictionary: phone = {'mike':10,'sue':8,'john':3} phone['mike'] --> 10 I want to know who has number 3? 3 --> 'john' Note that you can have many keys with the same value: phone = {'mike':10,'sue':8,'john':3, 'jack': 3, 'helen' : 10} How to get it in the python way

Re: mysqldb issue

2005-03-10 Thread Steve Holden
fedor wrote: Hi all, I have a problem with mysql connections. After about 28000-29000 connections, I get a "Can't connect to MySQL server on '127.0.0.1'" error. I have made a small program which generates the error """ import MySQLdb for i in range(3): if not i % 100:

How can I Read/Write multiple sequential Binary/Text data files

2005-03-10 Thread Albert Tu
Dear there, We have an x-ray CT system. The acquisition computer acquires x-ray projections and outputs multiple data files in binary format (2-byte unsigned integer) such as projection0.raw, projection1.raw, projection2.raw ... up to projection500.raw. Each file is 2*1024*768-byte big. I would l

Re: newbie: dictionary - howto get key value

2005-03-10 Thread Diez B. Roggisch
phone = {'mike':10,'sue':8,'john':3} print [key for key, value in phone.items() if value == 3] -> ['john'] -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread TZOTZIOY
On Thu, 10 Mar 2005 10:54:05 +0100, rumours say that Patrick Useldinger <[EMAIL PROTECTED]> might have written: >I wrote something similar, have a look at >http://www.homepages.lu/pu/fdups.html. That's fast and good. A minor nit-pick: `fdups.py -r .` does nothing (at least on Linux). Have you

RE: newbie: dictionary - howto get key value

2005-03-10 Thread Michael . Coll-Barth
how about? test = 3 #find person with this number for x in xrange(len(phone.keys())): print x if phone[phone.keys()[x]] == test: print phone.keys()[x] break Being a newbie myself, I'd love a little critique on the above. Be kind as I don't know what else needs to be done

Re: BaseHTTPServer.BaseHTTPRequestHandler and HTTP chunking

2005-03-10 Thread Venkat B
> No. Hardly any HTTP 1.1 features are supported. Hi all, I'd like to know more about the limitations. Somewhere, is there a list of the actual subset of HTTP 1.1 features supported. There's not much related info at the python.org site. There appears to be just a limited note on 1.1 in http://ww

[Pmw] reusing a graph after deleting a curve

2005-03-10 Thread giacomo boffi
my question: is it possible to erase a graph, and reuse it? like in # x -> compute -> y g=Pmw.Blt.Graph(); g.pack() g.line_create(name,x,y) # other computing -> a better y # do something to g, erasing the previous plot #[the above is the part that i cannot understand...] g.line_create(name,x

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread P
I've written a python GUI wrapper around some shell scripts: http://www.pixelbeat.org/fslint/ the shell script logic is essentially: exclude hard linked files only include files where there are more than 1 with the same size print files with matching md5sum Pádraig. -- http://mail.python.org/mailma

newbie: dictionary - howto get key value

2005-03-10 Thread G. Völkl
Hello, I use a dictionary: phone = {'mike':10,'sue':8,'john':3} phone['mike'] --> 10 I want to know who has number 3? 3 --> 'john' How to get it in the python way ? Thanks Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread TZOTZIOY
On Wed, 9 Mar 2005 16:13:20 -0600, rumours say that Terry Hancock <[EMAIL PROTECTED]> might have written: >For anyone interested in responding to the above, a starting >place might be this maintenance script I wrote for my own use. I don't >think it exactly matches the spec, but it addresses the

Re: How do I set up a timer as a subprocess?

2005-03-10 Thread Shitiz Bansal
import threading def hello(): print "hello, world" t = threading.Timer(30.0, hello) t.start() # after 30 seconds, "hello, world" will be printed --- Dfenestr8 <[EMAIL PROTECTED]> wrote: > Hi. > > Trying to set up a timer function for my irc bot, > which uses the python > irclib.py. > > If

Re: How do I set up a timer as a subprocess?

2005-03-10 Thread Daniel Schüle
Hi > Trying to set up a timer function for my irc bot, which uses the python > irclib.py. > > If I use time.sleep(20), it tends to freeze up the bot completely for 20 > secs. That's not what I want though! I want the program to wait 20 secs, > then perform another function, but in the meantime be

How do I set up a timer as a subprocess?

2005-03-10 Thread Dfenestr8
Hi. Trying to set up a timer function for my irc bot, which uses the python irclib.py. If I use time.sleep(20), it tends to freeze up the bot completely for 20 secs. That's not what I want though! I want the program to wait 20 secs, then perform another function, but in the meantime be able to ac

Re: i18n: looking for expertise

2005-03-10 Thread klappnase
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Michael: > > on my box, (winXP SP2), sys.getfilesystemencoding() returns 'mbcs'. Oh, from the reading docs I had thought XP would use unicode: * On Windows 9x, the encoding is ``mbcs''. * On Mac OS X, the en

[ANN] Pythonutils updates - approx, approxClientproxy, caseless etc

2005-03-10 Thread Fuzzyman
Various of the Voidspace Pythonutils modules have been updated. http://www.voidspace.org.uk/python/index.shtml approx.py has been updated (Python CGI Proxy script) approxClientproxy.py version 2.0 is available listquote, caseless, linky, and downman have all been updated. *MAJOR UPDATE* approx

[ANN] ConfigObj Update and New PythonUtils Package

2005-03-10 Thread Fuzzyman
ConfigObj has had another update - now version 3.3.0 Several of the Voidspace PythonUtils modules have been packaged together as the 'Voidspace Pythonutils Package'. This makes it easier to release packages that depend on ConfigObj and the other modules. This update includes several important new

Re: modifiable config files in compiled code?

2005-03-10 Thread Larry Bates
Note: my comments assume Windows distribution. Why do you think you can't you have a config file after you convert your program to an executable? I do it all the time and so do many other programs. The .INI config file is just a separate file that provides a good way to pass client supplied info

Re: python open source charting solutions ?

2005-03-10 Thread Frithiof Andreas Jensen
"ionel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > i need some pointers. > so far i've tryed matplotlib ... What For, exactly? For time series, RRD-Tools (Round-Robin Database) works very well. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >