Re: simultaneous reading and writing a textfile

2006-05-16 Thread Larry Bates
Marco Herrn wrote: > Hi, > > I have a text file with some lines in it. > Now I want to iterate over this file and exchange some lines with some > others. I tried this approach: > > try: > myfile= file('myfile', 'r+') > > while 1: > line= myfile.readline() >

Re: Help System For Python Applications

2006-05-16 Thread johnzenger
[EMAIL PROTECTED] wrote: > On a related note, is there a way to fire up Adobe's Acorbat Reader or > and Web Browser from Python and have the external application open a > specified PDF or HTML file? (For example, I want to open the file > "myhelp.pdf" in reader from Python code.) The webbrowser m

Re: Help System For Python Applications

2006-05-16 Thread Harold Fellermann
I usually go for the webbrowser package that allows me to launch the systems webbrowser and opens my html help files. It is really simple: >>> import webbrowser >>> webbrowser.open("file:///path_to/help.html#topic") and thats all there is to do. - harold - -- http://mail.python.org/mailman/lis

Re: Help System For Python Applications

2006-05-16 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > I did some searching for this topic, but couldn't find anything. A > search of this list only turned up an old post from 2002. > > I'd like to add a comprehesive help system to my Python Application. By > "comprehensive" I mean regular "read-like-a-book" help and context

Re: Unable to extract Python source code using Windows

2006-05-16 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > I'm currently trying to get access to the Python source code, however > whenever I try to extract the files from what ? > using the latest version of WinZip > (version 10) I get the following error "error reading header after > processing 0 entries" > I was under the im

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

2006-05-16 Thread Ken Tilton
Ben wrote: > This kind of discussions between two groups of people, > neither of who know the other person's language very well just wind me > up something chronic! I must say, it is pretty funny how a flamewar turned into a pretty interesting SoC project. > Anything that makes programming mor

Re: Help System For Python Applications

2006-05-16 Thread redefined . horizons
Thanks for the responses. I'll check out the web browser module, and I'll make sure that I release any work ona help system to the community. Scott Huey bruno at modulix wrote: > [EMAIL PROTECTED] wrote: > > I did some searching for this topic, but couldn't find anything. A > > search of this lis

Re: Help System For Python Applications

2006-05-16 Thread Paul Boddie
bruno at modulix wrote: > [EMAIL PROTECTED] wrote: > > > On a related note, is there a way to fire up Adobe's Acorbat Reader or > > and Web Browser from Python and have the external application open a > > specified PDF or HTML file? (For example, I want to open the file > > "myhelp.pdf" in reader f

Re: simultaneous reading and writing a textfile

2006-05-16 Thread Peter Otten
Marco Herrn wrote: > I have a text file with some lines in it. > Now I want to iterate over this file and exchange some lines with some > others. I tried this approach: > This should inspect the file and find the first line, that can't be > split into two parts (that means, which has only one wor

Re: [silly] Does the python mascot have a name ?

2006-05-16 Thread John D Salt
Steve <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > umm, was just wondering, does the python mascot have a name ? I always assumed it was Monty, but I confess to not having the slightest factual basis for this belief. All the best, John. -- http://mail.python.org/mailman/listinfo/

Re: [silly] Does the python mascot have a name ?

2006-05-16 Thread Carl J. Van Arsdall
John D Salt wrote: > Steve <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > >> umm, was just wondering, does the python mascot have a name ? >> > > I always assumed it was Monty, but I confess to not having the slightest > factual basis for this belief. > > To be honest, Mon

Wrong args and issuing a SIGUSR1 signal

2006-05-16 Thread Sori Schwimmer
Hi All, I finally put my hands on a GUI-less Linux box and tried the little signal sending experiment. It gives the same! I'm left wondering what is the frame object... Regards, Sorin Schwimmer __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the

Re: Python and Combinatorics

