RE: Timeout at command prompt

2006-01-12 Thread Tim Golden
[Thierry Lam] [to do with a Win32 equivalent to the SIGALRM interruption of a raw_input] | Is there a windows equivalent for that solution? Nothing so straightforward. Depends how hard you want to try. A couple of past threads on pretty much the exact same issue offer no equivalent solution.

Re: atexit + threads = bug?

2006-01-12 Thread Tim Peters
[David Rushby] > Consider the following program (underscores are used to force > indentation): > > import atexit, threading, time > > def atExitFunc(): > print 'atExitFunc called.' > > atexit.register(atExitFunc) > > class T(threading.Thread): >

Re: atexit + threads = bug?

2006-01-12 Thread Tim Peters
[David Rushby] > ... > I understand your explanation and can live with the consequences, but > the atexit docs sure don't prepare the reader for this. In fact, they don't mention threading.py at all. > They say, "Functions thus registered are automatically executed upon > normal interpreter termi

Re: Why is there no post-pre increment operator in python

2006-01-12 Thread Tim Peters
[EMAIL PROTECTED] > Anyone has any idea on why is there no post/pre increment operators in > python ? Maybe because Python doesn't aim at being a cryptic portable assembly language? That's my guess ;-) > Although the statement: > ++j > works but does nothing That depends on the type of j, and h

Converting a string to an array?

2006-01-13 Thread Tim Chase
his lacks the beauty of most python code, and clearly feels like there's somethign I'm missing. Is there some method or function I've overlooked that would convert a string to an array with less song-and-dance? Thanks, -tim -- http://mail.python.org/mailman/listinfo/python-list

gracefully handling broken pipes (was Re: Converting a string to an array?)

2006-01-13 Thread Tim Chase
IOError: [Errno 32] Broken pipe At the moment, I'm just wrapping the lot in a try/except block, and ignoring the error. Is there a better way to deal with this gracefully? If some more serious IO error occurred, it would be nice to not throw that baby out with the bath-water. Is the

Re: New Python.org website ?

2006-01-13 Thread Tim Chase
, the "P" in the initial "Python" and the "R" in Rossum) The problem persists into other pages as well (such as the documentatin page, etc). Functionality-wise, it works like a charm and other than the intrusion of those nav-bar bits, it looks good too. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python.org website ?

2006-01-13 Thread Tim Chase
ly alters the behaviors of sites when the webdev assumes that everybody runs with JS), but had no variance. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a string to an array?

2006-01-13 Thread Tim Peters
le'? 'permuted' is the obvious answer, but that would leave us open to more charges of hifalutin elitism, so the user-friendly and slightly risque 'jiggled' it is. sorry-it-can't-be-'shuffled'-we-ran-out-of-'f's-ly y'rs - tim -- http://mail.python.org/mailman/listinfo/python-list

Re: python create mail

2006-01-14 Thread Tim Roberts
i.ac.il', 25) reply: '220 mail3.cc.huji.ac.il ESMTP Postfix\r\n' reply: retcode (220); Msg: mail3.cc.huji.ac.il ESMTP Postfix connect: mail3.cc.huji.ac.il ESMTP Postfix (220, 'mail3.cc.huji.ac.il ESMTP Postfix') >>> ^Z C:\Dev> It's possible they simply had a temporary outage, assuming that you aren't sending this from some known spammer IP address. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: XML Writer in wxPython

2006-01-14 Thread Tim Roberts
"Marco Meoni" <[EMAIL PROTECTED]> wrote: > >Have you ever write an XML Writer in wxPython? A Writer that from a GUI >can compose XML Files. XML is usually pretty easy to write by hand, just using print statements. Do you alreday have a tree of objects you want to write?

Re: New Python.org website ?

2006-01-14 Thread Tim Parkin
Fuzzyman wrote: >Tim Parkin wrote: >[snip..] > > >>Hi Fuzzyman, >> >>Thanks for the feedback and volunteering to contribue... The list of >>already built sections is not really up to date but I have added a few >>tickets to the trac on some se

Re: Just want to walk a single directory

