Re: Confused: appending to a list

2006-03-23 Thread Rene Pijlman
DataSmash: I'm confused. Why is it that when I say while len(list) 5:, I get 5 items in my list. Because the last time when len(list) was 5, the block of code following the while executed and did something to the list to give it a length = 5 (otherwise the block of code would be executed again

Re: Confused: appending to a list

2006-03-23 Thread skip
R.D. I'm confused. Why is it that when I say while len(list) 5:, I R.D. get 5 items in my list. If I say while len(list) 6:, I get 6 R.D. items in the list and so on. I would think if I said less than R.D. 5, I would get 4 items. Can anyone explain this? Thanks. R.D. The

Re: Confused: appending to a list

2006-03-23 Thread adam . bachman
You're wanting it to stop when the len(list) == 4, right? The easiest way to change the logic would be to say while len(list) != 4: but that could get you into trouble later on. The problem with the len(list) 5 expression is that the loop will run one more time as long as len(list) ==

Re: Probelem about image size and dimensions

2006-03-23 Thread dwelch
[EMAIL PROTECTED] wrote: I got a piece of python script to upload file and it can upload it to different folders on server depend on the type of file is image or not. but I also want to restrict the size and dimensions of file if it is a image file.Could anyone help me out? Parameter

Re: raw_input

2006-03-23 Thread Tim Williams (gmail)
On 23/03/06, cm012b5105 [EMAIL PROTECTED] wrote: if s = raw_input (hello what's your name? ) if s=='carmel ': print Ahh the boss's wife What i would like to know is what if she doesn't write carmel she rights say carm short of me writing if s=='carm': on a new line

pydoc does not like this file

2006-03-23 Thread Joram Agten
Hello please put me in CC I'm trying pydoc as documentation for my projects but I have the following problem when runnig pydoc on my whole project there is also a file setup.py (from py2exe) but pydoc gives me the following for that file:

Re: Confused: appending to a list

2006-03-23 Thread Fredrik Lundh
DataSmash wrote: I'm confused. Why is it that when I say while len(list) 5:, I get 5 items in my list. If I say while len(list) 6:, I get 6 items in the list and so on. I would think if I said less than 5, I would get 4 items. except that you're saying as long as there are less than 5

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-23 Thread Dinko Tenev
Dirk Thierbach wrote: Dinko Tenev [EMAIL PROTECTED] wrote: Dirk Thierbach wrote: If more time during preprocessing is allowed, another idea is to treat the wildcard expressions as regular expressions, convert each into a finite state machine, construct the intersection of all these

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-23 Thread Aaron Denney
On 2006-03-23, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The solution that would have the most utility would be one where the elements are generated one-by-one, loop-like, so that they can be used in the body of a loop, and to avoid the fact that even with exclusion the cardinality of the

New development windows, IronPython or PythonWin

2006-03-23 Thread Dan
Just starting to do some windows Client / Server programming. Which would you recommend? I need to create a server to fire events and communicate with clients over a lan. Thanks -- http://mail.python.org/mailman/listinfo/python-list

How to find out the next Friday using RelativeDateTime

2006-03-23 Thread vj
I'm doing: a = now() delta = ReltaiveDateTime(days=+6, weekday(mx.DateTime.Friday, 0)) Next Friday: a+delta a: march 23 a+delta: Gives me March 31st and not March 24th Any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Re: Per instance descriptors ?

2006-03-23 Thread bruno at modulix
Steven Bethard wrote: (some smart questions) Steven , I owe you a *big* thank. I knew they must have been something wrong, but couldn't point what. Now I see, and it's of course totally obvious. Using a class as a decorator, I have of course only one instance of it per function - and for some

Re: Per instance descriptors ?

2006-03-23 Thread Steven Bethard
bruno at modulix wrote: Using a class as a decorator, I have of course only one instance of it per function - and for some attributes, I need an instance per function call. Per function call? And you want the attributes on the function, not the result of calling the function? If so, that'd

Re: don't understand popen2

2006-03-23 Thread Kent Johnson
Sion Arrowsmith wrote: Try: std_out, std_in = popen2.popen2(F:/coding/pwSync/popen_test/testia.py) or: std_out, std_in = popen2.popen2(F:\\coding\\pwSync\\popen_test\\testia.py) (and please avoid the abuse of raw strings for Windows paths). Why do you consider that abuse of raw strings? It's

python-announce moderation (was: Re: ANN: ClientForm 0.2.2 released)

2006-03-23 Thread John J Lee
Hmm, [EMAIL PROTECTED], who are you? python-announce moderator? I didn't put you on my To: line (nor python-list for that matter, but I guess that's a reasonable place for it to go...). Also FYI, it ended up going to wwwsearch-general twice, I guess because the you (or the moderation

Re: pydoc does not like this file

2006-03-23 Thread Jesus Rivero - (Neurogeek)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hmmm guess -w should be after python and not after pydoc: python -w c:\python24\Lib\pydoc.py .\setup.py And i also guess you are missing a command after setup.py (if you are using py2exe, that must be the command you are looking for.) so try this:

Re: Strange metaclass behaviour

2006-03-23 Thread Christian Eder
Michele Simionato wrote: Still, it is an interesting exercise if you are willing to risk the melting of your brain, so here is the code ;) I tried your code and it fixes the double execution, but the __new__ is executed in context of M_A instead of M_B which would be the more specific type

