Re: For Large Dictionaries Could One Use Separate Dictionaries Where Each Dictionary Covers an Interval of the Input Range?

2006-05-16 Thread Graham Fawcett
Casey Hawthorne wrote: For Large Dictionaries Could One Use Separate Dictionaries Where Each Dictionary Covers an Interval of the Input Range? One Could, But Why? :-) You wouldn't see any performance improvements. Looking up a key in a dictionary is done in constant-time, i.e. it doesn't matter

Re: For Large Dictionaries Could One Use Separate Dictionaries Where Each Dictionary Covers an Interval of the Input Range?

2006-05-16 Thread Graham Fawcett
On 5/16/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Graham Looking up a key in a dictionary is done in constant-time, Graham i.e. it doesn't matter how large the dictionary is. Doesn't that depend on how many keys hash to the same value? For small dictionaries keeping the max

Re: Characters contain themselves?

2006-04-11 Thread Graham Fawcett
Sion Arrowsmith wrote: Unfortunately: print 'a'+'bc' |ips| 'abc' True Which might not be what you want. On the other hand, it's a simple fix: ips = Infix(lambda a, b: (a != b) and (a in b)) print 'a'+'bc' |ips| 'abc' Ah, good point. Graham --

Re: exec a string in an embedded environment

2006-01-11 Thread Graham Fawcett
Tommy R wrote: I need some way to execute a string and pass arguments to the functions inside the string. We have discussed a solution where we first load the string (containing some funcs) and then run something similar to Py_RunString(foo(1.0, 'str')); We need to do this in a generic way

Re: Guido at Google

2005-12-22 Thread Graham Fawcett
Cameron Laird wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: . Well, this may be the CPython way of open source but I don't know if that is Open source in general. Another way is that if someone(or group) don't like the current state of a project, they

Re: Guido at Google

2005-12-22 Thread Graham Fawcett
Steve Holden wrote: Nicola Musatti wrote: Of course, I'm going on vacation next week and there was talk about a one-way ticket to Mexico. The real question is will they let me *back* in? :-) I would be careful coming back across the border. I heard that the PSU [suspicous premature

Re: Guido at Google

2005-12-22 Thread Graham Fawcett
Peter Hansen wrote: Graham Fawcett wrote: Steve Holden wrote: Nicola Musatti wrote: Of course, I'm going on vacation next week and there was talk about a one-way ticket to Mexico. The real question is will they let me *back* in? :-) I would be careful coming back across the border. I

Re: Parser or regex ?

2005-12-16 Thread Graham Fawcett
Fuzzyman wrote: Hello all, I'm writing a module that takes user input as strings and (effectively) translates them to function calls with arguments and keyword arguments.to pass a list I use a sort of 'list constructor' - so the syntax looks a bit like : checkname(arg1, arg 2, 'arg 3',

Re: Winsound doesn't play whole sound?

2005-11-30 Thread Graham Fawcett
Dieter Vanderelst wrote: Hello, I'm having a problem with playing WAV files using Winsound. If I use winsound to play a certain WAV files only the first few seconds of the file get played. I think this comes because these files contain some parts of silence. There winsound seems the stop

Re: Stealing focus: emacs, and PIL, in Windows

2005-11-26 Thread Graham Fawcett
[EMAIL PROTECTED] wrote: I'm using GNU Emacs 21.3.1 with python-mode 1.0alpha under Windows XP. Whenever I execute a command in an edit window (with py-execute-region), the output window steals the focus. How can I stop this happening? [snip] I commented out the command (pop-to-buffer

Re: python win32 and COM? for internet monitoring

2005-11-22 Thread Graham Fawcett
Matthew Thorley wrote: Greetings, I have a question I hope some one with more back ground can give me a little help with. I want to write a simple internet monitoring script for windows that watches out bound http traffic and keeps a list of all the site visited. I am thinking that I might

Re: Python and Lotus Notes

2005-11-04 Thread Graham Fawcett
Marco Aschwanden wrote: The second line of your code is already a show stopper in my case: from win32com.client import Dispatch session = Dispatch('Lotus.NotesSession') session.Initialize('my_secret_passwort') When started, ends: [snip] AttributeError: Lotus.NotesSession.Initialize It

Re: ADT for restricted set of values