2006-01-14 Thread Tim Peters
[EMAIL PROTECTED] > I have a super-simple need to just walk the files in a single directory. > > I thought this would do it, but "permanentFilelist" ends up containing > all folders in all subdirectories. All folders everywhere, or all file (not directory) names in the top two levels? It looks li

Re: Listing partitions (on win32)

2006-01-15 Thread Tim Golden
Claude Henchoz wrote: > Is there any way of listing partitions on a (win32) computer without > using WMI? Not that this answers your question, but why _don't_ you want to use WMI? TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get Windows system information?

2006-01-15 Thread Tim Golden
someone's done before. And if someone's done it in VBS (or Perl, or whatever), we can do it in Python. HTH Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Listing partitions (on win32)

2006-01-15 Thread Tim Golden
[EMAIL PROTECTED] wrote: > Tim Golden wrote: > > Claude Henchoz wrote: > > > > > Is there any way of listing partitions on a (win32) computer without > > > using WMI? > > > > Not that this answers your question, but why _don't_ you > > want

Why/Why not WMI [was: Listing partitions (on win32)]

2006-01-15 Thread Tim Golden
[EMAIL PROTECTED] wrote: > Tim Golden wrote: >> [EMAIL PROTECTED] wrote: >>> Tim Golden wrote: >>>> Claude Henchoz wrote: >>>> >>>>> Is there any way of listing partitions on a (win32) computer without >>>>> using WMI? >&g

Re: Listing partitions (on win32)

2006-01-15 Thread Tim Golden
Claude Henchoz wrote: > Hi > > Is there any way of listing partitions on a (win32) computer without > using WMI? It looks as though XP has a command-line utility called diskpart.exe which should be able to do this kind of thing. I've no experience with it myself, but assuming that it outputs info

Re: New Python.org website ?

2006-01-15 Thread Tim Parkin
source was iso8859-1 and it got reprocessed as utf8. And thanks for the feedback.. it all gets listened to. (btw, we're also adding supplementary style sheets for different purposes - one for a larger text size for instance - a beta of the large text style on is available on the beta site at the moment, it still needs a couple of tweaks with the menu) Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: timeout a process

2006-01-15 Thread Tim Golden
) # # Wait for it to finish, but give up after n secs # result = win32event.WaitForSingleObject ( hProcess, 1000 * TIMEOUT_SECS ) # # If it's timed out, kill it # if result == win32event.WAIT_TIMEOUT: win32process.TerminateProcess (hProcess, -1) print "Killed off" else: print "Died naturally" HTH Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python.org website ?

2006-01-15 Thread Tim Parkin
[EMAIL PROTECTED] wrote: > JW wrote: > >>On Fri, 13 Jan 2006 11:00:05 -0600, Tim Chase wrote: >> >> >>>http://tim.thechases.com/pythonbeta/pythonbeta.html >>> >> >>Very strange. With FF 1.0.7, I can just get the buttons to violate the

Re: Just want to walk a single directory

2006-01-15 Thread Tim Roberts
ply by using os.listdir and os.path.isfile? In my brain, os.walk is the solution to RECURSIVE search needs. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: More than you ever wanted to know about objects [was: Is everything a refrence or isn't it]

2006-01-15 Thread Tim Peters
[Alex Martelli] ... >> In mathematics, 1 is not "the same" as 1.0 -- there exists a natural >> morphism of integers into reals that _maps_ 1 to 1.0, but they're still >> NOT "the same" thing. And similarly for the real-vs-complex case. [Xavier Morel] > I disagree here, 1 and 1.0 are the same math

Re: New Python.org website ?

2006-01-16 Thread Tim Parkin
JW wrote: > On Sun, 15 Jan 2006 22:19:37 +0000, Tim Parkin wrote: > > >>http://pyyaml.org/downloads/masterhtml/ >> >>Feedback appreciated ... Many thanks > > > Again, with FF 1.0.7 (on FC4 Linux BTW), the left column no longer > violates the right. Howe

Re: New Python.org website ?

2006-01-16 Thread Tim Chase
7;ve got a section (id="body-main") with a fixed margin-left property of 15em (coming from the styles/styles.css file). Thus, depending on your font-size, the body-main element will be further left or right. Hope this helps you figure out what's goin' on. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python.org website ?

2006-01-16 Thread Tim Parkin
Tim Chase wrote: >> The nav styles have crept back in sync with the rest of the >> site.. ;-) can you check again and tell me if it looks ok (and >> if not get me another screenie?) > > > Sorry it took so long to get back to you. It looked fine from home, but > t