IMAP Tkinter Issue

2006-03-23 Thread Kevin F
Sorry to repost... but 4am didn't get much responses. I've been trying to implement this script, it polls an IMAP inbox for unread messages and displays the sender and subject in a scrollable window using Tkinter. However, when I try to change the search parameters on line 55 from 'unread'

Re: Integrating python with smalltalk

2006-03-23 Thread Ian Upright
For a crazy response lets try: Lets find how how we can call Python from Java or C#, without using COM. If you can find some answers to those questions, perhaps that would shed some light on how it would be possible in Smalltalk. Ian nelson [EMAIL PROTECTED] wrote: Hi all, sorry if it isn't

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-23 Thread [EMAIL PROTECTED]
Call a wc 'free' if it satisfies the propery that every letter 'a' in it appears only in the form '*a*', and 'anchored' otherwise. What if all wc's are free? How does this affect the DFA? Does it minimize nontrivially? Keep in mind I'm new to DFA theory. Walter Kehowski --

beginer question of list comprehensions

2006-03-23 Thread Echo
Ok, this is the first list comprehension that I have done. Surprisinly, it works for the most part. The problem with it is that it returns a list with two lists in it, instead of just one list. Can anyone tell me what I am doing wrong or how to fix it. Here is my code: [t for t in (__import__(m,

Re: Uploading files from IE

2006-03-23 Thread and-google
AB wrote: I tried the following with the same result: myName = ulImage.filename newFile = file (os.path.join(upload_dir, os.path.basename(myName)), 'wb') os.path is different on your system to the uploader's system. You are using Unix pathnames, with a '/' separator - they are using Windows

Re: Confused: appending to a list

2006-03-23 Thread DataSmash
Thanks for explaining and all the additional ideas! R.D. -- http://mail.python.org/mailman/listinfo/python-list

boost python tutorial

2006-03-23 Thread MakaMaka
Hi, I'm trying to build the basic boost.python tutorial that comes with the distribution. I'm using bjam and mingw. It builds the module, but upon import, it gives this error: ImportError: dynamic module does not define init function (inithello) I've found other threads with this problem as a

Re: python-announce moderation (was: Re: ANN: ClientForm 0.2.2 released)

2006-03-23 Thread Aahz
In article [EMAIL PROTECTED], John J Lee [EMAIL PROTECTED] wrote: Hmm, [EMAIL PROTECTED], who are you? python-announce moderator? I didn't put you on my To: line (nor python-list for that matter, but I guess that's a reasonable place for it to go...). Also FYI, it ended up going to

Re: How to find out the next Friday using RelativeDateTime

2006-03-23 Thread vj
I figured out how to do it. This does not work: delta = ReltaiveDateTime(days=0, weekday(mx.DateTime.Friday, 0)) But this works: delta = ReltaiveDateTime(days=+0, weekday(mx.DateTime.Friday, 0)) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find out the next Friday using RelativeDateTime

2006-03-23 Thread John Machin
On 24/03/2006 5:18 AM, Dennis Lee Bieber wrote: On 23 Mar 2006 09:37:13 -0800, vj [EMAIL PROTECTED] declaimed the following in comp.lang.python: I'm doing: a = now() delta = ReltaiveDateTime(days=+6, weekday(mx.DateTime.Friday, 0)) Next Friday: a+delta a: march 23 a+delta: Gives me March

Re: How to find out the next Friday using RelativeDateTime

2006-03-23 Thread vj
Thanks for pointing out that the days=+0 is not necessary. Your other points are well noted. Thanks VJ -- http://mail.python.org/mailman/listinfo/python-list

Remove integer from float number

2006-03-23 Thread Derek Basch
How can I return: .666 from float: 0.666 This is what I have so far: %.6f % x Thanks Everyone, Derek Basch -- http://mail.python.org/mailman/listinfo/python-list

Re: Remove integer from float number

2006-03-23 Thread Larry Bates
Derek Basch wrote: How can I return: .666 from float: 0.666 This is what I have so far: %.6f % x Thanks Everyone, Derek Basch This works but I'm not entirely sure I know what you are trying to accomplish. (%.3f % x)[1:] -Larry Bates --

Re: How to find out the next Friday using RelativeDateTime

2006-03-23 Thread John Machin
On 24/03/2006 6:30 AM, vj wrote: I figured out how to do it. This does not work: delta = ReltaiveDateTime(days=0, weekday(mx.DateTime.Friday, 0)) But this works: delta = ReltaiveDateTime(days=+0, weekday(mx.DateTime.Friday, 0)) vj, NEITHER of those work, because you still have the two

Re: Remove integer from float number

2006-03-23 Thread Derek Basch
Ahh yes you have to put parenthases around the string formatting to remove the integer using indexes. Thanks, that's just what I needed! Derek Basch -- http://mail.python.org/mailman/listinfo/python-list

Re: boost python tutorial

2006-03-23 Thread Roman Yakovenko
On 23 Mar 2006 11:17:46 -0800, MakaMaka [EMAIL PROTECTED] wrote: Hi, I'm trying to build the basic boost.python tutorial that comes with the distribution. I'm using bjam and mingw. It builds the module, but upon import, it gives this error: ImportError: dynamic module does not define init

Re: python-announce moderation (was: Re: ANN: ClientForm 0.2.2 released)

2006-03-23 Thread John J. Lee
[EMAIL PROTECTED] (Aahz) writes: In article [EMAIL PROTECTED], John J Lee [EMAIL PROTECTED] wrote: Hmm, [EMAIL PROTECTED], who are you? python-announce moderator? I didn't put you on my To: line (nor python-list for that matter, but I guess that's a reasonable place for it to go...).

Find Paths in log text - How to?

2006-03-23 Thread citizenkahn
I am trying to parse a build log for errors. I figure I can do this one of three ways: - find the absolute platonic form of an error and search for that item - create definitions of what patterns describe errors for each tool which is used (ant, MSDEV, etc). - rework the build such that all the

Re: beginer question of list comprehensions

2006-03-23 Thread Larry Bates
Echo wrote: Ok, this is the first list comprehension that I have done. Surprisinly, it works for the most part. The problem with it is that it returns a list with two lists in it, instead of just one list. Can anyone tell me what I am doing wrong or how to fix it. Here is my code: [t for

Re: Remove integer from float number

2006-03-23 Thread Paul Rubin
Derek Basch [EMAIL PROTECTED] writes: Ahh yes you have to put parenthases around the string formatting to remove the integer using indexes. Thanks, that's just what I needed! I think it's better to remove leading zeros explicitly: ('%.3x' % x).lstrip('0') --

Re: Remove integer from float number

2006-03-23 Thread John Machin
On 24/03/2006 6:44 AM, Larry Bates wrote: Derek Basch wrote: How can I return: .666 from float: 0.666 This is what I have so far: %.6f % x Thanks Everyone, Derek Basch This works but I'm not entirely sure I know what you are trying to accomplish. (%.3f % x)[1:] x =

Re: RELEASED Python 2.4.3, release candidate 1

2006-03-23 Thread Paddy
I followed the links to the coverity page that shows their table of errors found, and subsequently fixed in tools used for the LAMP stack. They say that they informed the maintainers of the software about the precise errors found and the number of errors has been tracked since then. It seems

Re: MS word document generator

2006-03-23 Thread Raja Raman Sundararajan
Hi paron, I am using PyRTF as of now and it seems to fit my need quite well and it works like a charm :-). I have made a wrapper around it so that it will easier for me to switch the backend for generating the word/RTF docs later. May be, it will be openoffice :-) I appreciate your input.

