parsing string into dict

2010-09-01 Thread Tim Arnold
tandard library (I'm running 2.7). Here's what I've got, and it works. I wonder if there's a simpler way? thanks, --Tim Arnold The 'line' is like my example above but it comes in without the ending bracket, so I append one on the 6th lin

Re: Speed-up for loops

2010-09-02 Thread Tim Wintle
On Thu, 2010-09-02 at 12:02 +0200, Michael Kreim wrote: > Hi, > > I was comparing the speed of a simple loop program between Matlab and > Python. > Unfortunately my Python Code was much slower and I do not understand why. The main reason is that, under the hood, cpython does something like this

Re: Speed-up for loops

2010-09-02 Thread Tim Wintle
On Thu, 2010-09-02 at 16:13 +0200, Roland Koebler wrote: > Hi, > > > Are there any ways to speed up the for/xrange loop? > You can use psyco. Assuming you've got a 32-bit machine. -- http://mail.python.org/mailman/listinfo/python-list

Re: Speed-up for loops

2010-09-03 Thread Tim Wintle
On Fri, 2010-09-03 at 08:52 +0200, Ulrich Eckhardt wrote: > Tim Wintle wrote: > > [..] under the hood, cpython does something like this (in psudo-code) > > > > itterator = xrange(imax) > > while 1: > > next_attribute = itterator.next > > try: &g

Re: Database problems

2010-09-06 Thread Tim Harig
On 2010-09-06, Edward Grefenstette wrote: > I then threw caution to the winds and tried simply using cPickle's > dump in the hope of obtaining some data persistence, but it crashed > fairly early with a "IOError: [Errno 122] Disk quota exceeded". The error is telling you that you have attempted t

Re: Minimum and Maximum of a list containing floating point numbers

2010-09-06 Thread Tim Chase
On 09/06/10 19:37, ceycey wrote: I have a list like ['1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.1881', '1.7689', '1.7689', '3.4225', '7.7284', '10.24', '9.0601', '9.0601', '9.0601', '9.0601', '9.0601']. What I want to do is to find minimum and m

Re: The Samurai Principle

2010-09-07 Thread Tim Chase
On 09/07/10 12:52, Phlip wrote: try: return Model.objects.get(pk=42) except Model.DoesNotExist: return sentinel The flow of control is much clearer this way. It reminds me of Visual Basic. And no it's not "much clearer". Exceptions are for catastrophic errors that the caller should

Re: The Samurai Principle

2010-09-07 Thread Tim Chase
On 09/07/10 13:53, Phlip wrote: On Sep 7, 11:36 am, Tim Chase wrote: And no it's not "much clearer". Exceptions are for catastrophic errors that the caller should care not to handle. A "record not found" is not a catastrophe. Exceptions are not limited to ca

Re: weighted mean; weighted standard error of the mean (sem)

2010-09-09 Thread Tim Leslie
lk over there might be able to provide a solution which doesn't require a new patch. Cheers, Tim > > Thanks! > > None of them have this basic function. Has anyone written one? > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: weighted mean; weighted standard error of the mean (sem)

2010-09-09 Thread Tim Leslie
have code to >> contribute. In my experience the numpy devs are always happy to have >> new contributors, but be sure to discuss the problem first, as the >> folk over there might be able to provide a solution which doesn't >> require a new patch. > > > Thanks, Tim

Re: 3D cube navigation

2010-09-10 Thread Tim Chase
On 09/10/10 19:20, Steven D'Aprano wrote: On Sat, 11 Sep 2010 01:09:00 +0200, Krister Svanlund wrote: On Fri, Sep 10, 2010 at 9:10 PM, sahilsk wrote: hi, i need to make a 3d cube as a navigation menu.. each face having separate button .. or effect. In what environment, what toolkit, for wha

Re: play sound on Ubuntu 10.4. (pulse audio?)

2010-09-11 Thread Tim Harig
On 2010-09-11, News123 wrote: > What would be the way to detect how to play audio on a linux system > without knowing ufront whether the system uses pulse, ALSA or whatever? I would suggest libao: http://www.xiph.org/ao/ and it's python bindings: http://nixbit.com/cat/multimedia/a

Re: Very stupid question about a % symbol

2010-09-16 Thread Tim Chase
On 09/16/10 10:25, J wrote: OK, this is a very stupid question about a very simple topic, but print "Reported memory amounts are within %s%s tolerance" % (self.mem_tolerance,'%') Is there a better way to print a '%' in the string when also using formating? I've tried things like this: print "b

Re: This Is International Don’t-Squawk-Like-A -Parrot Day

2010-09-19 Thread Tim Chase
On 09/18/10 23:46, Lawrence D'Oliveiro wrote: Do your bit to help stamp out parrocy. Did you send this by mistake? It looks like a parroty-error. I think it's a bit off... -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-19 Thread Tim Harig
On 2010-09-20, Seebs wrote: > On 2010-09-20, Steven D'Aprano wrote: >> On Sun, 19 Sep 2010 06:16:49 -0700, Aahz wrote: >>> Please don't use tinyurl -- it's opaque and provides zero help to anyone >>> who might later want to look it up (and also no accessibility if tinyurl >>> ever goes down). At

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-19 Thread Tim Harig
On 2010-09-20, Seebs wrote: > On 2010-09-20, Tim Harig wrote: >> On 2010-09-20, Seebs wrote: >>> * No hint as to what site you'll be getting redirected to. > >> Tinyurl, in particular, allows you to preview the url if you choose to do >> so. Other URL sho

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Tim Harig
On 2010-09-20, Seebs wrote: > On 2010-09-20, Tim Harig wrote: >> 1. Don't bother to manually paste when you can use something like urlview >> to lauch directly. > > I don't know that this would actually be better than what I currently do, > which is gra

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Tim Harig
On 2010-09-20, Steven D'Aprano wrote: > On Mon, 20 Sep 2010 05:46:38 +0000, Tim Harig wrote: > >>> I'm not particularly convinced that these are *significant* complaints >>> about URL-shorteners. But I will say, of the last couple hundred links >>> I&#x

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Tim Harig
On 2010-09-20, Tim Harig wrote: > On 2010-09-20, Seebs wrote: >> On 2010-09-20, Tim Harig wrote: >>> If you want this behavior by default, you can easily wrap urlview >>> to automatically add the prefix. >> >> True, but since my news reading is not

Re: catching WM_TIMER message

2010-09-20 Thread Tim Golden
On 20/09/2010 16:15, Greg Miller wrote: I'm trying to get the following code converted to Python...and am stuck if(GetMessage(&msg.NULL,NULL,NULL)) { if(msg.message == WM_TIMER) { TranslateMEssage(&msg); DispatchMessage(&msg); } } I think GetMessage i

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Tim Harig
On 2010-09-20, Brian Victor wrote: > Tim Harig wrote: >> Posting two URLs rather defeats the purpose of using a URL shortening >> service in the first place; but, if that is what you feel is effective, >> then by all means, do so. You are the master of your posts and you

Re: catching WM_TIMER message

2010-09-20 Thread Tim Golden
On 20/09/2010 5:41 PM, Greg Miller wrote: Thank you for the assist! Quick question though, using the first example is there any need to register for WM_TIMER, ( instead of registering for WM_HOTKEY ), or is extracting the "home grown Windows message loop" enough and just run with that? In shor

Re: Down with tinyurl!

2010-09-20 Thread Tim Chase
On 09/20/10 20:12, John Bokma wrote: Steven D'Aprano writes: On Mon, 20 Sep 2010 17:25:09 +0000, Tim Harig wrote: Usernet users also have the right to use the X-No-Archive header field. They do? Is that right enshrined by law somewhere? Can I go to jail for human rights abuses if I ar

Re: Python Macros's Not the Power in OOo they should be ?

2010-09-22 Thread Tim Harig
On 2010-09-23, Lawrence D'Oliveiro wrote: > In message ><4d76a2ad-bf85-472e-8c63-ef16f320a...@t11g2000vbc.googlegroups.com>, flebber > wrote: > >> Has anyone had much success with python macro's. Or developing powerful >> macro's in an language? > > I did an application for my own use recently, i

Re: feature request: string.contains('...')

2010-09-24 Thread Tim Chase
On 09/24/10 13:01, Ethan Furman wrote: John Posner wrote: Another "missing feature" candidate: sublist >>> 'bc' in 'abcde' True >>> list('bc') in list('abcde') False I'm not aware of any idioms, but how about a simple function? def listinlist(list1, list2): "checks if

Re: Errors with PyPdf

2010-09-26 Thread Tim Roberts
ent = "C:/Components-of-Dot-NET.pdf" or content = "C:/Components-of-Dot-NET.pdf" -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Python3: API Documentation generator

2010-09-26 Thread Tim Diels
Hi all I've just switched to python3 and it turns out my current API documentation generator (epydoc) no longer works. I am looking for a tool that reads the docstrings of all classes, ... in my project and turns it into HTML documentation. Thanks for your time limyreth -- http://mail.pyth

Re: Python3: API Documentation generator

2010-09-27 Thread Tim Diels
On 27/09/2010 09:02, Chris Rebert wrote: On Sun, Sep 26, 2010 at 11:56 PM, Tim Diels wrote: Hi all I've just switched to python3 and it turns out my current API documentation generator (epydoc) no longer works. I am looking for a tool that reads the docstrings of all classes, ...

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Tim Bradshaw
On 2010-09-28 10:55:19 +0100, Malcolm McLean said: I'd like to design a language like this. If you add a quantity in inches to a quantity in centimetres you get a quantity in (say) metres. If you multiply them together you get an area, if you divide them you get a dimeionless scalar. If you divi

Re: About __class__ of an int literal

2010-09-28 Thread Tim Golden
On 28/09/2010 10:27, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the python issue tracker but

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Tim Bradshaw
are never fine, because they are equivalent to summing things with different dimensions, which is obvious if you think about the Taylor expansion of a transcendental function). --tim -- http://mail.python.org/mailman/listinfo/python-list

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Tim Rowe
u lose compiler checks. That's the right balance for a lot of applications, but not for all. If it's really critical that the program be correct then you'll want a bondage-and-discipline language that does masses of check, you might even do separate static analysis, and you'll *st

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Tim Bradshaw
On 2010-09-30 13:36:17 +0100, Nick Keighley said: there are some application domains where neither option would be viewed as a satisfactory error handling strategy. Fly-by-wire, petro- chemicals, nuclear power generation. Hell you'd expect better than this from your phone! People always give t