RE: Space left on device

2006-01-16 Thread Tim Golden
[sir_alex] | Is there any function to see how much space is left on a device (such | as a usb key)? I'm trying to fill in an mp3 reader in a little script, | and this information could be very useful! Thanks! If you're talking Win32, have a look at win32file.GetDiskFreeSpace from the pywin32 exte

Re: OT: excellent book on information theory

2006-01-16 Thread Tim Peters
[Paul Rubin] ... >> David J.C. MacKay >> Information Theory, Inference, and Learning Algorithms >> >> Full text online: >> http://www.inference.phy.cam.ac.uk/mackay/itila/ ... >> The printed version is somewhat expensive, but according to the >> following analysis it's a better barg

Re: Decimal ROUND_HALF_EVEN Default

2006-01-16 Thread Tim Peters
[3c273] > I'm just curious as to why the default rounding in the decimal module is > ROUND_HALF_EVEN instead of ROUND_HALF_UP. Because it's the best (numerically "fairest") rounding method for most people most of the time. > All of the decimal arithmetic I do is rounded half up and I can't think

Re: Decimal ROUND_HALF_EVEN Default

2006-01-17 Thread Tim Peters
[LordLaraby] > If 'bankers rounding' is HALF_ROUND_EVEN, what is HALF_ROUND_UP? Not banker's rounding ;-). Same answer if you had said ROUND_HALF_UP instead (which I assume you intended) -- most of these don't have cute names. > I confess to never having heard the terms. ROUND_HALF_UP etc are

Re: New Python.org website ?

2006-01-17 Thread Tim Chase
>>I've got an old copy of the html and tried to fix the general problem. >>It's currently on another website >> >>http://pyyaml.org/downloads/masterhtml/ This seems to no longer have the problem and scales nicely no matter which font-size I use. Good work! -

Re: XML Writer in wxPython

