Re: the python way?

2005-06-07 Thread Raymond Hettinger
import random from itertools import ifilter, ifilterfalse def reinterpolate(word): word = list(word) random.shuffle(word) isvowel = dict.fromkeys('aeiouy').has_key vowels = ifilterfalse(isvowel, word) consonants = ifilter(isvowel, word) result = [] for v, c in map(No

Re: random module question

2005-06-07 Thread Raymond Hettinger
>> Is Mersenne Twister currently available at all in Jython, for example? Googling for "java mersenne twister" provides multiple hits including: http://www.axlradius.com/freestuff/Free.htm#MT Raymond -- http://mail.python.org/mailman/listinfo/python-list

reg php.ini equivalent file in python

2005-06-07 Thread praba kar
Dear All, I have one doubt. Is there python.ini file like php.ini in Php? Actually php.ini file controls many aspects of PHP's behavior. The following details of php.ini will explain about it. max_execution_time = 5000 ; Maximum execution time of each script, in seconds (UN

Re: help with sending mail in Program

2005-06-07 Thread Fuzzyman
Ivan Shevanski wrote: > Hey i'm new here and relatively new to python. I've made a few small > programs and now I'm making a program for my friends that at the end has a > feedback form. I want to send the feedback back to my email adress. I know > I should use the SMTP module and I have figur

Re: SMTP help please

2005-06-07 Thread Simon Brunning
On 6/7/05, Ivan Shevanski <[EMAIL PROTECTED]> wrote: > I really can't figure out anything about the SMTP module. . .I think I'm in > over my head( Im pretty new to python). Can someone show me a really(and I > mean REALLY) basic tutorial for smtp or explain it?

poker card game revisited (code included)

2005-06-07 Thread flupke
Hi, i've included the code so people can take a look. I've tried to expand on the thread of 26/05/2005 on "Checking for a full house". Code is suboptimal as I coded it rather quickly. I've added the "normal" classes one would expect from a cardgame: card, deck, hand etc. 1. I can detect most thin

Re: SMTP help please

2005-06-07 Thread Martin Franklin
Ivan Shevanski wrote: > I really can't figure out anything about the SMTP module. . .I think I'm > in over my head( Im pretty new to python). Can someone show me a > really(and I mean REALLY) basic tutorial for smtp or explain it? > > program: > I want to make my program have a feedback form at

Re: the python way?

2005-06-07 Thread Greg McIntyre
I like this solution. For some reason it made me want to write a Ruby version of it. Possibly something about the title and the fact that Ruby enthusiasts are always going on about "the Ruby way". VOWELS = 'aeiouy'.split('') def reinterpolate(word) letters = word.split('').sort_by{rand} v

Re: the python way?

2005-06-07 Thread Raymond Hettinger
Doh! The ifilter() and ifilterfalse() calls should be swapped in the previous post. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about Object Oriented + functions/global vars?

2005-06-07 Thread bruno modulix
Christopher J. Bottaro wrote: (snip) > 1. The upload function is not an object. Yes it is. In Python, everything's an object. >>> ftp.storbinary.__class__.__name__ 'instancemethod' >>> ftp.storbinary.foobar = 42 Traceback (most recent call last): File "", line 1, in ? AttributeError: 'instance

Re: Question about Object Oriented + functions/global vars?

2005-06-07 Thread bruno modulix
gene tani wrote: > #include canonical design pattern advice > > longjmp(Borders or other_big_chain_bookstore) > > opt1=fopen("Oreilly's Head first design pattern","r") > opt2=fopen("design patterns book by Shalloway and trott (i think that's > their names)","r") > > another=poll("any other intro

Re: split up a list by condition?

2005-06-07 Thread Duncan Booth
Reinhold Birkenfeld wrote: > Hi, > > while writing my solution for "The python way?", I came across this > fragment: > > vees = [c for c in wlist[::-1] if c in vocals] > cons = [c for c in wlist[::-1] if c not in vocals] > > So I think: Have I overlooked a function which splits up a se

Re: SMTP help please

2005-06-07 Thread Tim Williams
- Original Message - From: "Martin Franklin" <[EMAIL PROTECTED]> > server.sendmail(fromaddr, toaddrs, msg) You can use this if you don't need to worry about whether the email was successfully sent to all recipients. Otherwise, you need something like this (untested and partly copied

Re: reg php.ini equivalent file in python

2005-06-07 Thread flamesrock
I think it depends on your os variables -- http://mail.python.org/mailman/listinfo/python-list

Re: SMTP help please

2005-06-07 Thread Tim Williams
- Original Message - From: "Tim Williams" <[EMAIL PROTECTED]> > > try: > s.close() > except > pass Typo!! That should be s.quit() not s.close() :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about Object Oriented + functions/global vars?

2005-06-07 Thread bruno modulix
flamesrock wrote: > ok, so to my knowledge, object oriented means splitting something into > the simplest number of parts and going from there. So you may want to refine your knowledge. What you're talking about is top-down functional decomposition, and it's almost the opposite of OO. OO is abou

Re: SMTP help please

2005-06-07 Thread Martin Franklin
Tim Williams wrote: > - Original Message - > From: "Tim Williams" <[EMAIL PROTECTED]> > >>try: >>s.close() >>except >>pass > > > Typo!! > > That should be s.quit() not s.close() > > :) > > > > and perhaps put into a finally: Mart -- http://mail.python.org/mailma