Re: How to find out the next Friday using RelativeDateTime

2006-03-23 Thread fumanchu
a = now() delta = ReltaiveDateTime(days=+6, weekday(mx.DateTime.Friday, 0)) Next Friday: a+delta a: march 23 a+delta: Gives me March 31st and not March 24th Any ideas? Just an off-beat idea: use Python's datetime instead of mx.DateTime, and my recur module:

Re: Function params with **? what do these mean?

2006-03-23 Thread Scott David Daniels
J Rice wrote: I'm sorry for such a basic question, but I haven't been able to phrase a search that gets me an answer and my books are totally silent on this. I have seen a number of python function defs that take parameters of the form (**param1). Looks like a pointer... but my books on

Re: RELEASED Python 2.4.3, release candidate 1

2006-03-23 Thread Fredrik Lundh
Paddy wrote: I followed the links to the coverity page that shows their table of errors found, and subsequently fixed in tools used for the LAMP stack. They say that they informed the maintainers of the software about the precise errors found and the number of errors has been tracked since

Barking up the wrong tree with extension types and modules?

2006-03-23 Thread Steve Juranich
We have a large suite of legacy tools (based on stand-alone executables and shell scripts) that we would like to integrate into a suite of Python modules. I'm having a little trouble getting my head around how the best way to implement the whole thing, though. Here's (roughly) the situation: We