2006-01-17 Thread Tim Roberts
t "%s" % first print "%s" % address print "%s" % city print "%s" % state print "%s" % zip print " " print "" for row in addressDatabase: PrintAddress( row.last, row.first, row.address

Re: New Python.org website ?

2006-01-18 Thread Tim Golden
[Shalabh Chaturvedi] | Hm. Am I the only one not particularly impressed? Sure the | front page is | 'slick' but a few clicks reveal a fairly shallow facade of marketing | material, with no real content. In general gives the impression of | 'phony' company trying to make a big impression. Most good

Re: New Python.org website ?

2006-01-18 Thread Tim Golden
[Steve Holden] | https://svn.python.org/www/trunk/beta.python.org | but I don't know whether anonymous access is enabled. Maybe you can let |me know ... Doesn't look like it. Asking me for authentication. TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python.org website ?

2006-01-18 Thread Tim Parkin
s whose answers may help us: Do you have a problem with the way we are trying to 'market' python? Which content in particular do you have an objection to? Could you expand on why you think the beta site looks 'phony'? Could you tell me what about the site makes you think it looks 'cool' or 'flashy'? Could you come up with some alternative for the intro copy about python? Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python.org website ?

2006-01-18 Thread Tim Parkin
mple of a site info architecture that feels like 2005 would be good. Also an example of a backend architecture that isn't like 1998 would be good too. Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python.org website ?

2006-01-18 Thread Tim Parkin
Tim N. van der Leeuw wrote: > Shalabh, > > You've managed very well to express the same things I feel about the > new Python website. > > What I especially dislike about the new website are the flashy pictures > on the front-page with no content and no purpose -- purely

Re: New Python.org website ?

2006-01-18 Thread Tim Parkin
Roel Schroeven wrote: > Tim N. van der Leeuw schreef: > >>Shalabh, >> >>You've managed very well to express the same things I feel about the >>new Python website. > > > FWIW, I don't like the new site at all. It tries to look slick (but >

Re: New Python.org website ?

2006-01-18 Thread Tim Parkin
Tim N. van der Leeuw wrote: > Steve, > > My apologies if this apppeared to be 'slagging'. I was trying to give > some feedback but I do realize that I don't have anything better to > offer yet to replace the pictures I dislike. > > Perhaps I should have withhe

Re: New Python.org website ?

2006-01-18 Thread Tim Parkin
Leeuw van der, Tim wrote: >I think that in general, I don't like the fact that links to >high-profile users are featured so prominently. That row of pictures >there looks good to me 'as such' but linking there to 'success stories' >feels, dunno, perhaps a bit

Re: New Python.org website ?

2006-01-18 Thread Tim Parkin
Tim Golden wrote: >[Shalabh Chaturvedi] > >| Hm. Am I the only one not particularly impressed? Sure the >| front page is >| 'slick' but a few clicks reveal a fairly shallow facade of marketing >| material, with no real content. In general gives the impression of >|

Re: New Python.org website ?

2006-01-18 Thread Tim Chase
> At any rate, opinions will always differ. You are always going to get > the people who want a cool flash-based animated site with 3D stereo > surround sound, and the other end of the spectrum where you will be > flamed if you do anything more than hand-code the html, on Unix machines > only,

Re: How to set a wx.textctrl can editable or readonly?

2006-01-18 Thread Tim Chase
> def onGotFocus(self,evt): > if readonly: > self.Navigate() > > This causes the control to react as if the user press 'tab'. By default > it always tabs forwards, but it takes an optional 'IsForward' argument > - set it to False to tab backwards. Just a pedantic query, no

Re: New Python.org website ?

2006-01-18 Thread Tim Parkin
JW wrote: >Tim the Taller (I presume he's taller; he's Dutch) and the other critics >fail to realize is that no one reads "content". > >I'm assured that in print ads the only "content" anyone reads is in >picture captions, and you damn well bet

Re: OT: excellent book on information theory

2006-01-18 Thread Tim Peters
[Paul Rubin] >> I wouldn't have figured out that a "car park" was a parking lot. I >> might have thought it was a park where you go to look at scenery from >> inside your car. Sort of a cross between a normal park and a drive-in >> movie. [Grant Edwards[ > ;) > > That's a joke, right? Probably

RE: New Python.org website ?

2006-01-18 Thread Tim Golden
[Shalabh Chaturvedi] | Hm. Am I the only one not particularly impressed? Sure the | front page is | 'slick' but a few clicks reveal a fairly shallow facade of marketing | material, with no real content. In general gives the impression of | 'phony' company trying to make a big impression. Most

Re: New Python.org website ?

2006-01-19 Thread Tim Parkin
her offering useful changes that would make sense at this point in time or offereing to provide help that would be greatly appreciated. I'm afraid I won't be able to respond at length to any more posts.. There is still a lot of work to be done to get the website live. Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine the IP address of an eth interface

2006-01-19 Thread Tim Golden
[billie] | Hi all. I'm searching for a module that permits me to | low-level interact | with ethernet interfaces of my system. | I would like to determine at least the first of the followings values: | | 1 - IP address assigned to the interface | 2 - subnet mask | 3 - default gateway | 4 - primary

Re: New Python.org website ?

2006-01-19 Thread Tim Parkin
eenshot of what is there and modifying it to show how you would like it changed. You are coming across has having a chip on your shoulder about something but you are not being clear exactly what it is? Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: simple pythonpath query

2006-01-19 Thread Tim Golden
[EMAIL PROTECTED] | I've downloaded the hypertext module and put it in the c:\python24\lib | folder. I would have thought that since the lib directory is in the | Pythonpath,I would be able to import python scripts from | C:\Python24\Lib\HyperText. I also tried including | C:\Python24\Lib\HyperT

Re: New Python.org website ?

2006-01-19 Thread Tim Parkin
;d really like a few more people to help get us there. I really can't afford a lot of time to discuss issues that have already been discussed far too many times. If we can get down to specifics of what you are offering and what you expect other people to do to help you, then we should be able to keep conversations a lot shorter. Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: How to set a wx.textctrl can editable or readonly?

2006-01-19 Thread Tim Chase
>> Additionally, you should be able to copy text from a >> read-only control, so ousting the focus may not be quite the >> right thing to do. > > Good point. Alternative approaches would be to trap > EVT_KEY_DOWN or EVT_TEXT to detect and block attempts to > modify the contents of the control. Ot

Re: Decimal vs float

2006-01-19 Thread Tim Peters
[Kay Schluehr] >> This is interesting. If we define >> >> def f(): >>print str(1.1) >> >> and disassemble the function, we get: >> > dis.dis(f) > 2 0 LOAD_GLOBAL 0 (str) > 3 LOAD_CONST 1 (1.1001) # huh? [Fredrik Lundh] > huh h

Re: list comprehention

2006-01-19 Thread Tim Chase
(setB) >>> results Set([2,4]) >>> intersection = [x for x in results] >>> intersection [2,4] I'm a tad confused by the help, as it sounds like sets are supposed to be first-class citizens, but in ver2.3.5 that I'm running here (or rather &qu

Re: New Python.org website ?

2006-01-19 Thread Tim Parkin
Fredrik Lundh wrote: >>Good and congratulations, it shows that the source code is well >>formatted/consistent - I wish the rest of the website html/data were so. >>If you are suggesting that your skills can do this with the rest of the >>site content then please, please help!! >> >>In fact I will

Re: list comprehention

2006-01-19 Thread Tim Chase
ge(1,10): lis = [random.randint(1,5) for n in range(5)] r = ref[:] print repr((r,lis)) print len([r.pop(r.index(x)) for x in lis if x in r]) seems to give the results the OP describes. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Nit: please don't user "it's" unless you can substitute "it is" without changing your inteded meaning.

2006-01-19 Thread Tim Roberts
My own name gives me trouble with this. There is disagreement in the curmudgeon world as to whether I should refer to "the Roberts' computer", or "the Roberts's computer". I guess I'll just have to keep saying "that damn computer." -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI module callback / upload hook

2006-01-19 Thread Tim Roberts
s. > >Is there any way in calling a function while processing an upload? >(e.g. like CGI::upload_hook() in perl) Not in the standard cgi.py, but it's not hard to derive your own. I suspect read_binary is all you would need to override. -- - Tim Roberts, [EMAIL PROTECTED] Provide

Re: Extended List Comprehension

2006-01-20 Thread Tim Chase
>>py> [x for x in '1234' if x%2 else 'even'] >>[1, 'even', 3, 'even'] >> >>I'm guessing this has been suggested before? > > > You could (in 2.5) use: > >[(x if x%2 else 'even') for x in '1234'] This failed on multiple levels in 2.3.5 (the "if" syntax is unrecognized, and trying the below w

Re: Strange python behavior with modules on an emt64 box

2006-01-20 Thread Tim Peters
[Joshua Luben] > I thought I would post this here first before seeking more experienced ears > for this particular strangness. > > I have Python 2.4.2 installed from source on a dual processor dell server. > These are x86_64 processors (verified by /bin/arch) (aka emt64 extensions). > > uname -a gi

Re: Is there a maximum length of a regular expression in python?

2006-01-20 Thread Tim Peters
[Bryan Olson] >> Does no one care about an internal error in the regular expression >> engine? [Steve Holden] > Not one that requires parsing a 100 kilobyte re that should be replaced > by something more sensible, no. I care: this is a case of not detecting information loss due to unchecked down

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-20 Thread Tim Peters
[Claudio Grondi] >> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 - IDLE 1.1.2 >> >>> a=[] >> >>> a.append(a) >> >>> b=[] >> >>> b.append(b) >> >>> a==b >> >> Traceback (most recent call last): >>File "", line 1, in -toplevel- >> a==b >> RuntimeError:

Re: Decimal vs float

2006-01-21 Thread Tim Peters
[Kay Schluehr] > I concur and I wonder why CAS like e.g. Maple that represent floating > point numbers using two integers [1] are neither awkward to use nor > inefficient. My guess is that it's because you never timed the difference in Maple -- or, perhaps, that you did, but misinterpreted the res

Re: Returning a tuple-struct

2006-01-21 Thread Tim Roberts
>> type(t) >>> str(t) '(2006, 1, 21, 22, 49, 32, 5, 21, 0)' It's a class object. The __repr__ method returns a string that LOOKS the same as a tuple. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: IT Industry Predicament

2006-01-21 Thread Tim Hammerquist
Ulrich Hobelmann <[EMAIL PROTECTED]> wrote: [ snip bait ] > I know, don't feed the troll. Sorry 'bout that. To quote Space Balls: "Don't be sorry, be *quiet*!" :) Cheers, Tim Hammerquist -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python.org website ?

2006-01-22 Thread Tim Parkin
� wrote: > Steve Holden wrote: > >>>Tim Golden wrote: >>> >>> >>>>[Steve Holden] >>>> >>>>| https://svn.python.org/www/trunk/beta.python.org >>>> >>>>| but I don't know whether anonymous acce

Re: New Python.org website ?

2006-01-22 Thread Tim Parkin
gards to integrating wiki content, it also has a beta directive to include content from a wiki so there could be a good overlap here between keeping the data stored in text files in subversion (a requirement) and using moinmoin to help manage the content. The goal will be to add a wiki-like rest editor that could also handle the non-wiki/non-rest like content (such as sigs, peps, mirrors, donations, jobs, members, psf meeting minutes, etc). Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: hash of hashes

2006-07-11 Thread Tim Chase
> how do i create a hash of hash similar to perl using dict in python > $x{$y}{z}=$z Pretty much the same as in perl, only minus half the crazy abuses of the ASCII character-set. Okay...well, not quite half the abuses in this case... >>> x = {} >>> y = 42 >>> z = 'foonting turlingdromes' >>

Re: I need some help

2006-07-11 Thread Tim Heaney
t; I hope it's possible to do this, and I hope you can help me too. Several different people have written modules to help you read (and write) ID3 tags. http://id3-py.sourceforge.net/ http://pyid3lib.sourceforge.net/ http://news.tiker.net/software/tagpy Pick one you like! Tim --

Re: hash() yields different results for different platforms

2006-07-12 Thread Tim Peters
[Grant Edwards] >> ... >> The low 32 bits match, so perhaps you should just use that >> portion of the returned hash? >> >> >>> hex(12416037344) >> '0x2E40DB1E0L' >> >>> hex(-468864544 & 0x) >> '0xE40DB1E0L' >> >> >>> hex(12416037344 & 0x) >> '0xE40DB1E0L' >> >>> hex

Re: don't need dictionary's keys - hash table?

2006-07-12 Thread Tim Chase
> how come you're so sure that there will never be any collisions ? because none of his strings want their insurance to go up... :*) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: WMI Help

2006-07-13 Thread Tim Golden
3c273 wrote: > Hello, > When I run the following at an interactive interpreter on Windows XP, I get > the expected results. But if I save it to a file and run it, it generates > the following error. (And it generates the same error either way on Windows > 2000) > > import wmi > c=wmi.WMI() > for i

Re: Coding style

2006-07-17 Thread Tim Chase
> lst = [1,2,3,4,5] > while lst: > lst.pop() > > Or even just: > > lst = [] Subtly different though... >>> while lst: ... lst.pop() ... 5 4 3 2 1 >>> lst2 [] >>> lst = [1,2,3,4,5] >>> lst2 = lst >>> lst = [] >>> lst2 [1, 2, 3, 4, 5] >>> lst = [1,2,3,4,5] >>> lst2 = lst >>> del

Re: wanting

2006-07-18 Thread Tim Chase
> "arsl89" <[EMAIL PROTECTED]> writes: >> hy gys i m wanting python programming language. >> plz snd me the backup of python > > Me too. LOL. U r0x0rz! cheCk ot tHiz sekret w4rez s1te!! http://www.python.org/download/ yul find ur "backup" of python hear. iF ur 133t nuf, u can axcessorz all

Re: Number combinations

2006-07-19 Thread Tim Chase
> Just wondering if there is a better way of generating a 4 digit number > (that gets converted to a string), ive got the following code which > generates strings between -. > > > > for a in range(0,10): > for b in range(0,10): > for c in range(0,10): > for d in r

Re: text representation of HTML

2006-07-20 Thread Tim Williams
On 20 Jul 2006 15:12:27 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: > Ksenia Marasanova wrote: > > i want to send plain text alternative of html email, and would prefer > > to do it automatically from HTML source. > > Any hints? > > Use htmllib: > > >>> import htmllib, formatter, StringIO > >>> de

Re: random shuffles

2006-07-21 Thread Tim Peters
[ Boris Borcic] > x.sort(cmp = lambda x,y : cmp(random.random(),0.5)) > > pick a random shuffle of x with uniform distribution ? Say len(x) == N. With Python's current sort, the conjecture is true if and only if N <= 2. > Intuitively, assuming list.sort() does a minimal number of comparisons to

Re: regular expression - matches

2006-07-21 Thread Tim Chase
abcd wrote: > how can i determine if a given character sequence matches my regex, > completely? > > in java for example I can do, > Pattern.compile(regex).matcher(input).matches() > > this returns True/False whether or not input matches the regex > completely. > > is there a matches in python?

Re: Converting argv to variable

2006-07-22 Thread Tim Chase
> newDirectory = str(sys.argv[1:]) [cut] > Now, in a perfect universe I would get an output something > like the following (if I run the script with the argument > 'python': > > /Volumes/Home/myuser/python > > However, Python still hangs on to all the fluff and prints > out something else:

Re: subprocess module

2006-07-22 Thread Tim Roberts
found was here ; "Use the source, Luke." The best examples of the use of subprocess are contained in the introductory comments in the module itself. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: building lists of dictionaries

2006-07-23 Thread Tim Chase
> parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}]*6 > parinfo[0]['fixed'] = 1 > parinfo[4]['limited'][0] = 1 > parinfo[4]['limits'][0] = 50. > > The first line builds a list of six dictionaries with > initialised keys. I expected that the last three lines > would o

Re: building lists of dictionaries

2006-07-23 Thread Tim Chase
>>parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], >>'limits':[0.,0.]}.copy() for i in xrange(0,6)] >> >>However, this will still reference internal lists that have >>been referenced multiple times, such that >> >> >>> parinfo[5]['limited'] >>[0, 0] >> >>> parinfo[4]['limited'][0] = 2 >> >>> par