2006-05-16 Thread Nic
Thanks a bunch. Both the codes are fine. Only one question, if you allow. In my example I've chosen the number 3. How should I change the Python code in order to select another number (e.g. 7)? Thanks. Nic -- http://mail.python.org/mailman/listinfo/python-list

Re: Unable to extract Python source code using Windows

2006-05-16 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > I'm currently trying to get access to the Python source code, however > whenever I try to extract the files using the latest version of WinZip > (version 10) I get the following error "error reading header after > processing 0 entries" > I was under the impression that I

Re: [silly] Does the python mascot have a name ?

2006-05-16 Thread skip
Carl> To be honest, Monty really makes the most sense to me for a mascot Carl> name... now if we can only get past all that damn copyright Carl> infringement ;) My dad's nickname was Monty. Some friends of my son, Chris, call him Monty as well. I doubt either of them would object.

Re: [silly] Does the python mascot have a name ?

2006-05-16 Thread Steve
John D Salt wrote: > Steve <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > >> umm, was just wondering, does the python mascot have a name ? > > I always assumed it was Monty, but I confess to not having the slightest > factual basis for this belief. Well, so Monty it is ! ...btw, did

Re: [silly] Does the python mascot have a name ?

2006-05-16 Thread Carl J. Van Arsdall
Steve wrote: > > Well, so Monty it is ! ...btw, did you know, the Camel > (http://dev.perl.org/perl6/rfc/343.html) doesn't have a name either ? > ...looks > like Duke (http://www.java.com/en/dukeszone/) is the only dude with a name > ...but then duke is not an animal (wtf is it ?), so it had to

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

2006-05-16 Thread Lasse Rasinen
Ken Tilton <[EMAIL PROTECTED]> writes: > If you want to insist on how perfect your code is, please go find > ltktest-cells-inside.lisp in the source you downloaded and read the long > comment detailing the requirements I have identified for "data integrity". > Then (a) tell me how your code fails

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread Edward Elliott
achates wrote: > A tab is not equivalent to a number of spaces. It is a character > signifying an indent, just like the newline character signifies the end > of a line. This link posted over in comp.lang.perl.misc expands on that: http://numeromancer.dyndns.org/~timothy/tab-width-independence/de

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread achates
Duncan Booth wrote: >but I prefer editors which keep things >simple. The tab key is particularly prone to excessively complicated >actions, for example the editor I use has the following (not simple at >all, and in fact not even an accurate description of what it does) binding >for the tab key:

Option parser question - reading options from file as well as command line

2006-05-16 Thread Andrew Robert
Hi Everyone. I tried the following to get input into optionparser from either a file or command line. The code below detects the passed file argument and prints the file contents but the individual swithces do not get passed to option parser. Doing a test print of options.qmanager shows it una

Re: Help System For Python Applications

2006-05-16 Thread redefined . horizons
Thanks for the link Paul. It looks like you've done some good work on that module. I'll check it out. Scott Paul Boddie wrote: > bruno at modulix wrote: > > [EMAIL PROTECTED] wrote: > > > > > On a related note, is there a way to fire up Adobe's Acorbat Reader or > > > and Web Browser from Python

Did anyone get audio/video from PyCon 2006?

2006-05-16 Thread olsongt
The obvious link from google seems to indicate that no audio or video got captured. Is this true, or am I looking in the wrong place? http://tinyurl.com/zu9lo Thanks, Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: How to pass variables between scripts?

2006-05-16 Thread Marcelo Ramos
Gross, Dorit (SDRN) escribió: >>> #! /usr/local/bin/python >>> # test_exec.py >>> >>> import os, sys, glob >>> >>> fileList = glob.glob('/data/*.ZIP') >>> >>> for f in fileList: >>> try: >>> globvars = {'infile' : f} >>> locvars = {} >>> execfile('/scripts/s

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread Kaz Kylheku
Xah Lee wrote: > Tabs vs Spaces can be thought of as parameters vs hard-coded values, or > HTML vs ascii format, or XML/CSS vs HTML 4, or structural vs visual, or > semantic vs format. In these, it is always easy to convert from the > former to the latter, but near impossible from the latter to the

How to log only one level to a FileHandler using python logging module.

2006-05-16 Thread fuzzylollipop
I want a FileHandler to only log a single level say for example logging.INFO, and nothing else. do I need to create a custom Handler for this or is this doable with some magic that is not documeneted somewhere? -- http://mail.python.org/mailman/listinfo/python-list

Re: Option parser question - reading options from file as well as command line

2006-05-16 Thread Max Erickson
Andrew Robert <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Hi Everyone. > > > I tried the following to get input into optionparser from either > a file or command line. > > > The code below detects the passed file argument and prints the > file contents but the individual swithces d

Re: Unable to extract Python source code using Windows

2006-05-16 Thread [EMAIL PROTECTED]
>You can get Python sources from python.org I'm unable to locate a source file brings that will work with WinZip. Can anybody please point me to the exact URL that will get me to the source code? but it it is tar ball format or a gzip format, than that will work for me as WinZip is not open. --

round numbers in an array without importing Numeric or Math?

2006-05-16 Thread Lance Hoffmeyer
Is there an easy way to round numbers in an array? I have Test = [1.1,2.2,3.7] and want to round so the values are print Test [1,2,4] Lance -- http://mail.python.org/mailman/listinfo/python-list

Re: Unable to extract Python source code using Windows

2006-05-16 Thread [EMAIL PROTECTED]
Scott , I tried downloading for different archives, (different versions of Python) I can't believe they are all garbled. But they all don't work with WinZip. -- http://mail.python.org/mailman/listinfo/python-list

Re: round numbers in an array without importing Numeric or Math?

2006-05-16 Thread Alexander Schmolck
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > Is there an easy way to round numbers in an array? > > I have > Test = [1.1,2.2,3.7] > > and want to round so the values are > > print Test [1,2,4] [int(x+0.5) for x in Test] 'as -- http://mail.python.org/mailman/listinfo/python-list

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread Edward Elliott
achates wrote: > With spaces for indentation, this just isn't possible, because I have > to conform to your viewing preferences, and that makes me unhappy. Why > would you want to make me unhappy? +5 QOTW -- Edward Elliott UC Berkeley School of Law (Boalt Hall) complangpython at eddeye dot net

Re: Option parser question - reading options from file as well as command line

2006-05-16 Thread Andrew Robert
Max Erickson wrote: > Andrew Robert <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > <\snip> > Check parser.usage, it is likely to look a lot like your infile. > > I'm not sure, but I think you need to pass your alternative arguments > to parser.parse_args. > > max > Hi Max, I tri

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 matte

Re: Unable to extract Python source code using Windows

2006-05-16 Thread Philippe Martin
[EMAIL PROTECTED] wrote: >>You can get Python sources from python.org > > I'm unable to locate a source file brings that will work with WinZip. > Can anybody please point me to the exact URL that will get me to the > source code? but it it is tar ball format or a gzip format, than that > will wor

Re: round numbers in an array without importing Numeric or Math?

2006-05-16 Thread Lance Hoffmeyer
May have a complicating issue with the array? Have the numbers have been interpreted as strings? I have been pulling them from a Word doc using regex's print Test [u'9.0', u'58.6', u'97.8', u'10.0', u'9.6', u'28.1'] Lance Alexander Schmolck wrote: > Lance Hoffmeyer <[EMAIL PROTECTED]> writes

Subclassing types in C

2006-05-16 Thread William Studenmund
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I used the embedding python guide to embed python in an application to let me easily script the app. It's all working rather well, and I've added a number of types which expose the internals to python. However I've gotten to the point where I want

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread achates
Kaz Kylheku wrote: > If you want to do nice typesetting of code, you have to add markup > which has to be stripped away if you actually want to run the code. Typesetting code is not a helpful activity outside of the publishing industry. You might like the results of your typsetting; I happen not

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

2006-05-16 Thread skip
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 keys that hash to the same value small isn't a huge problem.

Re: round numbers in an array without importing Numeric or Math?

2006-05-16 Thread skip
Lance> May have a complicating issue with the array? Have the numbers Lance> have been interpreted as strings? I have been pulling them from Lance> a Word doc using regex's [int(float(x)+0.5) for x in Test] S -- http://mail.python.org/mailman/listinfo/python-list

Re: round numbers in an array without importing Numeric or Math?

2006-05-16 Thread Dan Sommers
On Tue, 16 May 2006 13:41:37 -0500, Lance Hoffmeyer <[EMAIL PROTECTED]> wrote: > May have a complicating issue with the array? Have > the numbers have been interpreted as strings? I have > been pulling them from a Word doc using regex's > print Test > [u'9.0', u'58.6', u'97.8', u'10.0', u'9.6',

Re: round numbers in an array without importing Numeric or Math? - SOLVED, sort of

2006-05-16 Thread Lance Hoffmeyer
The array comes out as unicode. This is probably because I am grabbing the numbers from a Word Doc using regex's. So, before rounding I perform the following: # Convert to String Topamax = [str(x) for x in Topamax] # Convert to floating Topamax = [float(x) for x in Topamax] # Finally, round the

Re: Using python for a CAD program

2006-05-16 Thread 63q2o4i02
Cool. thanks for the links. I've already looked around quite a bit, and am very hesitant to just write more shit on top of other shit. The idea behind this is it's completely mine. So yes, I have a tendency to want to reinvent a few wheels, but I think it'll give me greater satisfaction. The pr

Re: round numbers in an array without importing Numeric or Math? - SOLVED, sort of

2006-05-16 Thread Paul McGuire
"Lance Hoffmeyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The array comes out as unicode. This is probably because I am grabbing the numbers > from a Word Doc using regex's. > > So, before rounding I perform the following: > # Convert to String > Topamax = [str(x) for x in To

Re: round numbers in an array without importing Numeric or Math? - SOLVED, sort of

2006-05-16 Thread Paul McGuire
"Lance Hoffmeyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The array comes out as unicode. This is probably because I am grabbing the numbers > from a Word Doc using regex's. > > So, before rounding I perform the following: > # Convert to String > Topamax = [str(x) for x in To

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 th

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread Duncan Booth
achates wrote: > You haven't explained why you think there's a problem with having a > character which, in an unambiguous and non-implementation-specific way, > means 'one level of indentation'. In Python, of all languages, it makes > sense to have such a character because 'one level of indentatio

Re: Using python for a CAD program

2006-05-16 Thread Paddy
Unfortunately, Cadence got their first with their DFII environment for Schematic based design and their Lisp based language SKILL (http://www-mtl.mit.edu/users/xiaolin/skill/sklanguser/sklanguserTOC.html) I used their environment several years ago and can only say that it was all you have stated a

Re: Using python for a CAD program

2006-05-16 Thread skip
Someone anonymous wrote: >> Cool. thanks for the links. I've already looked around quite a bit, >> and am very hesitant to just write more shit on top of other shit. That seems like a gratuitously unkind way to refer to tools you haven't tried. Have you checked out PythonCAD?

Re: Using python for a CAD program

2006-05-16 Thread Hannu Krosing
Ühel kenal päeval, E, 2006-05-15 kell 23:49, kirjutas [EMAIL PROTECTED]: > 2. GUI. Yes, I know you can do guis with qt, gtk, tkinter, etc. I'm > talking of fancy guis that do alpha blending, animations, nice > shading/gradients, etc. in a quick, smooth, and slick way, such that > moving a scrol

Re: Using python for a CAD program

2006-05-16 Thread 63q2o4i02
Yes, I figured I should be pretty expert at what's out there first before redoing something and making in inferior to the existing solution. I took a quick peek at cadence courses, and they're out of my personal price range. I have a new job coming up which should lead into IC design after some t

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

2006-05-16 Thread Ken Tilton
Lasse Rasinen wrote: > Ken Tilton <[EMAIL PROTECTED]> writes: > > >>If you want to insist on how perfect your code is, please go find >>ltktest-cells-inside.lisp in the source you downloaded and read the long >>comment detailing the requirements I have identified for "data integrity". >>Then (a

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

2006-05-16 Thread Roy Smith
In article <[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

Re: Using python for a CAD program

2006-05-16 Thread Grant Edwards
On 2006-05-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Yes, I figured I should be pretty expert at what's out there > first before redoing something and making in inferior to the > existing solution. Eagle from Cadsoft.de is a pretty decent (and free for educational/hobby use) integrated s

calling upper() on a string, not working?

2006-05-16 Thread John Salerno
Can someone tell me what's happening here. This is my code: PUNCT_SPACE_SET = set(string.punctuation + string.whitespace) def filter_letters(original): return ''.join(set(original) - PUNCT_SPACE_SET) 'original' is a string. The above works as expected, but when I change it to return '

Re: calling upper() on a string, not working?

2006-05-16 Thread Felipe Almeida Lessa
Em Ter, 2006-05-16 às 20:25 +, John Salerno escreveu: > it doesn't seem to work. The full code is below if it helps to understand. Why doesn't it work? What does it do, what did you expect it to do? >>> ''.join(set('hi')) 'ih' >>> ''.join(set('HI')) 'IH' >>> ''.join(set('hiHI')) 'ihIH' >>> ''

Re: Option parser question - reading options from file as well as command line

2006-05-16 Thread Max Erickson
Andrew Robert <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Any ideas? I don't know much about optparse, but since I was bored: >>> help(o.parse_args) Help on method parse_args in module optparse: parse_args(self, args=None, values=None) method of optparse.OptionParser instance p

Re: How to log only one level to a FileHandler using python logging module.

2006-05-16 Thread zacherates
Try looking into logging.Filters: http://docs.python.org/lib/node358.html An example: import logging class InfoFilter(logging.Filter): def filter(self, record): return record.levelno == 20 if __name__ == "__main__": logger = logging.getLogger() hdlr = log

Re: IDLE confusion

2006-05-16 Thread Terry Reedy
"Christophe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Try in the IDLE menu [Shell] "Restart Shell" (Ctrl+F6) each time you > have changed something in your files - this "resets" anything previously > imported, which stays the same way otherwise. And I though that "bug" was f

Re: calling upper() on a string, not working?

2006-05-16 Thread John Salerno
Felipe Almeida Lessa wrote: > Em Ter, 2006-05-16 às 20:25 +, John Salerno escreveu: >> it doesn't seem to work. The full code is below if it helps to understand. > > Why doesn't it work? What does it do, what did you expect it to do? If you run the whole script with the first line (the one no

Re: calling upper() on a string, not working?

2006-05-16 Thread Michal Kwiatkowski
John Salerno wrote: > def encrypt_quote(original): > original_letters = filter_letters(original) You call filter_letters() which makes upper() on all letters, so original_letters contain only uppercase letters. > new_letters = list(string.ascii_uppercase) > while True: > r

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread achates
Duncan Booth wrote: >Because it doesn't mean 'one level of indentation', it means 'move to next >tabstop' and a tabstop isn't necessarily the same as a level of >indentation. 'move to next tabstop' is how your editor interprets a tab character. 'one level of indentation' is how the language parse

Re: calling upper() on a string, not working?

2006-05-16 Thread John Salerno
Michal Kwiatkowski wrote: > And here you're translating 'original' (which contains a lot of > lowercase letters) with use of trans_table that maps only uppercase > characters. This return should be: > > return original.upper().translate(trans_table) Thank you!!! :) -- http://mail.python

Re: SystemError: ... cellobject.c:22: bad argument to internal ?

2006-05-16 Thread robert
[EMAIL PROTECTED] wrote: > robert wrote: > >>From the trace of a 2.3.5 software i got: >> >>\'SystemError: >>C:sfpythondist23srcObjectscellobject.c:22: bad >>argument to internal >>function\\n\'] > > > ... > > >>Will there be another bug-fix release of Python 2.3 ? >

Re: calling upper() on a string, not working?

2006-05-16 Thread Larry Bates
John Salerno wrote: > Can someone tell me what's happening here. This is my code: > > > > PUNCT_SPACE_SET = set(string.punctuation + string.whitespace) > > def filter_letters(original): > return ''.join(set(original) - PUNCT_SPACE_SET) > > > > 'original' is a string. The above works as e

Re: calling upper() on a string, not working?

2006-05-16 Thread Bruno Desthuilliers
John Salerno a écrit : > Can someone tell me what's happening here. This is my code: > > PUNCT_SPACE_SET = set(string.punctuation + string.whitespace) > > def filter_letters(original): > return ''.join(set(original) - PUNCT_SPACE_SET) > > 'original' is a string. The above works as expected,

Re: calling upper() on a string, not working?

2006-05-16 Thread John Salerno
Bruno Desthuilliers wrote: >> def encrypt_quote(original): > # Since it's here that we define that the new letters > # will be uppercase only, it's our responsability > # to handle any related conditions and problems > # The other functions shouldn't have to even know this.

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread Duncan Booth
achates wrote: >>In particular a common convention is to have indentations at 4 >>spaces and tabs expanding to 8 spaces. > > Like all space-indenters, you seem to be hung up on the idea of a tab > 'expanding' to n spaces. It only does that if you make your editor > delete the tab character and re

Beautiful parse joy - Oh what fun

2006-05-16 Thread rh0dium
Hi all, I am trying to parse into a dictionary a table and I am having all kinds of fun. Can someone please help me out. What I want is this: dic={'Division Code':'SALS','Employee':'LOO ABLE'} Here is what I have.. html=""" Division Code: SALS Employee: LOO ABLE """ from Beautiful

still don't get unicode and xml - help!

2006-05-16 Thread jmdeschamps
I have to work with XML data containing accented characters (ISO-8859-1 encoding) Using ElementTree, the only way i found to get the text attribute of a node was to encode it individually, if you want. It doubles the amount of time to process :-( i surely doing this wrong... What is the good way to

Re: Python and Combinatorics

2006-05-16 Thread Peter Otten
Nic wrote: > In my example I've chosen the number 3. > How should I change the Python code in order to select another number > (e.g. 7)? Here is a parameterized render(). def render(w, h, suffixes="ab"): pairs = list(unique(range(1, h+1), 2)) for item in unique(pairs, w): for suf

Re: Beautiful parse joy - Oh what fun

2006-05-16 Thread Larry Bates
rh0dium wrote: > Hi all, > > I am trying to parse into a dictionary a table and I am having all > kinds of fun. Can someone please help me out. > > What I want is this: > > dic={'Division Code':'SALS','Employee':'LOO ABLE'} > > Here is what I have.. > > html=""" src="/icons/ecblank.gif"

arrays, even, roundup, odd round down ?

2006-05-16 Thread Lance Hoffmeyer
So, I have using the following to grab numbers from MS Word. I discovered that that there is a "special" rule being used for rounding. If a ??.5 is even the number is to rounded down (20.5 = 20) if a ??.5 is odd the number is to rounded up (21.5 = 22) Brands = ["B1","B2"] A1 = [] A1 = [ re.sear

Re: Unable to extract Python source code using Windows

2006-05-16 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > Scott , > I tried downloading for different archives, (different versions of > Python) I can't believe they are all garbled. But they all don't work > with WinZip. And what checksum did you get? --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailma

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread Kaz Kylheku
achates wrote: > Kaz Kylheku wrote: > > > If you want to do nice typesetting of code, you have to add markup > > which has to be stripped away if you actually want to run the code. > > Typesetting code is not a helpful activity outside of the publishing > industry. Be that as it may, code writing

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread achates
Duncan Booth wrote: >However the important thing is that a tab does >not map to a single indentation level in Python: it can map to any number >of indents, and unless I know the convention you are using to display the >tabs I cannot know how many indents are equivalent to a tabstop. Sorry but thi

Re: Unable to extract Python source code using Windows

2006-05-16 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > Scott , > I tried downloading for different archives, (different versions of > Python) I can't believe they are all garbled. But they all don't work > with WinZip. > OK, against my better judgment (you haven't shown your work so far): I get an md5 for python-2.4.3.tar.

Re: Time to bundle PythonWin

2006-05-16 Thread Dave Benjamin
Ten wrote: > Respectfully, that sounds like a reason for *you* to bundle pythonwin (and > python, to be honest :) ), not a reason for everyone else to have to download > an extra 40-50% of potentially superfluous cruft with their standard python > setup. Certainly, I could bundle Python and Pyt

Re: Time to bundle PythonWin

2006-05-16 Thread Dave Benjamin
[EMAIL PROTECTED] wrote: > The ctypes.com package is no longer part of ctypes. > It has been split by Thomas Heller into a separate package comtypes. > See: http://sourceforge.net/projects/comtypes/ > > Still in its childhood but as easy as com can get, I guess, way easier > and better than python

Re: round numbers in an array without importing Numeric or Math? - SOLVED, sort of

2006-05-16 Thread Scott David Daniels
Paul McGuire wrote: > ... or if you prefer the functional approach (using map)... > > roundToInt = lambda z : int(z+0.5) > Topamax = map( roundToInt, map( float, map(str, Topamax) ) ) Somehow, the list comprehension looks simpler and clearer to me: Topamax = [int(float(uni) + .5) for uni in

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

2006-05-16 Thread bob_jenkins
If you have the same number of entries as buckets, and you have a good hash function, then if you have n buckets your longest chain should have length around ln(n). The average length of a nonempty bucket would be somewhere around 1 1/2. -- http://mail.python.org/mailman/listinfo/python-list

Re: Large Dictionaries

2006-05-16 Thread Klaas
>22.2s 20m25s[3] 20m to insert 1m keys? You are doing something wrong. With bdb's it is crucial to insert keys in bytestring-sorted order. Also, be sure to give it a decent amount of cache. -Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: Time to bundle PythonWin

2006-05-16 Thread Dave Benjamin
Martin v. Löwis wrote: > Dave Benjamin wrote: >> Why is PythonWin (win32all) still a separate download from a third >> party? Is it legal, technical, or what? I think it's about time it be >> part of the standard distribution. > > Both legal and technical. The PythonWin author and maintainer (Mark

Re: taking qoutes in arguments

2006-05-16 Thread Ben Finney
"Lee Caine" <[EMAIL PROTECTED]> writes: > yea thanks alot for your help, gonna read up on 'Konsole' :) Be advised that 'Konsole' is not a command shell, it's a GUI program for running a command shell. On POSIX systems, find out what your current command shell is with this command: echo $SHE

Re: Unable to extract Python source code using Windows

2006-05-16 Thread John Machin
> http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tar.bz2 And the reason for posting that would be what? WinZip doesn't support bzip2 compression. http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tgz (a gzipped tar file) is what the OP would be better pointed at. FWIW, I have just downloa

Re: Option parser question - reading options from file as well as command line

2006-05-16 Thread Andrew Robert
Max Erickson wrote: > I don't know much about optparse, but since I was bored: > help(o.parse_args) > Help on method parse_args in module optparse: > > parse_args(self, args=None, values=None) method of > optparse.OptionParser instance > parse_args(args : [string] = sys.argv[1:], >

Re: arrays, even, roundup, odd round down ?

2006-05-16 Thread Ben Finney
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > So, I have using the following to grab numbers from MS Word. I > discovered that that there is a "special" rule being used for > rounding. > > If a ??.5 is even the number is to rounded down (20.5 = 20) > if a ??.5 is odd the number is to rounded up

Re: Using python for a CAD program

2006-05-16 Thread baalbek
> 1. Databases. I don't mean sql type database, but design databases, If you really want to revolutionize the CAD business, PLEASE don't base your CAD system on a file based system (ala Autocad). CAD systems available today (Autocad, Archicad, Architectural Desktop, etc) have one huge flaw: t

Re: calling upper() on a string, not working?

2006-05-16 Thread Scott David Daniels
John Salerno wrote: Others have shown you where the bug was. You might want to change encrypt_quote like this: XXX> def encrypt_quote(original): def encrypt_quote(original, casemap=True): XXX> original_letters = filter_letters(original) if casemap: original_letters = filter

Python and GLSL

2006-05-16 Thread Simon Bunker
Hi I was wondering if there is a Python module for running GLSL (OpenGL shader language) in OpenGL through Python. I think that Cg is available through PyCg - most likely using PyGame for the OpenGL. Has anyone done this with GLSL shaders? thanks Simon -- http://mail.python.org/mailman/list

Re: Unable to extract Python source code using Windows

2006-05-16 Thread John Machin
Elric02 wrote: """ I tried downloading for different archives, (different versions of Python) I can't believe they are all garbled. But they all don't work with WinZip. """ I can't believe that they're all garbled either. The likelihood of that is small. Further, the probablility that all-pervas

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread Aaron Gray
I was once a religous tabber until working on multiple source code sources, now I am a religious spacer :) My 2bits worth, Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python for a CAD program

2006-05-16 Thread Ben Finney
baalbek <[EMAIL PROTECTED]> writes: > If you really want to revolutionize the CAD business, PLEASE don't > base your CAD system on a file based system (ala Autocad). > > CAD systems available today (Autocad, Archicad, Architectural > Desktop, etc) have one huge flaw: they don't store data to a SQ

Re: calling upper() on a string, not working?

2006-05-16 Thread Paul Rubin
John Salerno <[EMAIL PROTECTED]> writes: > Now, I know the actual upper() function works, but I can't understand > if there's a problem with *when* it's being called, or what's being > done with it to get the second result above. You are translating "original" which still has lower case letters:

advice modifying re library to support more than 100 named captures.

2006-05-16 Thread Richard Meraz
Dear group members,We need to capture more than 99 named groups using python regular expressions.  From the docs and from this thread ( http://groups.google.com/group/comp.lang.python/browse_thread/thread/a39a91b4bf8e3df4/2ad4a7e01b60215d?lnk=st&q=python+regular+_expression_+group+limit&rnum=3#2ad4

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

2006-05-16 Thread skip
Roy> If you're getting long hash chains, you're either using a bad hash Roy> function, or your table isn't big enough. Sure. The original poster said something about 10 million keys I think. Unless the key distribution is amazingly fortuitous and the number of unique values is small, the

Re: Unable to extract Python source code using Windows

2006-05-16 Thread John Machin
Elric02 wrote: """ I'm currently trying to get access to the Python source code, however whenever I try to extract the files using the latest version of WinZip (version 10) I get the following error "error reading however after processing 0 entries """ I've managed to reproduce this behaviour: 1.

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

2006-05-16 Thread skip
bob> If you have the same number of entries as buckets, and you have a bob> good hash function, then if you have n buckets your longest chain bob> should have length around ln(n). The average length of a nonempty bob> bucket would be somewhere around 1 1/2. Yes, and it achieves t

Re: advice modifying re library to support more than 100 named captures.

2006-05-16 Thread Tim Peters
[Richard Meraz] > We need to capture more than 99 named groups using python regular > expressions. > ... > its clear why the language designers have decided on this limitation. For > our system, however, it is essential that we be able to capture an arbitrary > number of groups. > > Could anyone o

Is the only way to connect Python and Lua through a C interface?

2006-05-16 Thread Casey Hawthorne
Is the only way to connect Python and Lua through a C interface? -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   >