Re: Having problem with subclass

2010-09-30 Thread Tim Chase
On 09/30/10 20:54, tekion wrote: All, I have file name A.py with a class name Aclass. I have a file name B.py with sub class of Aclass, like import A class Bclass(Aclass) ...rest of code When I test it, calling B.py, I am getting: class Bclas(Aclass): NameError: name 'Aclass' is not defined Whe

Re: SQLite is quite SQL compliant

2010-10-02 Thread Tim Chase
On 10/02/10 17:06, Seebs wrote: On 2010-10-02, Ravi wrote: The documentation of the sqlite module at http://docs.python.org/library/sqlite3.html says: "...allows accessing the database using a nonstandard variant of the SQL..." I would agree that the word "nonstandard" seems to be a little

Re: IMAP support

2010-10-03 Thread Tim Roberts
pakalk wrote: > >Can anyone help me find GOOD IMAP library for python? Imaplib is.. >ekhm... nevermind... Is there any good library? What do you expect it to do? Imaplib is designed to help you access IMAP stores, and it does that well enough. But it's not a mail reader. --

Re: how to get partition information of a hard disk with python

2010-10-04 Thread Tim Chase
On 10/04/10 09:33, Anssi Saari wrote: But can you really get all that for free, in python? in other words, is there a python API for all that? The stuff in /proc/partitions seems rather limited to me, although I have only vanilla partitions on my computers. A similar question regarding reading

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread Tim Chase
On 10/05/10 15:06, [email protected] wrote: On Oct 5, 3:38 pm, MRAB wrote: On 05/10/2010 20:03, [email protected] wrote: So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you the context, I am searching fo