Re: Re-evaluating a string?

2006-07-23 Thread Tim Chase
> serialport.write('!SC'+'\x01'+'\x05'+'\xFA'+'\x00'+'\r') [cut] > My problem is that the "write()" function only takes a string, and I > want to substitute variables for the hex literals. Well, you can try something like >>> import types >>> def makeString(a): ... return ''.join([type(x) !

Re: Re-evaluating a string?

2006-07-23 Thread Tim Chase
> Thanks Tim, and John for your quick responses! This is one of the better lists for getting quick (and usually helpful) responses. > Tim, I tested your function and it works! Though I don't completely > understand how. Could you possibly explain this? >>> def makeSt

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Tim Heaney
idea. I think Ruby on Rails is terrific. Perhaps you'll think so too. If not, at least you'll have a better idea of why you don't. Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: list of indices

2006-07-24 Thread Tim Chase
>>indices=[0,3,6] >>new_list=list[indices] > new_list = [list[x] for x in indicies] and just as a caveat, it's generally considered bad form to shadow the built-in list as such... -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: an "urgent" answer to a simple question

2006-07-25 Thread Tim Chase
> I need to install Python Imaging Library (PIL) - > imaging-1.1.5.tar.gz (source ) onto Suse Linux 10.1 system in > order for (latest) Scribus 1.3.3.2 to install and work. Not being a Suse user, I'm flying by the seat of my pants. My recommendation: Install debian, and use "apt-get install pytho

Re: pasting numpy array into bigger array

2006-07-26 Thread Tim Heaney
[1]] = x or m, n = 1, 1 s, t = x.shape y[m:m+s, n:n+t] = x There is a mailing list for numpy https://lists.sourceforge.net/lists/listinfo/numpy-discussion You might have more luck asking your question on there. I think it's a shame there isn't any free documentation for numpy. Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: why is this not working? (nested scope question)

2006-07-26 Thread Tim Chase
[EMAIL PROTECTED] wrote: > I have a problem understanding the scope of variable in nested > function. I think I got it nailed to the following example copied from > Learning Python 2nd edition page 205. Here is the code. > > def f1() : > x=88 > f2() > def f2() : > print 'x=',x > f1() >

Re: splitting words with brackets

2006-07-26 Thread Tim Chase
> "a (b c) d [e f g] h i" > should be splitted to > ["a", "(b c)", "d", "[e f g]", "h", "i"] > > As speed is a factor to consider, it's best if there is a > single line regular expression can handle this. I tried > this but failed: > re.split(r"(?![\(\[].*?)\s+(?!.*?[\)\]])", s). It work

Re: splitting words with brackets

2006-07-26 Thread Tim Chase
> but it can't pass this one: "(a c)b(c d) e" the above regex > gives out ['(a c)b(c', 'd)', 'e'], but the correct one should > be ['(a c)b(c d)', 'e'] Ah...the picture is becoming a little more clear: >>> r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+') >>> r.findall(s) ['(a c)b(c d)', 'e'] I