Re: boost python tutorial

2006-03-23 Thread MakaMaka
I checked and it is. I can't use news servers at work b/c of the firewall. Is there another way to access this mailing list? -- http://mail.python.org/mailman/listinfo/python-list

Re: Barking up the wrong tree with extension types and modules?

2006-03-23 Thread Robert Kern
Steve Juranich wrote: We have a large suite of legacy tools (based on stand-alone executables and shell scripts) that we would like to integrate into a suite of Python modules. I'm having a little trouble getting my head around how the best way to implement the whole thing, though. Here's

Re: python-announce moderation (was: Re: ANN: ClientForm 0.2.2 released)

2006-03-23 Thread Aahz
In article [EMAIL PROTECTED], John J. Lee [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Aahz) writes: In article [EMAIL PROTECTED], John J Lee [EMAIL PROTECTED] wrote: Hmm, [EMAIL PROTECTED], who are you? python-announce moderator? I didn't put you on my To: line (nor python-list for that

Re: Integrating python with smalltalk

2006-03-23 Thread Chronos
nelson wrote: On windows i know i can create in python a COM server and call it from smalltalk, but i wonder if there is a more general solution (platform independent). SOAP. -- http://mail.python.org/mailman/listinfo/python-list

COM callbacks in Python

2006-03-23 Thread Dan
I need to register for a COM callback under Windows. I am using an ADO recordset interface like this: import win32com.client import time connect = win32com.client.Dispatch(ADODB.Connection) recordset = win32com.client.Dispatch(ADODB.Recordset)

Re: encoding problems (é and è)

2006-03-23 Thread John Machin
On 23/03/2006 10:07 PM, bussiere bussiere wrote: hi i'am making a program for formatting string, or i've added : #!/usr/bin/python # -*- coding: utf-8 -*- in the begining of my script but str = str.replace('Ç', 'C') str = str.replace('é', 'E') str = str.replace('É',

Re: boost python tutorial

2006-03-23 Thread Roman Yakovenko
On 23 Mar 2006 12:36:17 -0800, MakaMaka [EMAIL PROTECTED] wrote: I checked and it is. I can't use news servers at work b/c of the firewall. Is there another way to access this mailing list? Yes, try to subscribe: http://www.python.org/community/sigs/. See c++-sig If you can use your mail or