Re: help with sending mail in Program

2005-06-07 Thread Kent Johnson
Ivan Shevanski wrote: > Could someone send me a good tutorial for sending mail then? The one I > found is not what I'm looking for. Also please dont send me the stmp > definition cause i've looked at that enough. Here is a module I use to send mail to myself using smtplib: #!/usr/local/bin/pyt

Trouble Encoding

2005-06-07 Thread fingermark
I'm using feedparser to parse the following: Adv: Termite Inspections! Jenny Moyer welcomes you to her HomeFinderResource.com TM A "MUST See … I'm receiveing the following error when i try to print the feedparser parsing of the above text: UnicodeEncodeError: 'latin-1' codec can't encode

Re: reg php.ini equivalent file in python

2005-06-07 Thread bruno modulix
praba kar wrote: > Dear All, > > I have one doubt. Is there python.ini > file like php.ini in Php? [EMAIL PROTECTED] ~ $ python -h usage: python [option] ... [-c cmd | file | -] [arg] ... (snip) PYTHONSTARTUP: file executed on interactive startup (no default) (snip) I guess this is the clo

Re: Trouble Encoding

2005-06-07 Thread deelan
[EMAIL PROTECTED] wrote: > I'm using feedparser to parse the following: > > Adv: Termite Inspections! Jenny Moyer welcomes > you to her HomeFinderResource.com TM A "MUST See … > > I'm receiveing the following error when i try to print the feedparser > parsing of the above text: > > Unicod

Re: how to show simulation at web

2005-06-07 Thread Apoptozinho
If your problem is plotting graphics from numerical simulations perhaps this fragment of code from my learning python and mod_python may help you. def show(req): req.content_type="image/png" put,get=os.popen4('echo "set term png size 400,400 ; set out ; splot(sin(x)*cos(y))" | gnuplot') img=g

Re: separate IE instances?