2005-11-03 Thread Graham Fawcett
Ben Finney wrote: Howdy all, I'd like to have an Abstract Data Type for a scalar value that is restricted to a small set of values. Like an Enum, I suppose. What I would like is to be able to use simple 'str' values in most of the code, but where the values are actually used in a

Re: Python and Lotus Notes

2005-11-02 Thread Graham Fawcett
Grzegorz Slusarek wrote: Hello everyone. I have to get data from Lotus Notes and i curious is it possible doing it with Python. I heard that Lotus Notes using COM, so the Python does so maybe it can be done? Anyone have any experiences doing that? Ane help will by apreciated Yes, it's

Re: write a loopin one line; process file paths

2005-10-24 Thread Graham Fawcett
Xah Lee wrote: Dear Peter Hansen, My messages speak themselfs. You and your cohorts's stamping of it does not change its nature. And if this is done with repetitiousness, it gives away your nature. Taunt not the cohorts of Peter Hansen! Graham --

Re: MS Word Outline - reStructuredText script?

2005-10-14 Thread Graham Fawcett
Jim wrote: Hi, I'm using reStructuredText as a format for some group documentation, and often my co-workers take notes during meetings in Word's outline mode. Does anyone already have a python script that will convert from Word (or the Open Office file format version of a word document) to

Re: ssh or other python editor

2005-10-04 Thread Graham Fawcett
[EMAIL PROTECTED] wrote: So you're using Putty to telenet/ssh into the FreeBSD server, but what editor on you using on the FreeBSD server? I use pico for that. That Samba isn't available but I can install it. Or are there other editors for FreeBSD that I can run with putty ? I use Emacs on

Re: wxPython Notebook crash when pressing alt key

2005-09-22 Thread Graham Fawcett
Kreedz wrote: Could Windows version have anything to do with this?? Else I've got some really weird issue... I'm on Windows 2000 Professional Yes, that definitely counts as a wierd issue. wink I couldn't reproduce the bug either. C:\temppython ActivePython 2.4.1 Build 247 (ActiveState

Re: How to store 3D data? (data structure question)

2005-07-20 Thread Graham Fawcett
Sebastian Bassi wrote: Hello, I have to parse a text file (was excel, but I translated to CSV) like the one below, and I am not sure how to store it (to manipulate it later). Here is an extract of the data: [snip] This looks a lot like 2D data (row/column), not 3D. What's the third axis?

Re: How to store 3D data? (data structure question)

2005-07-20 Thread Graham Fawcett
Sebastian Bassi wrote: On 20 Jul 2005 10:47:50 -0700, Graham Fawcett [EMAIL PROTECTED] wrote: This looks a lot like 2D data (row/column), not 3D. What's the third axis? It looks, too, that you're not really interested in storage, but in analysis... I think it as 3D like this: 1st axis

Re: Web App like Google

2005-07-12 Thread Graham Fawcett
In translating natural language to SQL, be sure you're not introducing opportunities for SQL injection attacks. Code like sql = 'SELECT %s FROM %s' % (this, that) is considered dangerous, because a well-crafted value for that can be used to, e.g., delete rows from your tables, run system

Re: When someone from Britain speaks, Americans hear a British accent...

2005-06-30 Thread Graham Fawcett
Steven D'Aprano wrote: Speaking as an Australia, ... [snip] But don't worry, there is one thing we all agree on throughout the English-speaking world: you Americans don't speak English. And lest you feel Steven's observation don't bear much weight, keep in mind that he is speaking as an

Re: the problem wtih cgi

2005-05-27 Thread Graham Fawcett
chris patton wrote: Hi everyone. Has anyone seen that problem with running a python cgi script in a server? It takes you to myspace.com/redmartian or something. Anyway, does anyone know when this problem will be fixed? It could be solved much sooner if you follow these steps: (1) Carefully

Re: Getting directory size

2005-03-21 Thread Graham Fawcett
Peter Hansen wrote: francisl wrote: How can we get a full directory size (sum of all his data)? like when we type `du -sh mydir` Because os.path.getsize('mydir') only give the size of the directory physical representation on the disk. os.popen('du -sh mydir') would be one approach.

Re: Python mascot proposal

2004-12-13 Thread Graham Fawcett
Luis M. Gonzalez wrote: Hey Dimitri, I completely agree with you in that Python needs once for all a cool logo. I like your design very much, but I have a few thoughts about it: 1) I think that Python's logo should reflect its power. If we use a mascot as its image, we would be giving the