Re: splitting words with brackets

2006-07-26 Thread Tim Chase
>> >>> r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+') >> >>> r.findall(s) >>['(a c)b(c d)', 'e'] > > Ah, it's exactly what I want! I thought the left and right > sides of "|" are equal, but it is not true. In theory, they *should* be equal. I was baffled by the nonparity of the situation. Yo

RE: pysqlite2 fetching from select different than pysqlite?

2006-07-27 Thread Tim Golden
[EMAIL PROTECTED] | I have some old pysqlite 1.x code that uses a pattern like this: | | cu.execute('SELECT weight FROM weights WHERE samplename="foo") | row = cu.fetchone() | weight=row['weight'] | | It seems like lookups by name are no longer supported in | pysqlite2. According to this: ht

RE: pysqlite2 fetching from select different than pysqlite?

2006-07-27 Thread Tim Golden
[EMAIL PROTECTED] | Sent: 27 July 2006 15:01 | To: python-list@python.org | Subject: Re: pysqlite2 fetching from select different than pysqlite? | | Thanks Tim! That works well. As a followup, is there a standard | compliant way to ask what fields are in the table? | | -kurt Assuming this is

Re: splitting words with brackets

2006-07-27 Thread Tim Chase
other alternative patterns. \S is the most > "matchable" pattern, so if it comes ahead of the other > alternatives, then it will always be the one matched. My > guess is that if you put \S first, you will only get the > contiguous character groups, regardless of ()'s

Suppressing banner on interactive startup?

2006-07-28 Thread Tim Chase
A couple of hopefully short (interrelated) questions: 1) is there a way to suppress the banner when starting Python interactively? Something like a "--quiet" that would just drop you straight to a prompt? I like to use Python as a nuclear-powered calculator, and am working on a couple little