Re: Remove integer from float number

2006-03-23 Thread Larry Bates
John Machin wrote: On 24/03/2006 6:44 AM, Larry Bates wrote: Derek Basch wrote: How can I return: .666 from float: 0.666 This is what I have so far: %.6f % x Thanks Everyone, Derek Basch This works but I'm not entirely sure I know what you are trying to accomplish. (%.3f %

Re: removing file by inode

2006-03-23 Thread Arne Ludwig
under SunOS there was a way to delete a file given it's i-node. Yes and no. You probably mean clri which cleared the inode, but did not remove the file, i.e. all the entries in directories pointing to it. In older Unices there was also ncheck to find the filesystem names for inode numbers. I

Re: encoding problems (é and è)

2006-03-23 Thread Peter Otten
John Machin wrote: You can replace ALL of this upshifting and accent removal in one blow by using the string translate() method with a suitable table. Only if you convert to unicode first or if your data maintains 1 byte == 1 character, in particular it is not UTF-8. Peter --

Re: Convert Word .doc to Acrobat .pdf files

2006-03-23 Thread kbperry
Thanks again Duncan! I will use the OpenOffice solution as a last resort. It isn't the standard office suite at my corp. I would like the code to be as portable as possible, and it would seem like a pain in the arse to have the end user install OpenOffice just to run my script. Sure it would

Re: An Efficient Scalar Class in Python

2006-03-23 Thread Ben Finney
[EMAIL PROTECTED] [EMAIL PROTECTED] writes: A Python class was designed to represent physical scalars and to eliminate errors involving implied physical units (e.g., confusing angular degrees and radians). This sounds like a useful abstraction; I'm not sure if there are established ways to do

Re: removing file by inode

2006-03-23 Thread Arne Ludwig
Actually under Linux he could probably pipe clri %d to debugfs if that is what he wanted to do. On the other hand he said unix environment which could be anything really. -- http://mail.python.org/mailman/listinfo/python-list

Re: Remove integer from float number

2006-03-23 Thread Arne Ludwig
With that terse description and the subject line I would interpret the OP like so: print re.sub(.*\.,.,0.666) .666 print re.sub(.*\.,.,123.666) .666 -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a loop to activate a loop above it

2006-03-23 Thread Arne Ludwig
I think the problem is this line: x == input('What is x now?: ') which should not have a == but a = -- http://mail.python.org/mailman/listinfo/python-list

Re: An Efficient Scalar Class in Python

2006-03-23 Thread konrad . hinsen
On 23.03.2006, at 22:48, Ben Finney wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] writes: A Python class was designed to represent physical scalars and to eliminate errors involving implied physical units (e.g., confusing angular degrees and radians). This sounds like a useful abstraction;

Re: Function params with **? what do these mean?

2006-03-23 Thread Ben Finney
Scott David Daniels [EMAIL PROTECTED] writes: At the risk of being thought of as beating a dead horse, this was a _great_ way to ask this question. [...] So, anyhow, thanks for taking the time to write your question properly. Take that risk, please. There's enough lambasting of (and probably

Re: Remove integer from float number

2006-03-23 Thread Grant Edwards
On 2006-03-23, Arne Ludwig [EMAIL PROTECTED] wrote: With that terse description and the subject line I would interpret the OP like so: print re.sub(.*\.,.,0.666) .666 print re.sub(.*\.,.,123.666) .666 Or if you're allergic to regular expressions: print . + 0.666.split(.)[-1] .666 print

Re: python-announce moderation (was: Re: ANN: ClientForm 0.2.2 released)

2006-03-23 Thread John J. Lee
[EMAIL PROTECTED] (Aahz) writes: [...] H hschilling is NOT one of the python-announce moderators, so I see. zir e-mail setup is probably b0rken, accounting for all the problems you mentioned. Could be. I frequently send e-mail to python-announce, python-list, and baypiggies

Re: Per instance descriptors ?