Re: suggestions please "what should i watch for/guard against' in a file upload situation?"

2010-10-06 Thread Tim Chase
On 10/06/10 12:14, Seebs wrote: not sure what else i could do to guard against anything bad happening. maybe the file name itself could cause greif? Obvious things: * File name causes files to get created outside some particular upload directory ("../foo") * File name has spaces * Crazy st

no .pyc

2010-10-07 Thread Tim Hanson
I feel a little silly. I am learning Python by reading _Learning_Python_ by Mark Lutz. I made it all the way to "Hello World" before my first question. :-) The program isn't too complicated. print "Hello World" print 2**100 I saved it to a directory for which I have rw permissions that I move

Re: Many newbie questions regarding python

2010-10-07 Thread Tim Harig
On 2010-10-07, Rogério Brito wrote: > 1 - The first issue that I am having is that I don't seem to be able to, say, > use something that would be common for people writing programs in C: defining > a > one-dimensional vector and only initializing it when needed. > > For instance, in C, I would wr

Re: del() function - cannot find documentation

2010-10-07 Thread Tim Roberts
imary reason why parentheses should never be used with "del" and "return", as we so commonly see. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Many newbie questions regarding python

2010-10-08 Thread Tim Harig
On 2010-10-08, BartC wrote: > "Rogério Brito" wrote in message > news:[email protected]... >> If possible, I would like to simply declare the list and fill it latter in >> my >> program, as lazily as possible (this happens notoriously when one is using >> a >> technique of program

Re: Opening a webpage in the background via webbrowser.open()

2010-10-08 Thread Tim Chase
On 10/08/10 15:11, Vlastimil Brom wrote: webbrowser.open(url[, new=0[, autoraise=True]]) however, the sidenote in the docs also seems to apply: "If autoraise is True, the window is raised if possible (note that under many window managers this will occur regardless of the setting of this variable)

Re: Control webbrowser from Python script

2010-10-09 Thread Tim Harig
On 2010-10-09, Johny wrote: > Is it possible to control any webbrowser from Python ? For example to > issue http POST and GET command The most reliable way to interact with a webserver is through the urllib and httplib modules. This is effective for 99% of cases. I do understand that some site

Re: Reading Outlook .msg file using Python

2010-10-11 Thread Tim Golden
On 10/10/2010 22:51, John Henry wrote: I have a need to read .msg files exported from Outlook. Google search came out with a few very old posts about the topic but nothing really useful. The email module in Python is no help - everything comes back blank and it can't even see if there are attac

Re: Reading Outlook .msg file using Python

2010-10-11 Thread Tim Golden
On 11/10/2010 4:39 PM, John Henry wrote: I am trying your code but when it get to the line: mapi.MAPIInitialize ((mapi.MAPI_INIT_VERSION, 0)) I got the error message: Either there is no default mail client or the current mail client cannot fulfill the messsage requrest. Please run Micr

Re: "Strong typing vs. strong testing"

2010-10-12 Thread Tim Bradshaw
On 2010-10-12 11:16:09 +0100, Ben said: Angles aren't "true" units, as they are ratios of two lengths. They are more of a "pseudo" unit. That's right, in fact angles are pure numbers. In general any function which raises its argument to more than one power (for instance anything with a non-

Re: Reading Outlook .msg file using Python

2010-10-12 Thread Tim Golden
On 12/10/2010 4:59 PM, John Henry wrote: According to: http://support.microsoft.com/kb/813745 I need to reset my Outlook registry keys. Unfortunately, I don't have my Office Install CD with me. This would have to wait. Thanks for the information; I'm keen to see if you're able to use the so

Re: "Strong typing vs. strong testing"

2010-10-12 Thread Tim Bradshaw
On 2010-10-12 20:46:26 +0100, BartC said: You can't do all that if angles are just numbers. I think that the discussion of percentages is relevant here: angles //are// just numbers, but you're choosing a particular way of displaying them (or reading them). 100% //is// 1, and 360° //is// 2π.

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Tim Bradshaw
On 2010-10-13 02:00:46 +0100, BartC said: But what exactly *is* this number? Is it 0.25, 1.57 or 90? Its pi/2, the same way 90% is 9/10. I can also write 12 inches, 1 foot, 1/3 yards, 1/5280 miles, 304.8 mm and so on. They are all the same number, roughly 1/13100 of the polar circumf

Re: subprocess.check_call() fails ... but only on my production machine

2010-10-13 Thread Tim Golden
On 12/10/2010 14:31, Chris Curvey wrote: I've got a python program running on windows that executes a command- line script. The command being executed is: print cmd "C:\Program Files\ImageMagick-6.6.1-Q16\convert.exe" -density 72x72 "c: \temp\choicepoint 2010-01 Stmt_p1.pdf" -quiet -region (6

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Tim Bradshaw
On 2010-10-13 13:21:29 +0100, BartC said: My money would have been on 0.25, based on using 1.0 for a 360° circular angle. It seems far more attractive than using the arbitrary-looking 6.28... It may look arbitrary, but it isn't: it's about as non-arbitrary as it is possible to be. -- http:

Re: "Strong typing vs. strong testing" [OT]

2010-10-13 Thread Tim Bradshaw
On 2010-10-13 14:20:30 +0100, Steven D'Aprano said: ncorrect -- it's not necessarily so that the ratio of the circumference to the radius of a circle is always the same number. It could have turned out that different circles had different ratios. But pi is much more basic than that, I think.

Re: Using csv.DictReader with \r\n in the middle of fields

2010-10-13 Thread Tim Chase
On 10/13/10 11:33, Dennis Lee Bieber wrote: While I've not tested it, my understanding of the documentation indicates that the reader /can/ handle multi-line fields IF QUOTED... (you may still have to strip the terminator out of the description data after it has been loaded). Tha

Whining about "struct"

2010-10-13 Thread Tim Roberts
dule moved from Python code to C code, and that helpful help string was removed. Is that still gone in Python 3.1? What are the chances of reinstating that helpful chart? -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help needed - To get path of a directory

2010-10-14 Thread Tim Golden
On 13/10/10 15:26, Bishwarup Banerjee wrote: I want to get the absolute path of the Directory I pass explicitly. Like functionName("\abcd"). On 13/10/2010 05:44, Kingsley Turner wrote: One way to achieve this is to fetch a recursive directory list for all drives, and then search for your direc

Re: Whining about "struct"

2010-10-14 Thread Tim Golden
On 14/10/2010 05:30, Tim Roberts wrote: I have a bad memory. I admit it. Because of that, the Python "help" system is invaluable to me. Up through Python 2.5, I could get a quick reference to the format specifiers for the struct module via import struct; help(struct) I used

Re: Boolean value of generators

2010-10-14 Thread Tim Chase
On 10/14/10 12:53, Paul Rubin wrote: Carl Banks writes: In general, the only way to test if a generator is empty is to try to consume an item. (It's possible to write an iterator that consumes an item and caches it to be returned on the next next(), and whose boolean status indicates if there'

Re: Boolean value of generators

2010-10-14 Thread Tim Chase
On 10/14/10 20:48, Steven D'Aprano wrote: (3) Generators with side-effects. I know, I know, if you write functions with side-effects, you're in a state of sin already, but there's no need for Python to make it worse. (4) Expensive generators. The beauty of generators is that they produce values

Re: imaplib AND date format

2010-10-16 Thread Tim Roberts
A compliant date header looks like this: Date: 20 June 2010 12:34:56 -0700 -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading Outlook .msg file using Python

2010-10-17 Thread Tim Golden
On 17/10/2010 6:39 AM, John Henry wrote: On Oct 12, 10:31 am, Tim Golden wrote: On 12/10/2010 4:59 PM, John Henry wrote: According to: http://support.microsoft.com/kb/813745 I need to reset my Outlook registry keys. Unfortunately, I don't have my Office Install CD with me. This

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-17 Thread Tim Chase
On 10/17/10 19:04, Rhodri James wrote: import string return set("".join(L))<= set(string.printable) I've no idea whether this is faster or slower than any of your suggestions. For set("".join(L)) to return, it has to scan the entire input list/string. Imagine s = UNPRINTABLE_CHAR

Re: ANN: stats 0.1a calculator statistics for Python

2010-10-18 Thread Tim Wintle
On Sun, 2010-10-17 at 17:10 +, Steven D'Aprano wrote: > I am pleased to announce the first public release of stats for Python. > > http://pypi.python.org/pypi/stats Quick comment on your sum() function: http://docs.python.org/library/math.html#math.fsum (in 2.6 and above) should do the sa

Re: Reading Outlook .msg file using Python

2010-10-18 Thread Tim Golden
On 17/10/2010 20:25, John Henry wrote: Not knowing anything about MAPI, I tried a number of the MAPI flags, the only one that works appears to be PR_SUBJECT. PR_CLIENT_SUBMIT_TIME, PR_CREATION_TIME and so forth doesn't work. I'll try to fish out some of the code we use, but for most of the fiel

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-18 Thread Tim Chase
On 10/18/10 09:28, Grant Edwards wrote: There's no easy way to even define what "printable" means. Ask three different people, and you'll get at least four different answers answers. I don't have a printer...that makes *all* characters unprintable, right? Now I can convert the algorithm to O

Re: Windows: getting notification about power state changes

2010-10-19 Thread Tim Golden
On 19/10/2010 10:06, Gelonida wrote: I'd like to be notified about certain events and call certain python functions depending on the event. call a function: - before (or after) the screen saver kicks in - before (or after) the monitor is switched off - before (or after) the hard disk is switched

Re: Reading Outlook .msg file using Python

2010-10-20 Thread Tim Golden
On 19/10/2010 22:48, John Henry wrote: Looks like this flag is valid only if you are getting messages directly from Outlook. When reading the msg file, the flag is invalid. Same issue when accessing attachments. In addition, the MAPITable method does not seem to work at all when trying to get

Re: Unix-head needs to Windows-ize his Python script

2010-10-21 Thread Tim Golden
On 20/10/2010 18:38, gb345 wrote: I have a handy Python script, which takes a few command-line arguments, and accepts a few options. I developed it on Unix, with very much of a Unix-mindset. Some Windows-using colleagues have asked me to make the script "easy to use under Windows 7". I.e.: no

Re: Reading Outlook .msg file using Python

2010-10-21 Thread Tim Golden
On 21/10/2010 09:34, Jon Clements wrote: Only just noticed this thread, and had something similar. I took the following approach:- (I'm thinking this might be relevant as you mentioned checking whether your client's Outlook could export .EML directly, which indicates (to me at least) that you ha

Re: Ideas on how to parse a dynamically generated html pages

2010-10-21 Thread Tim Harig
On 2010-10-22, chad wrote: > Let's say there is a site that uses javascript to generate menus. More > or less what happens is when a person clicks on url, a pop up menu > appears asking the users for some data. How would I go about > automating this? Just curious because the web spider doesn't act

Re: Unix-head needs to Windows-ize his Python script (II)

2010-10-22 Thread Tim Golden
On 22/10/2010 15:25, gb345 wrote: 3. Both versions of the app work fine on Windows 7, as long as I do the following: a. run CMD b. cd to where the GUI script and my original script live c. execute either C:\Python27\python myapp_tk.py or C:\Python27\python myapp_wx.p

Re: pythagorean triples exercise

2010-10-23 Thread Tim Roberts
about this right. The simplest (but not most efficient) method is brute force, using three loops, one each for a, b, and c. You can compute the largest "c" you will need by computing the square root of a*a+b*b. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: A good decorator library

2010-10-23 Thread Tim Roberts
through the unjudicious use of decorators. It is not good programming to use a language freature just because it is there. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3: API Documentation generator

2010-10-24 Thread Tim Diels
On 27/09/2010 20:44, Ken Watford wrote: On Mon, Sep 27, 2010 at 1:15 PM, Tim Diels wrote: On 27/09/2010 09:02, Chris Rebert wrote: On Sun, Sep 26, 2010 at 11:56 PM, Tim Dielswrote: Hi all I've just switched to python3 and it turns out my current API documentation generator (epydo

Re: downcasting problem

2010-10-25 Thread Tim Chase
While a dirty hack for which I'd tend to smack anybody who used it...you *can* assign to instance.__class__ >>> class A: ... def __init__(self, name): ... self.name = name ... def __str__(self): return self.name ... >>> class B(A): ... def foo(self): print "I'm B: %r" % s

Re: [OFF] sed equivalent of something easy in python

2010-10-25 Thread Tim Chase
On 10/25/2010 11:25 AM, Daniel Fetchinson wrote: using python. The pattern is that the first line is deleted, then 2 lines are kept, 3 lines are deleted, 2 lines are kept, 3 lines are deleted, etc, etc. If you have GNU sed, you can use sed -n '2~5{N;p}' which makes use of the GNU "~" extens

Re: downcasting problem

2010-10-25 Thread Tim Chase
On 10/25/2010 12:56 PM, John Nagle wrote: On 10/25/2010 7:38 AM, Tim Chase wrote: While a dirty hack for which I'd tend to smack anybody who used it...you *can* assign to instance.__class__ That's an implementation detail of CPython. May not work in IronPython, Unladen Swallow

Re: sed equivalent of something easy in python

2010-10-27 Thread Tim Chase
On 10/27/10 08:27, Martin Gregorie wrote: (2) made me take care of 2 files instead of 1 from now on. Not necessarily: $ cat heredoc.sh #!/usr/bin/env bash python<< 'EOF' print "hello world" def foo(): print "foo()" foo() EOF $ Or even better: $ cat hello #!/usr/bin/python print "hello

Re: [OFF] sed equivalent of something easy in python

2010-10-27 Thread Tim Chase
On 10/27/10 09:39, Jussi Piitulainen wrote: So, is there some simple expression in Python for this? Just asking out of curiosity when nothing comes to mind, not implying that there should be or that Python should be changed in any way. To expand, below is the best I can think of in Python 3 and

Re: easyGUI and py2exe

2010-10-27 Thread Tim Roberts
version number string directly, instead of using __doc__.split. Two, you can reduce your optimization level from 2 to 1. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Discussion board software?

2010-10-28 Thread Tim Harig
On 2010-10-29, Gnarlodious wrote: > Is there such a thing as website discussion board software written in > Python? Yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: Discussion board software?

2010-10-28 Thread Tim Harig
On 2010-10-29, Gnarlodious wrote: > On Oct 28, 7:20 pm, Tim Harig wrote: >> On 2010-10-29, Gnarlodious wrote: >> >> > Is there such a thing as website discussion board software written in >> > Python? >> >> Yes. > > OK I'll play, what and

Re: curses and processing terminal escape characters

2010-10-29 Thread Tim Harig
On 2010-10-29, mix wrote: > Hi, > > I'm wondering if there is a way in python to process a string > containing terminal escape characters. Example: Please consider the > following string: Python could easily process the escape codes for any given terminal; but, in general, you would want somethin

Re: curses and processing terminal escape characters

2010-10-30 Thread Tim Harig
On 2010-10-30, Lawrence D'Oliveiro wrote: > In message , Tim Harig wrote: > >> Python could easily process the escape codes for any given terminal; but, >> in general, you would want something that works for more then a single >> terminal type. > > Does anyo

Re: text file reformatting

2010-10-31 Thread Tim Chase
PRJ01001 4 00100END PRJ01002 3 00110END I would like to pick only some columns to a new file and put them to a certain places (to match previous data) - definition file (def.csv) could be something like this: VARIABLEFIELDSTARTS FIELD SIZE NEW PLACE IN NEW DATA FILE ProjID ;

Re: text file reformatting

2010-10-31 Thread Tim Chase
On 10/31/10 14:52, Braden Faulkner wrote: import csv f = file('def.csv', 'rb') f.next() # discard the header row r = csv.reader(f, delimiter=';') fields = [ (varname, slice(int(start), int(start)+int(size)), width) for varname, start, size, width in r ]

Re: [Beginer Question] I heard about python needing some sort of_VariableName_ boiler plate?

2010-11-01 Thread Tim Chase
On 10/31/10 23:51, Ben Finney wrote: Sorry, to clarify I heard that when you declare a variable in python you have to use some sort of standard boiler plate _variable_ however this has not been my experience using IDLE so is this even true? I don't know what “some sort of boiler plate _variable

Re: Python documentation too difficult for beginners

2010-11-02 Thread Tim Golden
On 02/11/2010 11:23, jk wrote: This (http://epydoc.sourceforge.net/stdlib/) is what I'm talking about. Why aren't the official docs like this, and why has it taken me 2 days of searching? All this needs is a search engine behind it and it'd be perfect. I'm glad you find the epydoc format usefu

Re: Python documentation too difficult for beginners

2010-11-02 Thread Tim Wintle
On Tue, 2010-11-02 at 04:23 -0700, jk wrote: > This (http://epydoc.sourceforge.net/stdlib/) is what I'm talking > about. Aaaarrr > Why aren't the official docs like this, Because not everyone likes documentation like that. Personally I far prefer the existing documentation to the JavaDoc-s

Re: Python documentation too difficult for beginners

2010-11-02 Thread Tim Harig
On 2010-11-02, jk wrote: > As for the 9 paragraphs statement, there's a usability book that > applies here - it's called "Don't make me think". I shouldn't have to Anything that promotes a lack of thinking sends up red flags in my head. We want to recruit smart people who think, not idiots. > go

Re: Compare source code

2010-11-02 Thread Tim Harig
On 2010-11-02, Seebs wrote: > On 2010-11-02, Steven D'Aprano wrote: >> If your >> editor changes spaces to tabs, or visa versa, without being told to do so >> (either by an explicit command or an obvious setting), then your editor >> is broken. > > Yes. But that's the thing -- I *want* that b

Re: Man pages and info pages (was: Python documentation too difficult for beginners)

2010-11-02 Thread Tim Harig
On 2010-11-02, Teemu Likonen wrote: > * 2010-11-02 18:43 (UTC), Tim Harig wrote: > >> The manual format contains all of the information on one page that can >> be easily searched whereas the info pages are split into sections that >> must be viewed individually. With the m

Re: Man pages and info pages (was: Python documentation too difficult for beginners)

2010-11-02 Thread Tim Harig
On 2010-11-02, Tim Harig wrote: > On 2010-11-02, Teemu Likonen wrote: >> With the text terminal info browser called "info" as well as Emacs' info >> browser you can use command "s" (stands for "search"). It prompts for a >> regexp patter

Re: Compare source code

2010-11-02 Thread Tim Harig
On 2010-11-02, D'Arcy J.M. Cain wrote: > "Redundant" is right. However, there is a use for such comments: > > if foo: > bar > else: > baz > if snafu: > cookie > #endif snafu > quux > #endif foo Actually, I have found similar markers

Re: Compare source code

2010-11-02 Thread Tim Harig
On 2010-11-03, D'Arcy J.M. Cain wrote: > On Wed, 3 Nov 2010 00:41:46 + (UTC) > Tim Harig wrote: >> On 2010-11-02, D'Arcy J.M. Cain wrote: >> Actually, I have found similar markers to be useful everywhere. I don't >> like the way my editor tries to f

Re: Compare source code

2010-11-02 Thread Tim Harig
On 2010-11-03, Tim Harig wrote: > On 2010-11-03, D'Arcy J.M. Cain wrote: >> On Wed, 3 Nov 2010 00:41:46 +0000 (UTC) >> Tim Harig wrote: >> Identifying the end of the block has some value. And the braces just >> make the code noisy. > > With good synt

Re: Man pages and info pages

2010-11-02 Thread Tim Harig
On 2010-11-03, Teemu Likonen wrote: > * 2010-11-02 19:36 (UTC), Tim Harig wrote: >> I thoroughly agree. The default info viewers are quite possibly the >> most counterintuitive programs I have ever encountered. I never did >> bother to learn how to use them. I inste

Re: Mail Merge from python data

2010-11-02 Thread Tim Harig
This page didn't make it to through to my nntp server so I appologize if I miss something that was covered. On 2010-11-03, Dennis Lee Bieber wrote: > On Tue, 2 Nov 2010 20:32:13 +1000, Dylan Evans > declaimed the following in gmane.comp.python.general: > >> I'm setting up a database for an organ

Re: Py3: decode subprocess output

2010-11-03 Thread Tim Harig
On 2010-11-03, Gnarlodious wrote: > Under Python 3, subprocess.check_output returns a bytestring that > doesn't parse. Since the CLI program (written in the 1990's) will > never send Unicode, is there a way to downconvert the bytestring into > type str so as to emulate Py2.6 behavior? str() will

<    67   68   69   70   71   72   73   74   75   76   >