Re: Suppressing banner on interactive startup?

2006-07-28 Thread Tim Chase
1 and ps2...just namespaced off into the sys module. Works like a charm. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with regex

2006-07-28 Thread Tim Chase
> when I do, re.compile('[A-Za-z]:\\([^/:\*\?"<>\|])*') ...I get > > sre_constants.error: unbalanced parenthesis Because you're not using raw strings, the escapables become escaped, making your regexp something like [A-Za-z]:\([^/:\*\?"<>\|])* (because it knows what "\\" is, but likel

Re: problem with regex

2006-07-28 Thread Tim Chase
> p = re.compile(r'[A-Za-z]:\\([^/:\*?"<>\|])*') > > x = p.match("c:\test") > any ideas why? i escape the back-slash, the asterisk *, and the PIPE | > b/c they are regex special characters. Same problem, only now in the other string: >>> s = "c:\test" >>> print s c: est Your "\t"

Re: problem with regex

2006-07-28 Thread Tim Chase
regex = r'[A-Za-z]:\\([^/:\*\?"<>\|])*' p = re.compile(regex) p.match('c:\\test') > <_sre.SRE_Match object at 0x009D77E0> p.match('c:\\test?:/') > <_sre.SRE_Match object at 0x009D7720> > > the last example shouldnt give a match Ah, but it should, because it *does* match. >>>

<    26   27   28   29   30   31   32   33   34   35   >