2006-03-23 Thread bruno at modulix
Steven Bethard wrote: (snip code) But that looks pretty nasty to me. aol / It sounds like your architecture could use some redesigning Done - in much more sane way. Got rid of some more boilerplate and of the whole problem of per-instance descriptors BTW !-) I should probably sleep

RE: Remove integer from float number

2006-03-23 Thread Michael Yanowitz
how about this solution: def printDecimal(number): if (number 0): print number - int(number) else: print int(number) - number -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Grant Edwards Sent: Thursday, March 23, 2006 5:11 PM

RE: RELEASED Python 2.4.3, release candidate 1

2006-03-23 Thread Delaney, Timothy (Tim)
Fredrik Lundh wrote: (and there was never 96 real errors in the code base, of course; coverity is a remarkable tool, but there's plenty of room for mistakes when used on a code base this large) Yep - from the discussions on python-dev, a lot of the error-fixing was telling Coverity what

RE: Remove integer from float number

2006-03-23 Thread Michael Yanowitz
Sorry, got it backwards: def printDecimal(number): if (number = 0): print number - int(number) else: print int(number) - number -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Michael Yanowitz Sent: Thursday, March 23, 2006 5:21

Re: Remove integer from float number

2006-03-23 Thread Grant Edwards
On 2006-03-23, Michael Yanowitz [EMAIL PROTECTED] wrote: With that terse description and the subject line I would interpret the OP like so: print re.sub(.*\.,.,0.666) .666 print re.sub(.*\.,.,123.666) .666 Or if you're allergic to regular expressions: print . + 0.666.split(.)[-1] .666

Re: Remove integer from float number

2006-03-23 Thread Grant Edwards
On 2006-03-23, Michael Yanowitz [EMAIL PROTECTED] wrote: Sorry, got it backwards: def printDecimal(number): if (number = 0): print number - int(number) else: print int(number) - number Still top posted and still doesn't work: def printDecimal(number): ... if

Re: encoding problems (é and è)

2006-03-23 Thread John Machin
On 24/03/2006 8:36 AM, Peter Otten wrote: John Machin wrote: You can replace ALL of this upshifting and accent removal in one blow by using the string translate() method with a suitable table. Only if you convert to unicode first or if your data maintains 1 byte == 1 character, in

Re: Can't get the real contents form page in internet as the tag no-chche

2006-03-23 Thread John J. Lee
dongdong [EMAIL PROTECTED] writes: oh~~~! offer my thanks to Tim Roberts and all persons above! I see now, it's the different url causes! contents can only be got from the later (real ) url. I made a mistick not to look at the different urls taking effect. If you use

Re: Python has a new Logo

2006-03-23 Thread Robert Hicks
You are s lame. -- http://mail.python.org/mailman/listinfo/python-list

Command line option -Q (floor division)

2006-03-23 Thread Christoph Zwerschke
I noticed that contrary to what is said in http://www.python.org/doc/2.2.3/whatsnew/node7.html, namely that integer divison should print deprecation warnings beginning with Python 2.3, even Python 2.4 is still quiet about it, i.e. you still need to explicitely set the -Q warn option to see the

Multiplying sequences with floats

2006-03-23 Thread Christoph Zwerschke
Currently, if you write 3*'*', you will get '***', but if you write 3.0*'*', you will get an error (can't multiply sequence by non-int). I was wondering whether this should be allowed, i.e. multiplication of a sequence with a float. There could be either an implicit typecast to int (i.e.

Terminating a subprocess '.exe'

2006-03-23 Thread Ernesto
I launch a Windows executable and wish to close it from Python. The code is below. Normally, my program waits for rib.exe to finish, but I'd like to be able to close it from python if possible. (I suppose if I was going to do this, I wouldn't use .wait() ) Any ideas ? # Launch a program

Re: Remove integer from float number

2006-03-23 Thread Ben Finney
Michael Yanowitz [EMAIL PROTECTED] writes: Sorry, got it backwards: You also got the reply backwards (in both cases). URL:http://en.wikipedia.org/Top_posting -- \No one ever went broke underestimating the taste of the | `\American public. --

imap folder scanner

2006-03-23 Thread Kun
Hey guys, I would like to have a code in python (as simple as possible) to scan a specific folder in my mailbox and if the subject is equal to, say, 'BIKES', I would like to have the code automatically send the SENDER an email saying something like We have received your Email. Furthermore, I

Re: datetime iso8601 string input

2006-03-23 Thread Ben Finney
Magnus Lycka [EMAIL PROTECTED] writes: As I've written before, the ISO 8601 spec contains many variations in date formats. Making a full ISO 8601 parser is probably possible if we ignore time deltas, but it's hardly worth the effort. Writing something that parses a few percent of the possible

Re: Multiplying sequences with floats

2006-03-23 Thread Dan Sommers
On Fri, 24 Mar 2006 00:35:44 +0100, Christoph Zwerschke [EMAIL PROTECTED] wrote: Currently, if you write 3*'*', you will get '***', but if you write 3.0*'*', you will get an error (can't multiply sequence by non-int). I was wondering whether this should be allowed, i.e. multiplication of a

Re: UPDATE imap folder scanner

2006-03-23 Thread Kun
Okay So I got the 'search' part to work, which outputs me a long list of message numbers. how do i use that list of message numbers to fetch the 'from' address for each one and send them a confirmation email? is this some sort for loop? any help would be greatly appreciated. cheers. Kun

Re: Multiplying sequences with floats

2006-03-23 Thread Christoph Zwerschke
Dan Sommers wrote: Christoph Zwerschke wrote: I was wondering whether this should be allowed, i.e. multiplication of a sequence with a float. There could be either an implicit typecast to int (i.e. rounding) ... Explicit is better than implicit. I already knew using the word implicit would

Multiplying all the values in a dictionary

2006-03-23 Thread John McMonagle
Say I have a dictionary like below: d = {(100,500):[5,5], (100,501):[6,6], (100,502):[7,7]} Say I want to multiply all the values of the dictionary by 2: for key in d.keys(): d[key] = map(lambda x: x*2, d.get(key)) Is there a better/faster/cleaner way to achieve this ? Thanks, John --

Question about raw string and regex

2006-03-23 Thread jlowery
I'm looking through the tools/scripts folder from the python install, trying to get reacquanted with the language. Got a question on the following classfix.py snippet: # This expression doesn't catch *all* class definition headers, # but it's pretty darn close. classexpr = '^\([ \t]*class

Re: Multiplying all the values in a dictionary

2006-03-23 Thread Felipe Almeida Lessa
Em Sex, 2006-03-24 às 11:04 +1000, John McMonagle escreveu: Is there a better/faster/cleaner way to achieve this ? Maybe... for key in d: d[key] = [x*2 for x in d[key]] ...? I can't thing of anything better :(... HTH, -- Felipe. --

Re: Question about raw string and regex

2006-03-23 Thread Felipe Almeida Lessa
Em Qui, 2006-03-23 às 17:11 -0800, [EMAIL PROTECTED] escreveu: Since the classexpr isn't a raw string (not r prefix), doesn't the \t get converted to a tab character before it gets to the regex compiler? print '^\([ \t]*class +[a-zA-Z0-9_]+\) *( *) *\(\(=.*\)?\):' ^\([]*class

Announcing xe and PyFeed, for XML and syndication feeds

2006-03-23 Thread Steve R. Hastings
xe.py is a Python module to make it very easy to work with XML. I have attempted to make xe classes very Pythonic and intuitive. xe is intended for working with structured XML, such as syndication feed files, but I have added some support for unstructured XML as well. Example: import xe bird

Re: Question about raw string and regex

2006-03-23 Thread jlowery
I doubt it, although it might work anyway. Here's another from the same program: (a0, b0), (a1, b1), (a2, b2) = classprog.regs[:3] Nothing in the Python lib reference on the regs attribute for regex objects. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiplying all the values in a dictionary

2006-03-23 Thread Scott David Daniels
John McMonagle wrote: Say I have a dictionary like below: d = {(100,500):[5,5], (100,501):[6,6], (100,502):[7,7]} Say I want to multiply all the values of the dictionary by 2: for key in d.keys(): d[key] = map(lambda x: x*2, d.get(key)) Is there a better/faster/cleaner way to achieve

Re: Multiplying all the values in a dictionary

2006-03-23 Thread adam . deprince
for key in d: d[key] = [x*2 for x in d[key]] Naw, if you are going to use list interpolation go all the way and save yourself all of that ugly indexing into the dict. d = {(100,500):[5,5], (100,501):[6,6], (100,502):[7,7]} d.update( [[key,[x*2 for x in item]] for key,item in d.items()]

Re: New development windows, IronPython or PythonWin

2006-03-23 Thread sanxiyn
IronPython is currently nowhere near production quality. I would not recommend it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiplying all the values in a dictionary

2006-03-23 Thread Felipe Almeida Lessa
Em Qui, 2006-03-23 às 17:54 -0800, Scott David Daniels escreveu: John McMonagle wrote: Say I have a dictionary like below: d = {(100,500):[5,5], (100,501):[6,6], (100,502):[7,7]} Say I want to multiply all the values of the dictionary by 2: for key in d.keys(): d[key] =

Re: Question about raw string and regex

2006-03-23 Thread John Machin
On 24/03/2006 12:36 PM, [EMAIL PROTECTED] wrote: I doubt it, although it might work anyway. You could dispel all doubt in about 15 seconds flat were you to actually try it out. import regex __main__:1: DeprecationWarning: the regex module is deprecated; please use the re module

Re: Multiplying all the values in a dictionary

2006-03-23 Thread Felipe Almeida Lessa
Em Qui, 2006-03-23 às 18:01 -0800, [EMAIL PROTECTED] escreveu: for key in d: d[key] = [x*2 for x in d[key]] Naw, if you are going to use list interpolation go all the way and save yourself all of that ugly indexing into the dict. d = {(100,500):[5,5], (100,501):[6,6],

Strings and % sign fails - Help Please

2006-03-23 Thread siasookhteh
I also posted this in Django Users group, but figured it probably has more relevance for python group. It seems like a freak problem to me. I spent a long hour to track the problem down and here it is: The following statement fails because it has the '%' sign in it. cursor.execute(select '%')

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Jorge Godoy
[EMAIL PROTECTED] writes: The following statement fails because it has the '%' sign in it. cursor.execute(select '%') The error is: IndexError: list index out of range How do I address this problem? Use %%. -- Jorge Godoy [EMAIL PROTECTED] Quidquid latine dictum sit, altum

Re: Getting a loop to activate a loop above it

2006-03-23 Thread adam . deprince
This is how python is supposed to work. I'm sure not what languages you have used ... it seems that you are expecting some sort rule based system like make, or prolog. Grab a cup of joe, pull up a chair and let me help you out here. Python is an imperative language, you can envision the presence

Re: Strings and % sign fails - Help Please

2006-03-23 Thread siasookhteh
heh.. It works except I am using psycopg.Binary(somebinarystructure), and I am not really doing it by hand to just add the extra %, and psycopg.Binary doesn't do it. I'd imagine it's a bug with psycopg package. Any quick way to project a string from freak '%' problems? Thanks, Sia Jorge Godoy

Re: encoding problems (é and è)

2006-03-23 Thread Jean-Paul Calderone
On Fri, 24 Mar 2006 09:33:19 +1100, John Machin [EMAIL PROTECTED] wrote: On 24/03/2006 8:36 AM, Peter Otten wrote: John Machin wrote: You can replace ALL of this upshifting and accent removal in one blow by using the string translate() method with a suitable table. Only if you convert to

Re: Convert Word .doc to Acrobat .pdf files

2006-03-23 Thread Justin Ezequiel
## this creates a postscript file which you can then convert to PDF ## using Acrobat Distiller ## ## BTW, I spent an hour trying to get this working with ## win32com.client.Dispatch ## (the save file dialog still appeared) ## Then I remembered win32com.client.dynamic.Dispatch ## ## Can somebody

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Jorge Godoy
[EMAIL PROTECTED] writes: heh.. It works except I am using psycopg.Binary(somebinarystructure), and I am not really doing it by hand to just add the extra %, and psycopg.Binary doesn't do it. I'd imagine it's a bug with psycopg package. Any quick way to project a string from freak '%'

<    1   2   3   >