2005-06-07 Thread Chris Curvey
Bummer. No change at all. (In fact, I can't even call Navigate() without throwing an error). I'm on win2k, if that makes any difference. -- http://mail.python.org/mailman/listinfo/python-list

Create our own python source repository

2005-06-07 Thread qwweeeit
Hi all, beeing almost a newbie, I am trying to learn from experts. For that reason I am collecting examples of Python sources (and Pythonic way of programming...) on a CD, ready to be searched. By now, I extracted from web (using wget) all the examples of Cookbook Python (35 Mb!). After some polis

Re: file permissions on windows XP (home)

2005-06-07 Thread Peter Hansen
barney wrote (having trouble with a file): [snip] > IOError: [Errno 13] Permission denied: "02 - New Year's Day.mp3" [snip] > I'm at a loss to understand what is going on. > > Why is python returing True from os.access? > Why isn't chmod doing anything? Check your results using os.stat() after do

Re: separate IE instances?

2005-06-07 Thread Martin Franklin
Chris Curvey wrote: > Bummer. No change at all. (In fact, I can't even call Navigate() > without throwing an error). I'm on win2k, if that makes any difference. > I could be way off, but isn't windows one of those OS's that doesn't allow you to have two instances of IEXPORE.EXE running IOW th

Re: If - Or statements

2005-06-07 Thread bruno modulix
Steven Bethard wrote: > bruno modulix wrote: (snip) >> ext = os.path.splitext(filename) > > Check the docs[1]. This should probably read: > _, ext = os.path.splitext(filename) Of course. Au temps pour moi. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p

Re: SMTP help please

2005-06-07 Thread Larry Bates
I have found that the SmtpWriter class "hides" all the complexity in creating emails like you want to send. Check it out here: http://motion.sourceforge.net/related/send_jpg.py HTH, Larry Bates Syscon, Inc. Ivan Shevanski wrote: > I really can't figure out anything about the SMTP module. . .I

how to export data from ZODB to text files

2005-06-07 Thread ls
Hi All, I looking for help with ZODB data export to text file. I have file Data.fs (file becomes from Plone CMS) and I have to display content structure, data like intro, body of article, etc and save it in to simple file. However I can't use Plone XML export because is broken, Zope Corp. set low

Re: file permissions on windows XP (home)

2005-06-07 Thread Duncan Booth
Peter Hansen wrote: >> >> Why is python returing True from os.access? >> Why isn't chmod doing anything? > > Check your results using os.stat() after doing that, perhaps? If it > shows the right values for the permissions, then clearly the problem has > nothing to do with Python per se, or yo

Re: EnumKey vs EnumValue

2005-06-07 Thread Pykid
Ok, this was not how I understood it to work earlier when I was going over this. I do want to eventually see the values under each key, so I guess if I want to see what is under each key I need to then reopen it and send that value to EnumValue. Tried that and ended up with this which seems to wo

How do I know when a thread quits?

2005-06-07 Thread Prashanth Ellina
Hi, I have used the low-level thread module to write a multi-threaded app. tid = thread.start_new_thread(process, ()) tid is an integer thread ident. the thread takes around 10 seconds to finish processing. Meanwhile the main thread finished execution and exits. This causes an error because the

Re: How do I know when a thread quits?

2005-06-07 Thread harold fellermann
Hi, > I want a reliable way of knowing when the child > thread finished execution so that I can make the main thread wait till > then. > > Any ideas? use a lock. the subthread allocates the lock and releases it after processing. the main thread must wait until the lock is released. otherwiese, u

Re: how to export data from ZODB to text files

2005-06-07 Thread Peter Hansen
ls wrote: > I looking for help with ZODB data export to text file. I have file > Data.fs > [snip] > Could you point me in to some Python code examples, code contributions > and so on. You can download the "standalone" ZODB code and run it under regular Python without Zope installed or involved,

Re: How do I know when a thread quits?

2005-06-07 Thread Peter Hansen
Prashanth Ellina wrote: > I have used the low-level thread module to write a multi-threaded app. > > tid = thread.start_new_thread(process, ()) > tid is an integer thread ident. > > the thread takes around 10 seconds to finish processing. Meanwhile the > main thread finished execution and exits.

Dr. Dobb's Python-URL! - weekly Python news and links (Jun 7)

2005-06-07 Thread Simon Brunning
QOTW: "[expletives deleted]" - John Machin, snipping a section of Perl code. "What sort of programmer are you? If it works on your computer, it's done, ship it!" - Grant Edwards Guido invites us to comment on PEP 343. This Python Enhancement Proposal includes a 'with' statement, allowin

RE: Dr. Dobb's Python-URL! - weekly Python news and links (Jun 7)

2005-06-07 Thread Tim Golden
[Simon Brunning] | Subject: Dr. Dobb's Python-URL! - weekly Python news and links (Jun 7) [... snipped whole thing ...] Just wanted to say thank you to Simon and all the other people who have edited the Python-URL! weekly digest over the years. Despite my being a pretty much constant reader of c.

Re: reloading my own modules

2005-06-07 Thread Skip Montanaro
Lowell> import dbtest, util Lowell> for module in ['dbtest', 'util']: Lowell> if module in sys.modules.keys(): Lowell> reload(sys.modules[module]) Lowell> Is this the best way to do it? It seems a bit verbose, but not Lowell> really all that bad. I was just w

Re: How do I know when a thread quits?

2005-06-07 Thread harold fellermann
we had some off-group mails. A summary is posted to improve the knowledge base of the list. Prashanth wrote: > Hi, > > I can use the threading module but I am just looking if there is a > reliable way using the thread module. > > If I use a lock... > Let us assume that the child thread has done

redirecting messgaef from sys.stdout

2005-06-07 Thread Ahmad Hosseinzadeh
Hello, I’m trying to run an external program in my application. Both are coded in python. I need to write an independent module that is used in the main application. Its responsibility is to run the external program and redirect its stdout and stderr to the main application. The application’s stdo

re:how to export data from ZODB to text files

2005-06-07 Thread ls
Hi Peter, Thank you for your reply. I already can access file using code >>> from ZODB import FileStorage, DB >>> storage = FileStorage.FileStorage('mydatabase.fs') >>> db = DB(storage) >>> connection = db.open() >>> root = connection.root() But this is the point

Re: redirecting messgaef from sys.stdout

2005-06-07 Thread harold fellermann
On 07.06.2005, at 16:43, Ahmad Hosseinzadeh wrote: > Hello, > > I’m trying to run an external program in my > application. Both are coded in python. I need to write > an independent module that is used in the main > application. Its responsibility is to run the external > program and redirect its

Re: Create our own python source repository

2005-06-07 Thread Rob Cowie
I'm not entirely sure what the point of your exercise is - if you have access to the net, ,why do you want to collate code examples? They are frequently updated in the cookbook so an offline repository would quickly become out of date. However you've aroused my interest in something related. W

ANN: ActivePython 2.4.1 for Mac OS X is now available!

2005-06-07 Thread Trent Mick
Today ActiveState is announcing support for Mac OS X. I'm happy to announce that ActivePython 2.4.1 for Mac OS X is now available for free download from: http://www.ActiveState.com/Products/ActivePython/ This brings the number of free ActivePython platforms to four -- with the existing Linu

Embedding Python in Multi-threading App. Any Guidelines, Hints, Recipes ??

2005-06-07 Thread adsheehan
Hi, I am embedding Python into a multi-threaded application running on Solaris. Python will enable end users to customize and re-program many aspects of the application. I expect that the C++ application will be natively multi-threaded and will embed multiple Python sub-interpreters. Called Pytho

Re: ANN: ActivePython 2.4.1 for Mac OS X is now available!

2005-06-07 Thread John Abel
Trent Mick wrote: >Today ActiveState is announcing support for Mac OS X. I'm happy to >announce that ActivePython 2.4.1 for Mac OS X is now available for free >download from: > >http://www.ActiveState.com/Products/ActivePython/ > >This brings the number of free ActivePython platforms to four

Re: anygui,anydb, any opinions?

2005-06-07 Thread Thomas Bartkus
"James Tanis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Previously, on Jun 6, Thomas Bartkus said: > > # "James Tanis" <[EMAIL PROTECTED]> wrote in message > # news:[EMAIL PROTECTED] > # > > # > > # > My 2 cents, I'm much more productive with Python and QT Builder as I > # > am

Re: If - Or statements

2005-06-07 Thread Patrick Down
What about: if True in [thefile.endswith(x) for x in ('mp3','mp4','ogg','aac','wma')]: -- http://mail.python.org/mailman/listinfo/python-list

Dr. Dobb's Python-URL! - weekly Python news and links (Jun 7)

2005-06-07 Thread Simon Brunning
QOTW: "[expletives deleted]" - John Machin, snipping a section of Perl code. "What sort of programmer are you? If it works on your computer, it's done, ship it!" - Grant Edwards Guido invites us to comment on PEP 343. This Python Enhancement Proposal includes a 'with' statement, allowin

School Administration Software

2005-06-07 Thread Greg Lindstrom
Hello- I just picked up my daughters' report cards for the year (they did well, thank-you) and was approached by the school administrator about writing an Acess application to help track attendance for next year (excused/unexcused, after so many unexcused absences a letter will be generated, e

time consuming loops over lists

2005-06-07 Thread querypk
X-No-Archive: yes Can some one help me improve this block of code...this jus converts the list of data into tokens based on the range it falls into...but it takes a long time.Can someone tell me what can i change to improve it... def Tkz(tk,data): no_of_bins = 10 tkns = [] dmax = ma

Re: time consuming loops over lists

2005-06-07 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: X-No-Archive: yes Can some one help me improve this block of code...this jus converts the list of data into tokens based on the range it falls into...but it takes a long time.Can someone tell me what can i change to improve it... if data[i] in xrange(r

Re: How do I know when a thread quits?

2005-06-07 Thread dowskimania
I'm no threads expert, but if you use the higher-level "threading" module, you could try something like this: import threading import time def countToTen(): for i in range(1,11): print i time.sleep(0.5) child = threading.Thread(target=countToTen) class ma

Re: Reading a CSV file into a list of dictionaries

2005-06-07 Thread GMane Python
Sounds like you want to use the ConfigObject module. http://www.voidspace.org.uk/python/modules.shtml#configobj -dave "RFQ" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, I'm struggling here to do the following with any success: > > I have a comma delimited file where each lin

Re: time consuming loops over lists

2005-06-07 Thread querypk
wow i dint know that a single statement like that would make such a difference. Thanks you very much. that really improves the performance -- http://mail.python.org/mailman/listinfo/python-list

Re: time consuming loops over lists

2005-06-07 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Can some one help me improve this block of code...this jus converts the > list of data into tokens based on the range it falls into...but it > takes a long time.Can someone tell me what can i change to improve > it... > > def Tkz(tk,data): > no_of_bins = 10 >

Re: School Administration Software

2005-06-07 Thread [EMAIL PROTECTED]
Greg Lindstrom wrote: > Hello- > [snip] > So...do any of you have experience with any of this software? This is > for a small (~400 students k-12), private school that is not swimming in > taxpayer dollars and I would rather use Open Source because we will > probably need to customize some reports

xmlrpclib - methodHelp doesn't work

2005-06-07 Thread [EMAIL PROTECTED]
I tried out the examples in this website for XML-RPC using python - http://www.onlamp.com/pub/a/python/2000/11/22/xmlrpcclient.html?page=2 But I get the following errors when I try to execute the code. Here is the snippet of the code with the error messages. >>> meerkatsvr.system.methodSignature

Re: separate IE instances?

2005-06-07 Thread Chris Curvey
I would have given up on this a long time ago, but I can create two IEXPLORE processes simultaneously (and get the behavior I want) by just manually launching them from the Start menu. (Of course, that doesn't mean that I can launch them programmatically, but I'm hoping that someone can give me a

DB API 2.0 and transactions

2005-06-07 Thread Christopher J. Bottaro
Hi, Why is there no support for explicit transactions in the DB API? I mean like transaction() to start the trans and commit() and rollback() would end the trans or something. The reason why I ask is because I wrote a daemon that interacts with a Postgres DB. The value of CURRENT_TIMESTAMP accor

Re: xmlrpclib - methodHelp doesn't work

2005-06-07 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > I tried out the examples in this website for XML-RPC using python - > http://www.onlamp.com/pub/a/python/2000/11/22/xmlrpcclient.html?page=2 > But I get the following errors when I try to execute the code. Here is > the snippet of the code with the error messages. me

Re: What are OOP's Jargons and Complexities?

2005-06-07 Thread Xah Lee
The Rise of Class Hierarchy Because of psychological push for purity, in Java there are no longer plain subroutines. Everything is a method of some class. Standard functions like opening a file, square root a number, for loop thru a list, if else branching statements, or simple arithmetic operatio

different time tuple format

2005-06-07 Thread Maksim Kasimov
hi all, sorry if i'm reposting why time.strptime and time.localtime returns tuple with different DST (9 item of the tuple)? is there some of setting to fix the problem? Python 2.2.3 (#1, May 31 2005, 11:33:52) [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4 Type "help", "copyright", "credits" or "l

How to call python functions from matlab?

2005-06-07 Thread sdhyok
PyMat enables to call matlab functions from python. But, what I want is to call python functions from matlab. Is there any library for it? Thanks. Daehyok Shin -- http://mail.python.org/mailman/listinfo/python-list

How to maintain scroll-region view while changing canvas size?

2005-06-07 Thread syed_saqib_ali
Please take a look at and run the code snippet shown below. It creates a canvas with vertical & Horizontal scroll-bars. If you shrink the window to smaller than the area of the canvas, the scroll-bars work as advertised. That's great. However, if you click the Left Mouse button, it calls code w

Re: separate IE instances?

2005-06-07 Thread J Correia
"Chris Curvey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would have given up on this a long time ago, but I can create two > IEXPLORE processes simultaneously (and get the behavior I want) by just > manually launching them from the Start menu. (Of course, that doesn't > mean

Re: Create our own python source repository

2005-06-07 Thread qwweeeit
Hi Rob, thank you for your reply. I am further commenting on your doubts ("I'm not entirely sure what the point of your exercise is") and on your proposal of a project for more structured tutorials. About the second item, I fully agree with you. I should be even more drastic: for a certain argumen

Re: different time tuple format

2005-06-07 Thread [EMAIL PROTECTED]
http://docs.python.org/lib/module-time.html tells us the last element is the DST flag, on your computer that applies for localtime(). To get this with strptime() you have to tweak the %Z formatter - this is platform specific. -- http://mail.python.org/mailman/listinfo/python-list

Wxpython demo crashes

2005-06-07 Thread Pekka Karjalainen
I'm using WinXP (Finnish), Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 and wxPython 2.6.0.1. When I go to the Process and Events section in the wxDemo and run the Process demo, bad things can happen. It crashes. I think the crash is caused by characters outside t

Re: poker card game revisited (code included)

2005-06-07 Thread Erik Max Francis
flupke wrote: > i've included the code so people can take a look. > I've tried to expand on the thread of 26/05/2005 on "Checking for a full > house". Code is suboptimal as I coded it rather quickly. > I've added the "normal" classes one would expect from a cardgame: card, > deck, hand etc. > > 1

Re: different time tuple format

2005-06-07 Thread Rick Holbert
Like the last poster said, use %Z. On my Mandriva Linux system I get the following results: >>> time.localtime() (2005, 6, 7, 15, 7, 12, 1, 158, 1) >>> time.strptime("2005-06-07 15:07:12 EDT", "%Y-%m-%d %H:%M:%S %Z") (2005, 6, 7, 15, 7, 12, 1, 158, 1) Rick Maksim Kasimov wrote: > hi all, sorry

Re: the python way?

2005-06-07 Thread Reinhold Birkenfeld
Andrew Dalke wrote: > Reinhold Birkenfeld wrote: >> To make it short, my version is: >> >> import random >> def reinterpolate2(word, vocals='aeiouy'): >> wlist = list(word) >> random.shuffle(wlist) >> vees = [c for c in wlist[::-1] if c in vocals] >> cons = [c for c in wlist[::-1]

programmnig advise needed

2005-06-07 Thread mitsura
Hi, I am writing a Python program that needs to read XML files and contruct a tree object from the XML file (using wxTree). The XML however is not an hiearchical XML file. It contains and tags. The tags link the elements together. Example: ... element 1 attributes ... element 2 attribute

Re: DB API 2.0 and transactions

2005-06-07 Thread vincent wehren
"Christopher J. Bottaro" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] | Hi, | Why is there no support for explicit transactions in the DB API? I mean | like transaction() to start the trans and commit() and rollback() would end | the trans or something. | | The reason why I as

Re: different time tuple format

2005-06-07 Thread Maksim Kasimov
Rick Holbert wrote: > Like the last poster said, use %Z. On my Mandriva Linux system I get the > following results: > > time.localtime() > > (2005, 6, 7, 15, 7, 12, 1, 158, 1) > time.strptime("2005-06-07 15:07:12 EDT", "%Y-%m-%d %H:%M:%S %Z") > (2005, 6, 7, 15, 7, 12, 1, 158, 1) does

Re: split up a list by condition?

2005-06-07 Thread Reinhold Birkenfeld
Raymond Hettinger wrote: >>> while writing my solution for "The python way?", I came across this >>> fragment: >>> vees = [c for c in wlist[::-1] if c in vocals] >>> cons = [c for c in wlist[::-1] if c not in vocals] >>> >>> So I think: Have I overlooked a function which splits up a sequence >>> i

Re: split up a list by condition?

2005-06-07 Thread Reinhold Birkenfeld
Duncan Booth wrote: > Reinhold Birkenfeld wrote: > >> Hi, >> >> while writing my solution for "The python way?", I came across this >> fragment: >> >> vees = [c for c in wlist[::-1] if c in vocals] >> cons = [c for c in wlist[::-1] if c not in vocals] >> >> So I think: Have I overlooke

Re: different time tuple format

2005-06-07 Thread [EMAIL PROTECTED]
In your case it is the EEST, as this is the DST timezone (see again: http://docs.python.org/lib/module-time.html) ** [EMAIL PROTECTED]:~ $ python ** Python 2.4.1 (#2, Mar 30 2005, 21:51:10) ** [GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2 ** Type "help", "copyright", "credits" or "license" for m

Re: Wxpython demo crashes

2005-06-07 Thread Greg Krohn
Pekka Karjalainen wrote: > I'm using WinXP (Finnish), Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC > v.1310 32 bit (Intel)] on win32 and wxPython 2.6.0.1. > > When I go to the Process and Events section in the wxDemo and run the > Process demo, bad things can happen. It crashes. I think the cras

Re: Reading a CSV file into a list of dictionaries

2005-06-07 Thread Laurent RAHUEL
RFQ wrote: > Hi, I'm struggling here to do the following with any success: > > I have a comma delimited file where each line in the file is something > like: > > PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,... This is NOT a CSV file. A CSV file would be : PNumber,Contracto

Re: split up a list by condition?

2005-06-07 Thread Grooooops
> vees, cons = [], [] > [(vees, cons)[ch in vocals].append(ch) for ch in wlist] Wow, that's horribly twisted Reinhold... I spent about an hour last night trying something similar, to no end... :) Neat tricks people... I like Duncan's use of "or" to solve it. I didn't see that in the python docs o

Re: Trouble Encoding

2005-06-07 Thread fingermark
why is it even trying latin-1 at all? I don't see it anywhere in feedparser.py or my code. deelan wrote: > [EMAIL PROTECTED] wrote: > > I'm using feedparser to parse the following: > > > > Adv: Termite Inspections! Jenny Moyer welcomes > > you to her HomeFinderResource.com TM A "MUST See …

Re: Help with SMTP

2005-06-07 Thread Ivan Shevanski
Ok, all my problems are solved except for one. . .If I want my program to send a message back to me do I need the from adress? Because I don't specifically know it for the person using the program. Any help is appreciated =D -Ivan ___

Re: split up a list by condition?

2005-06-07 Thread Paul McGuire
Re-run this with the input string "The quick brown fox is named 'Aloysius'." and we discover that 'A', 'y', "'" and '.' are also consonants. (Actually, this is bug-compatible with the OP's original example.) -- Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a CSV file into a list of dictionaries

2005-06-07 Thread John Machin
Laurent RAHUEL wrote: > RFQ wrote: > > >>Hi, I'm struggling here to do the following with any success: >> >>I have a comma delimited file where each line in the file is something >>like: >> >>PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,... > > > This is NOT a CSV file. A CS

import error using BOOST in linux

2005-06-07 Thread GujuBoy
i am using BOOST in linux with python and i can compile my CPP file just fine to make a .so but everytime i do a import i get this error >>> import dirgesh Traceback (most recent call last): File "", line 1, in ? ImportError: libboost_python.so.1.32.0: cannot open shared object file: No such fil

Re: ANN: ActivePython 2.4.1 for Mac OS X is now available!

2005-06-07 Thread Trent Mick
> Trent Mick wrote: > >Meanwhile, some of you may be interested to know that we are busily > >working on bringing Komodo to Mac OS X. We expect to offer a beta in > >August and release later this year. [John Abel wrote] > Komodo for OSX? Now that's something I would be interested in > purchasing.

Re: Trouble Encoding

2005-06-07 Thread Jarek Zgoda
[EMAIL PROTECTED] napisał(a): > why is it even trying latin-1 at all? I don't see it anywhere in > feedparser.py or my code. Check your site.py or sitecustomize.py module, you can have non-standard default encoding set there. -- Jarek Zgoda http://jpa.berlios.de/ | http://www.zgodowie.org/ --

Re: separate IE instances?

2005-06-07 Thread J Correia
> "Chris Curvey" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > I would have given up on this a long time ago, but I can create two > > IEXPLORE processes simultaneously (and get the behavior I want) by just > > manually launching them from the Start menu. (Of course, that does

Re: split up a list by condition?

2005-06-07 Thread Andrew Dalke
Reinhold Birkenfeld wrote: >>> So I think: Have I overlooked a function which splits up a sequence >>> into two, based on a condition? Such as >>> >>> vees, cons = split(wlist[::-1], lambda c: c in vocals) > This is clear. I actually wanted to know if there is a function which I > overlooked whic

Re: file permissions on windows XP (home)

2005-06-07 Thread barney
Thanks, I tried creating a test file but I get "Access is denied" from windows explorer! The folder appears to be read only but when I try and uncheck read only/apply/repopen the folder properties its still read only. This read only flag seems to propagate down from the My Music directory but unch

Re: time consuming loops over lists

2005-06-07 Thread Andrea Griffini
On Tue, 07 Jun 2005 18:13:01 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >Another optimization im too lazy now would be to do sort of a "tree >search" of data[i] in rngs - as the ranges are ordered, you could find >the proper one in log_2(len(rngs)) instead of len(rngs)/2. I don't see

Re: poker card game revisited (code included)

2005-06-07 Thread flupke
Erik Max Francis wrote: > flupke wrote: > First of all, my apologies for the double posts. I can only see this reply and can't see my original messages. I posted the message from home and work and they didn't show up. We use the same isp at home and at work so it's probably a problem on their

Re: SMTP help please

2005-06-07 Thread Ivan Shevanski
>From: Larry Bates <[EMAIL PROTECTED]> >To: Ivan Shevanski <[EMAIL PROTECTED]> >Subject: Re: SMTP help please >Date: Tue, 07 Jun 2005 07:39:01 -0500 > >I have found that the SmtpWriter class "hides" all the >complexity in creating emails like you want to send. > >Check it out here: > >http://moti

Re: Trouble Encoding

2005-06-07 Thread John Roth
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm using feedparser to parse the following: > > Adv: Termite Inspections! Jenny Moyer welcomes > you to her HomeFinderResource.com TM A "MUST See … > > I'm receiveing the following error when i try to print the feedparser > pars

Re: time consuming loops over lists

2005-06-07 Thread Diez B. Roggisch
> I don't see a "break" so why the "/2" ? also IIUC the That was the assumption of an equal distribution of the data. In O-notationn this would be O(n) of course. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a CSV file into a list of dictionaries

2005-06-07 Thread Laurent RAHUEL
John Machin wrote: > Laurent RAHUEL wrote: >> RFQ wrote: >> >> >>>Hi, I'm struggling here to do the following with any success: >>> >>>I have a comma delimited file where each line in the file is something >>>like: >>> >>>PNumber,3056,Contractor,XYZ Contracting,Architect,ABC Architects,... >> >

Re: programmnig advise needed

2005-06-07 Thread Andrea Griffini
On 7 Jun 2005 12:14:45 -0700, [EMAIL PROTECTED] wrote: >I am writing a Python program that needs to read XML files and contruct >a tree object from the XML file (using wxTree). Supposing your XML file has a single top level node (so that it's a legal XML file) then the following code should be ab

Re: time consuming loops over lists

2005-06-07 Thread John Machin
Diez B. Roggisch wrote: > [EMAIL PROTECTED] wrote: > >> X-No-Archive: yes >> Can some one help me improve this block of code...this jus converts the >> list of data into tokens based on the range it falls into...but it >> takes a long time.Can someone tell me what can i change to improve >> it...

Re: time consuming loops over lists

2005-06-07 Thread Andrea Griffini
On Tue, 07 Jun 2005 23:38:29 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> I don't see a "break" so why the "/2" ? also IIUC the > >That was the assumption of an equal distribution of the data. In >O-notationn this would be O(n) of course. It was a joke ... the issue is that there was

  1   2   >