Re: python list handling and Lisp list handling

2009-04-25 Thread namekuseijin
On Apr 26, 1:31 am, Steven D'Aprano wrote: > On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: > > That's because Python lists aren't lists. > > Surely you meant to say that Lisp lists aren't lists? > > It-all-depends-on-how-you-define-lists-ly y'rs, Yeah, the List Processing language got it

Re: python list handling and Lisp list handling

2009-04-25 Thread namekuseijin
On Apr 25, 4:34 am, Michele Simionato wrote: > which has some feature you may like. For instance, > there is a weak form of pattern matching built-in: > > >>> head, *tail = [1,2,3] # Python 3.0 only! > >>> head > 1 > >>> tail > > [2, 3] Good seeing yet another long time Perl feature finally broug

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread namekuseijin
Ciprian Dorin, Craciun wrote: On Sun, Apr 26, 2009 at 7:54 AM, Steven D'Aprano wrote: I liked very much your implementation for the compare function, it is very short and at the same time readable: def compare(a, b, comp=operator.eq): return (len(a) == len(b)) and all(comp(*t) for t in

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ciprian Dorin, Craciun
On Sun, Apr 26, 2009 at 8:11 AM, Steven D'Aprano wrote: > On Sat, 25 Apr 2009 10:30:56 +0200, Martin v. Löwis wrote: > >     Ok... Then what's pythonic? Please give a pythonic >     implementation... Use the builtin a==b, similar to (equal a b) >>> >>>     But how about extensibility?

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ciprian Dorin, Craciun
On Sun, Apr 26, 2009 at 7:54 AM, Steven D'Aprano wrote: > On Sat, 25 Apr 2009 10:50:50 +0300, Ciprian Dorin, Craciun wrote: > >> On Sat, Apr 25, 2009 at 10:43 AM,   wrote: >>> Ciprian Dorin, Craciun: Python way: - def eq (a, b) :     return a == b def compare

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread namekuseijin
Paul Rubin wrote: Python tries to be simple and pragmatic while not aiming for as heavy-duty applications as Common Lisp. Scheme is more of a research language that's way past its prime. If you like Scheme, you should try Haskell. Python has the motto "practicality beats purity". With Haskell,

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread anonymous . c . lisper
On Apr 25, 2:06 am, Carl Banks wrote: > In answering the recent question by Mark Tarver, I think I finally hit > on why Lisp programmers are the way they are (in particular, why they > are often so hostile to the "There should only be one obvious way to > do it" Zen). > > Say you put this task to

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Steven D'Aprano
On Sat, 25 Apr 2009 10:30:56 +0200, Martin v. Löwis wrote: Ok... Then what's pythonic? Please give a pythonic implementation... >>> Use the builtin a==b, similar to (equal a b) >> >> But how about extensibility? > > == is extensible. To compare two things for equality, use

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Steven D'Aprano
On Sat, 25 Apr 2009 10:50:50 +0300, Ciprian Dorin, Craciun wrote: > On Sat, Apr 25, 2009 at 10:43 AM, wrote: >> Ciprian Dorin, Craciun: >>> Python way: >>> - >>> def eq (a, b) : >>>     return a == b >>> >>> def compare (a, b, comp = eq) : >>>     if len (a) != len (b) : >>>         retu

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Michele Simionato
On Apr 25, 10:26 pm, Carl Banks wrote: > I totally disagree.  Scheme might be a pure language with no > compromises and impurities, but Common Lisp is certainly not. I can assure you that even Scheme is a language full of compromises and inconsistencies :-/ Michele, who is now writing a book a

Re: python list handling and Lisp list handling

2009-04-25 Thread Steven D'Aprano
On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: > That's because Python lists aren't lists. Surely you meant to say that Lisp lists aren't lists? It-all-depends-on-how-you-define-lists-ly y'rs, -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Steven D'Aprano
On Fri, 24 Apr 2009 23:06:30 -0700, Carl Banks wrote: > Lisp programmer: > > Well, there is a standard function called mismatch that does it, but I > can't recommend it. First of all, you don't know where that function's > been. Anyone and their mother could have worked on it, did they have >

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread namekuseijin
That was amusing, but that's not a question of Lisp vs Python programmers, just one of fun vs practicality. Mark Tarver is the implementor of Qi, a higher order Lisp of sorts. He's writing a compiler from Qi to Python and was learning Python along the way. He's having fun with it, not writin

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread namekuseijin
Paul Rubin wrote: Carl Banks writes: Python programmer: a == b. Next question. in lisp you'd use (equal a b) I see you walk both sides. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread John Yeung
On Apr 25, 9:05 pm, Mark Wooding wrote: > Carl Banks writes: > > Graham, for his part, doesn't seem to appreciate that > > what he does is beyond hope for average people, and > > that sometimes reality requires average people to write > > programs. > > I think he understands that perfectly well.

Re: Minimal binary diff & version control in Python?

2009-04-25 Thread Chris Rebert
On Sat, Apr 25, 2009 at 7:47 PM, Kevin Ar18 wrote: > > 2. Has anyone ever tried to implement some form of version control in Python > (if so, where)? Both Bazaar (http://bazaar-vcs.org/) and Mercurial (http://www.selenic.com/mercurial/wiki/), two popular distributed VCS-es, are written in Python

Minimal binary diff & version control in Python?

2009-04-25 Thread Kevin Ar18
This is a two part question: 1. Is there a minimal binary diff comparison library for Python (like difflib, but able to create a minimal diff)? 2. Has anyone ever tried to implement some form of version control in Python (if so, where)? I was just wonder about creating something small to ha

GoEar Mp3 download system

2009-04-25 Thread Carlos Schwarz Júnior
I developed an application using pyGTK to download the MP3 music that are hosted on GoEar http://www.goear.com/. It's not totally finished, but the main functions are working and some other interesting features too. It works well in Windows and Linux (not tested in MAC). To download: http://cod

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread Lawrence D'Oliveiro
In message <_vqdnf6pny1gymzunz2dnuvz_qcdn...@posted.visi>, Grant Edwards wrote: > ... if one didn't care about backwards-compatiblity with old e-mail > apps, then one would use a less broken mailbox format like > maildir. It's only in the proprietary-software world that we need to worry about b

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Carl Banks
On Apr 25, 6:05 pm, Mark Wooding wrote: > Carl Banks writes: > > Graham, for his part, doesn't seem to appreciate that what he does is > > beyond hope for average people, and that sometimes reality requires > > average people to write programs. > > I think he understands that perfectly well.  But

Re: PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-25 Thread Cameron Simpson
On 25Apr2009 14:07, "Martin v. Löwis" wrote: | Cameron Simpson wrote: | > On 22Apr2009 08:50, Martin v. Löwis wrote: | > | File names, environment variables, and command line arguments are | > | defined as being character data in POSIX; | > | > Specific citation please? I'd like to check the spe

Re: python list handling and Lisp list handling

2009-04-25 Thread Mark Wooding
Mark Tarver writes: > But are Python lists also indistinguishable from conventional > Lisplists for list processing. > > For example, can I modify a Python list non-destructively? No. > Are they equivalent to Lisp lists. Can CAR and CDR in Lisp be thought > of as > > def car (x): > return

Re: Weird lambda behavior (bad for)

2009-04-25 Thread namekuseijin
The real issue here has nothing to do with closures, lexical capture or anything like that. It's a long known issue called side-effects. Trying to program in a functional style in the presence of side-effects is bad. *for* is the main perpetrator of side-effects here, because it updates its

Re: __import__ function broken in 2.6

2009-04-25 Thread Carl Banks
On Apr 25, 2:37 pm, Paul wrote: > It seems in 2.6 you are no longer able to use the __import__ function > with different paths. That functionality was deliberately removed, since it was never intended to be present in the first place, and it only "worked" before by accident. To get that behavior

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Mark Wooding
Carl Banks writes: > Graham, for his part, doesn't seem to appreciate that what he does is > beyond hope for average people, and that sometimes reality requires > average people to write programs. I think he understands that perfectly well. But I think he believes that the sorts of tools which

Re: debugging in IPython

2009-04-25 Thread Esmail
I seem to recall something about starting up the python (and ipython) interpreter with the -i flag, but I am not certain. There is a ipython mailing list/user group too, you may want to post your query there too. Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: New at Python, some trouble with examples

2009-04-25 Thread Kevin Forbes VK3KUF
[snip] >> >> Oh, and I had to rename the Python26.dll to Python25.dll for Delphi to >> operate. ??? >> > [snip] > The fact that you had to rename to Python25.dll suggests that Delphi is > expecting Python 2.5. You might want to download Python 2.5 (actually > Python 2.5.4) instead to see whether

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread Lawrence D'Oliveiro
In message <49f33d8d$0$516$bed64...@news.gradwell.net>, tinn...@isbd.co.uk wrote: > mbox has several advantages over maildir (for me anyway):- > > It allows easy removal of empty mailboxes (in my case by the MUA) Really? I just created a "junk" mail folder via my IMAP server using Thunderb

Re: python list handling and Lisp list handling

2009-04-25 Thread Rhodri James
On Sat, 25 Apr 2009 08:07:19 +0100, Mark Tarver wrote: OK; I guess the answer to the question "Assuming the following Python encodings, and ignoring questions of performance, would Python and Lisp lists then be observationally indistinguishable? i.e. would these then be fair encodings?" is

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Rhodri James
On Sat, 25 Apr 2009 13:32:21 +0100, Ciprian Dorin, Craciun wrote: Should I update the __eq__ method (for str class) and break almost everything? Can I write now a == b? Should you instead, perhaps, write a case-insensitive string class, since seems to be what your data is asking for?

Re: __import__ function broken in 2.6

2009-04-25 Thread Dave Angel
Paul wrote: Hi It seems in 2.6 you are no longer able to use the __import__ function with different paths. Here is our code: sys.path = g.origSysPath[:] # copy, not reference sys.path.insert(0, modulePath) sys.modules = g.origSysModules.copy()

Re: how to suspend program and save state data in python or IDLE?

2009-04-25 Thread Dave Angel
ja...@biosci.utexas.edu wrote: hi! i'm running computationally-intensive python programs for a student project, and i have a couple of questions. 1) how can i suspend program execution for brief periods either in python or through IDLE; and 2) is there a way to save state data so that if i

Re: __import__ function broken in 2.6

2009-04-25 Thread Paul
We found a quick workaround to make import work with paths. We just append the folder we want to the system's path: sys.path.append( moduleFolder ) If anyone has a better solution, that would be great. Until then, this is ugly, but it works. -- http://mail.python.org/mailman/listi

Re: best way to compare contents of 2 lists?

2009-04-25 Thread Esmail
norseman wrote: Of course each method has its time and place of use and Python has some well oiled list search and list maintain routines of its own. List comparisons are most accurate when using presorted ones. (Some things don't lend themselves to sorting very well. Like paragraphs, books,

Re: confused with so many python package locations for imports

2009-04-25 Thread Ben Finney
Chris Rebert writes: > Erm, .pyo-s aren't platform-specific. […] > It's not like .pyo-s are compiled C extension modules. Thank you for the correction. Please mentally substitute into my argument the files that *are* compiled C extension modules; it remains otherwise unchanged. -- \“

Re: how to suspend program and save state data in python or IDLE?

2009-04-25 Thread Chris Rebert
On Sat, Apr 25, 2009 at 3:18 PM, wrote: > hi! i'm running computationally-intensive python programs for a student > project, and i have a couple of questions. > > 1) how can i suspend program execution for brief periods either in python or > through IDLE; Ctrl+Z on Unix shells will stop program

how to suspend program and save state data in python or IDLE?

2009-04-25 Thread james
hi! i'm running computationally-intensive python programs for a student project, and i have a couple of questions. 1) how can i suspend program execution for brief periods either in python or through IDLE; and 2) is there a way to save state data so that if i have to quit running a progra

Re: Thread lag

2009-04-25 Thread Yann Leboulanger
Piet van Oostrum wrote: >> Asterix (A) a écrit: > >> A> Hi, >> A> Here is a small class I use in my GTK application, to do some job in a >> A> thread.: > >> A> class ThreadInterface: >> A>def __init__(self, func, func_args, callback, callback_args): >> A> '''Call a function in a th

Re: PyQt4 - widget signal trouble

2009-04-25 Thread Marco Bizzarri
On Fri, Apr 24, 2009 at 7:37 PM, Joacim Thomassen wrote: > Hello, > > I'm trying to get my first PyQt4 application to work as intended, but it > seems I'm stuck and out of ideas for now. > > The program is a simple GUI showing an image. If the image on disk change > my intension is that the displa

__import__ function broken in 2.6

2009-04-25 Thread Paul
Hi It seems in 2.6 you are no longer able to use the __import__ function with different paths. Here is our code: sys.path = g.origSysPath[:] # copy, not reference sys.path.insert(0, modulePath) sys.modules = g.origSysModules.copy()

Re: confused with so many python package locations for imports

2009-04-25 Thread Chris Rebert
On Sat, Apr 25, 2009 at 1:31 AM, Ben Finney wrote: > Krishnakant writes: > >> My Basic question is that, what package directory is Standard as far >> as all gnu/linux distros are concerned? > > Python has a habit of generating, and expecting to find, > platform-specific files (‘foo.pyo’ extension

Re: Marshal vs pickle...

2009-04-25 Thread Lawson English
Lawson English wrote: Marshalling is only briefly mentioned in most python books I have, and "pickling" is declared teh preferred method for serialization. I read somewhere that Marshalling is version-dependent while pickling is not, but can't find that reference. OTOH, pickling can lead to l

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ciprian Dorin, Craciun
On Sat, Apr 25, 2009 at 11:36 PM, Brett Hoerner wrote: > On Apr 25, 8:11 am, "Ciprian Dorin, Craciun" > wrote: >>     Well in fact I would have written it like: >> >> def validate_commandline(rexes, line) : >>     if not compare (rexes, line, re.match) : >>         if len (rexes) != len (line) :

Re: Marshal vs pickle...

2009-04-25 Thread Erik Max Francis
Lawson English wrote: Marshalling is only briefly mentioned in most python books I have, and "pickling" is declared teh preferred method for serialization. I read somewhere that Marshalling is version-dependent while pickling is not, but can't find that reference. OTOH, pickling can lead to lo

Re: Marshal vs pickle...

2009-04-25 Thread Benjamin Peterson
Lawson English cox.net> writes: > > Marshalling is only briefly mentioned in most python books I have, and > "pickling" is declared teh preferred method for serialization. > > I read somewhere that Marshalling is version-dependent while pickling is > not, but can't find that reference. OTOH,

Re: python list handling and Lisp list handling

2009-04-25 Thread Carl Banks
On Apr 25, 12:07 am, Mark Tarver wrote: > On 25 Apr, 05:01, Carl Banks wrote: > > > > > On Apr 24, 8:19 am, Mark Tarver wrote: > > > > This page says that Python lists are often flexible arrays > > > >http://www.brpreiss.com/books/opus7/html/page82.html > > > > but also says that their represent

Re: Python not importing mysqldb

2009-04-25 Thread 83nini
On 25 Apr, 18:35, Marco Bizzarri wrote: > On Fri, Apr 24, 2009 at 10:04 PM, 83nini <83n...@gmail.com> wrote: > > hi guys, > > > i've been sweating the whole day trying to make python work with mysql > > but in vain! > > i'm doing the following: > > 1. visitinghttp://sourceforge.net/projects/mysql-

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Brett Hoerner
On Apr 25, 8:11 am, "Ciprian Dorin, Craciun" wrote: >     Well in fact I would have written it like: > > def validate_commandline(rexes, line) : >     if not compare (rexes, line, re.match) : >         if len (rexes) != len (line) : >             raise ValueError ("mismatch len") >         mismatc

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Carl Banks
On Apr 25, 1:44 am, "Ciprian Dorin, Craciun" wrote: > On Sat, Apr 25, 2009 at 11:30 AM, "Martin v. Löwis" > wrote: > >     Ok... Then what's pythonic? Please give a pythonic implementation... > >>> Use the builtin a==b, similar to (equal a b) > > >>     But how about extensibility? > > [...

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Carl Banks
On Apr 25, 12:36 am, John Yeung wrote: > On Apr 25, 2:06 am, Carl Banks wrote: > > > In answering the recent question by Mark Tarver, I think I finally hit > > on why Lisp programmers are the way they are (in particular, why they > > are often so hostile to the "There should only be one obvious w

Re: Thread lag

2009-04-25 Thread Piet van Oostrum
> Asterix (A) a écrit: >A> Hi, >A> Here is a small class I use in my GTK application, to do some job in a >A> thread.: >A> class ThreadInterface: >A>def __init__(self, func, func_args, callback, callback_args): >A> '''Call a function in a thread and then call callback''' >A>

Re: Marshal vs pickle...

2009-04-25 Thread Paul Rubin
Lawson English writes: > I read somewhere that Marshalling is version-dependent while pickling > is not, but can't find that reference. It is in the python library docs for the marshal module. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Paul Rubin
Hrvoje Niksic writes: > I guess you meant map(a, str.upper) == map(b, str.upper)? a and b are > lists of strings. Oh, sorry. Yes, either map(str.upper, a) == map(str.upper, b) or all(str.upper(x)==str.upper(y) for x,y in zip(a,b)) -- http://mail.python.org/mailman/listinfo/python-li

Re: Marshal vs pickle...

2009-04-25 Thread Pascal Chambon
Hello I've never run into a discussion on pickle vs marshal, but clearly if the point is to exchange data between different clients, or to store it, pickle is the preferred solution, as masrhal is really too low level and its format too unstable. Indeed, the problem of pickle is that at the co

Marshal vs pickle...

2009-04-25 Thread Lawson English
Marshalling is only briefly mentioned in most python books I have, and "pickling" is declared teh preferred method for serialization. I read somewhere that Marshalling is version-dependent while pickling is not, but can't find that reference. OTOH, pickling can lead to loading of malicious cod

Thread lag

2009-04-25 Thread Asterix
Hi, Here is a small class I use in my GTK application, to do some job in a thread.: class ThreadInterface: def __init__(self, func, func_args, callback, callback_args): '''Call a function in a thread and then call callback''' def thread_function(func, func_args, callback, callback_

Re: PyQt4 - widget signal trouble

2009-04-25 Thread Joacim Thomassen
Den Fri, 24 Apr 2009 22:24:46 +0100, skrev Phil Thompson: > On Fri, 24 Apr 2009 12:37:02 -0500, Joacim Thomassen > wrote: >> Hello, >> >> I'm trying to get my first PyQt4 application to work as intended, but >> it seems I'm stuck and out of ideas for now. >> >> The program is a simple GUI showi

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread MRAB
tinn...@isbd.co.uk wrote: Grant Edwards wrote: On 2009-04-24, Grant Edwards wrote: Anybody writing to an mbox mailbox has to follow the rules if they expect to interoperate with other mail applications. If mailbox.mbox.add() doesn't preserve the atime when writing to an mbox, then mailbox.m

Re: mailbox.mbox.add() also seems to set file permissions

2009-04-25 Thread Grant Edwards
On 2009-04-25, tinn...@isbd.co.uk wrote: > Where should one report bugs/errors in python library classes? http://docs.python.org/bugs.html -- Grant Edwards grante Yow! Gee, I feel kind of at LIGHT in the head now,

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread Grant Edwards
On 2009-04-25, tinn...@isbd.co.uk wrote: > Grant Edwards wrote: >> On 2009-04-24, Grant Edwards wrote: >> >> > Anybody writing to an mbox mailbox has to follow the rules if >> > they expect to interoperate with other mail applications. If >> > mailbox.mbox.add() doesn't preserve the atime when

Re: Help AIX 5.3 build on Python-3.1a2

2009-04-25 Thread Aahz
In article , wrote: > >> make >xlc_r -q64 -c -DNDEBUG -O2 -I. -IInclude -I./Include - >DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c >1506-507 (W) No licenses available. Contact your program supplier to >add additional users. Compilation will proceed shortly. >xlc_r -q

Re: and [True,True] --> [True, True]?????

2009-04-25 Thread Duncan Booth
jazbees wrote: hasvowels = lambda x:max([y in x for y in "aeiou"]) hasvowels("parsnips") > True hasvowels("sfwdkj") > False > Do you object to using def to define functions? Anyway, it is probably clearer to use the builtin 'any' for code like this: >>> def hasvowels(s): ...

Re: pythonCE GetSystemPowerState windows api

2009-04-25 Thread lorenzo . mentaschi
On Apr 25, 6:19 pm, Thomas Heller wrote: > lorenzo.mentas...@yahoo.it schrieb: > > > > > Hi all, > > I need to call GetSystemPowerState windows api from pythonCE, because > > I need to know if a windows ce 5 device is in sleep/off status. > > I can find this api in ctypes.windll.coredll, but I can

mailbox.mbox.add() also seems to set file permissions

2009-04-25 Thread tinnews
mailbox.mbox.add() has *another* 'quirk'. When it adds a message to an mbox file it seems to set the permissions to 0755 which is quite wrong for mbox files. I get the feeling that the mbox versions of the functions are just bodged maildir ones. If one was creating a maildir it *might* make some

Re: DigitalSigner in Python

2009-04-25 Thread Martin P. Hellwig
Marco Bizzarri wrote: On Fri, Apr 24, 2009 at 7:57 AM, Good Z wrote: Hello All, I need to digitally sign a document in python. Is there any equivalent directory in Python like the DigitalSigner we have in Java. Best Regards, Mike Maybe you could take a look at M2Crypto? http://chandlerp

Daemonic processes in multiprocessing

2009-04-25 Thread Pascal Chambon
Hello everyone I've just read the doc of the (awesome) "multiprocessing" module, and there are some little things I don't understand, concerning daemon processes (see quotes below). When a python process exits, the page says it attempts to join all its children. Is this just a design choic

Re: authentication example with urllib.request

2009-04-25 Thread Marco Bizzarri
On Sat, Apr 25, 2009 at 8:09 AM, larryzhang wrote: > Dear all, > > I am trying to download data from a website that requires > authentication (maybe with cookies). Any suggestions on how i can do > this with the urllib.request module in py3? Where can I can find some > working examples? Thanks a l

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread tinnews
Grant Edwards wrote: > On 2009-04-24, Lawrence D'Oliveiro wrote: > > In message , Grant Edwards > > wrote: > > > >> AFAIK, atime >> when an mbox contains new mail for at least 20 years. > > > > Doesn't apply to maildir though, does it? > > Nope. With maildir, there's a completely separate dire

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread tinnews
Grant Edwards wrote: > On 2009-04-24, Grant Edwards wrote: > > > Anybody writing to an mbox mailbox has to follow the rules if > > they expect to interoperate with other mail applications. If > > mailbox.mbox.add() doesn't preserve the atime when writing to > > an mbox, then mailbox.mbox.add is

Re: DigitalSigner in Python

2009-04-25 Thread Marco Bizzarri
On Fri, Apr 24, 2009 at 7:57 AM, Good Z wrote: > Hello All, > > I need to digitally sign a document in python. Is there any equivalent > directory in Python like the DigitalSigner we have in Java. > > Best Regards, > Mike > > Maybe you could take a look at M2Crypto? http://chandlerproject.org/P

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread tinnews
MRAB wrote: > tinn...@isbd.co.uk wrote: > > It seems to me that mailbox.mbox.add() sets the access time of a mbox > > file as well as the modification time. This is not good for MUAs that > > detect new mail by looking to see if the access time is before the > > modification time. > > > > Have I

Re: Python not importing mysqldb

2009-04-25 Thread Marco Bizzarri
On Fri, Apr 24, 2009 at 10:04 PM, 83nini <83n...@gmail.com> wrote: > hi guys, > > i've been sweating the whole day trying to make python work with mysql > but in vain! > i'm doing the following: > 1. visiting http://sourceforge.net/projects/mysql-python > 2. dowloading mysql-python-test-1.2.3c1 > 3

Re: pythonCE GetSystemPowerState windows api

2009-04-25 Thread Thomas Heller
lorenzo.mentas...@yahoo.it schrieb: > Hi all, > I need to call GetSystemPowerState windows api from pythonCE, because > I need to know if a windows ce 5 device is in sleep/off status. > I can find this api in ctypes.windll.coredll, but I cannot figure out > how to pass parameters to this procedure:

Re: New at Python, some trouble with examples

2009-04-25 Thread Kevin Forbes VK3KUF
"MRAB" wrote in message news:mailman.4563.1240669629.11746.python-l...@python.org... > Kevin Forbes VK3KUF wrote: >> Hello folks, my name is Kevin, HAM call vk3ukf, site www.vk3ukf.com >> >> I am brand new to Python and having the big learn at the moment. >> Running Windows XP pro SP3 with Delph

Re: PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-25 Thread Zooko O'Whielacronx
Thanks for writing this PEP 383, MvL. I recently ran into this problem in Python 2.x in the Tahoe project [1]. The Tahoe project should be considered a good use case showing what some people need. For example, the assumption that a file will later be written back into the same local file

Re: and [True,True] --> [True, True]?????

2009-04-25 Thread jazbees
I'm surprised to see that the use of min and max for element-wise comparison with lists has not been mentioned. When fed lists of True/ False values, max will return True if there is at least one True in the list, while min will return False if there is at least one False. Going back to the OP's i

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Hrvoje Niksic
Paul Rubin writes: > "Ciprian Dorin, Craciun" writes: >> A practical example: I have lists that contain strings, but I want >> to compare them in an case-insensitive way... Should I update the >> __eq__ method (for str class) and break almost everything? Can I w

Re: Learning Python the quick way

2009-04-25 Thread Esmail
Thanks Tim, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: New at Python, some trouble with examples

2009-04-25 Thread MRAB
Kevin Forbes VK3KUF wrote: Hello folks, my name is Kevin, HAM call vk3ukf, site www.vk3ukf.com I am brand new to Python and having the big learn at the moment. Running Windows XP pro SP3 with Delphi 7 free version I installed Python 2.6 and the 1.1.6 PIL to go with it Now, because I am running t

New at Python, some trouble with examples

2009-04-25 Thread Kevin Forbes VK3KUF
Hello folks, my name is Kevin, HAM call vk3ukf, site www.vk3ukf.com I am brand new to Python and having the big learn at the moment. Running Windows XP pro SP3 with Delphi 7 free version I installed Python 2.6 and the 1.1.6 PIL to go with it Now, because I am running the free version of Delphi 7.

Re: Learning Python the quick way

2009-04-25 Thread Tim Chase
Esmail wrote: Tim Chase wrote: However the first rule: profile first! Do you have a favorite profiling tool? What should someone new to Python (but not programming) use? I personally use the cheapo method of dropping in a few "print" statements to dump where I currently am in the app, and

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ciprian Dorin, Craciun
On Sat, Apr 25, 2009 at 4:01 PM, "Martin v. Löwis" wrote: >>     Indeed the example I've given is purely theoretical. But still, I >> could find a use case for such a thing: just imagine we are building a >> small shell-like application that reads one line (the commands), >> splits it by spaces an

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Martin v. Löwis
> Indeed the example I've given is purely theoretical. But still, I > could find a use case for such a thing: just imagine we are building a > small shell-like application that reads one line (the commands), > splits it by spaces and always expects to have 4 elements and that > each respects a

PyCon Italy 2009: Late Bird Deadline

2009-04-25 Thread Alan Franzoni
The late-bird registration deadline for PyCon Tre (PyCon Italy 2009) is May 4th. The conference will take place in Florence from May 8th till May 10th 2009, and features guests like Guido Van Rossum, Alex Martelli, Raymond Hettinger, Fredrik Lundh and Antonio Cangiano. Feel free to take a look

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-25 Thread Martin v. Löwis
> If the bytes are mapped to single half surrogate codes instead of the > normal pairs (low+high), then I can see that decoding could never be > ambiguous and encoding could produce the original bytes. I was confused by Markus Kuhn's original UTF-8b specification. I have now changed the PEP to avo

Re: Learning Python the quick way

2009-04-25 Thread Esmail
Tim Chase wrote: 2) if it's slow, profile it and check your algorithm(s), recoding if you're using some algorithm with a bad big-oh profile <..> However the first rule: profile first! Tim, Do you have a favorite profiling tool? What should someone new to Python (but not programming)

pythonCE GetSystemPowerState windows api

2009-04-25 Thread lorenzo . mentaschi
Hi all, I need to call GetSystemPowerState windows api from pythonCE, because I need to know if a windows ce 5 device is in sleep/off status. I can find this api in ctypes.windll.coredll, but I cannot figure out how to pass parameters to this procedure: msdn giude ( http://msdn.microsoft.com/en-us/

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ciprian Dorin, Craciun
On Sat, Apr 25, 2009 at 1:55 PM, "Martin v. Löwis" wrote: >>     A practical example: I have lists that contain strings, but I want >> to compare them in an case-insensitive way... > > I'd claim that this is still theoretical: what are these strings, and > why do you have lists of them that you wa

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-25 Thread Martin v. Löwis
Cameron Simpson wrote: > On 22Apr2009 08:50, Martin v. Löwis wrote: > | File names, environment variables, and command line arguments are > | defined as being character data in POSIX; > > Specific citation please? I'd like to check the specifics of this. For example, on environment variables: h

ANN: Shed Skin 0.1.1

2009-04-25 Thread Mark Dufour
Hi all, I have recently released version 0.1.1 of Shed Skin, an experimental (restricted-)Python-to-C++ compiler. This version comes with 5 new example programs (for a total of 35 examples, at over 10,000 lines in total). The most interesting new example is Minilight (http://www.hxa.name/miniligh

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Martin v. Löwis
> A practical example: I have lists that contain strings, but I want > to compare them in an case-insensitive way... I'd claim that this is still theoretical: what are these strings, and why do you have lists of them that you want to compare? Why don't you try to lower-case the strings in the

Re: Learning Python the quick way

2009-04-25 Thread Lie
On Apr 25, 11:13 am, mercur...@googlemail.com wrote: > Hi guys, > > I have decided to learn Python a little more than I already do. But I > found few problems, > > I am not sure what will happen if I do the programing in python the > find the program > doesn't deliver the desired performance due to

Re: confused with so many python package locations for imports

2009-04-25 Thread Ben Finney
Krishnakant writes: > So now if I say for example choose ubuntu and debian for my testing > purpose, should I put all the packages I make into > /usr/local/lib/python2.6/site-packages? Will this be a safe choice for > at least debian and Ubuntu? No, for Debian and/or Ubuntu, you should avoid mov

Re: confused with so many python package locations for imports

2009-04-25 Thread Krishnakant
On Sat, 2009-04-25 at 18:31 +1000, Ben Finney wrote: > Python has a habit of generating, and expecting to find, > platform-specific files (‘foo.pyo’ extension modules), compiled bytecode > files (‘foo.pyc’), and module source files (‘foo.py’) necessarily in the > same directory for purpose of locat

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Paul Rubin
"Ciprian Dorin, Craciun" writes: > P.P.S.: I'm just trying to see why is Python better than Lisp or > vice-versa... I would say they are almost the same: both usable for > day-to-day real world applications... Python tries to be simple and pragmatic while not aiming for as heavy-duty applicat

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Paul Rubin
"Ciprian Dorin, Craciun" writes: > A practical example: I have lists that contain strings, but I want > to compare them in an case-insensitive way... Should I update the > __eq__ method (for str class) and break almost everything? Can I write > now a == b? Nop... I need the loop you've just me

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Paul Rubin
"Ciprian Dorin, Craciun" writes: > > Use the builtin a==b, similar to (equal a b) > But how about extensibility? "a==b" is like (equal a b). "a is b" is like (eq a b). -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ciprian Dorin, Craciun
On Sat, Apr 25, 2009 at 11:36 AM, "Martin v. Löwis" wrote: >> I don't get that impression from Lisp programmers. > > I observe a phenomenon on language fanatics, no matter what language, > but in particular for the less-than-mainstream language: the desire > to formulate trivial algorithms over an

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread marek . rocki
Ciprian Dorin, Craciun napisał(a): > Python way: > def compare (a, b, comp = eq) : > if len (a) != len (b) : > return False > for i in xrange (len (a)) : > if not comp (a[i], b[i]) : >return False > return True This is shorter, but I'm not sure if more pythonic: def compare(a, b, compfun

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ciprian Dorin, Craciun
On Sat, Apr 25, 2009 at 11:30 AM, "Martin v. Löwis" wrote:     Ok... Then what's pythonic? Please give a pythonic implementation... >>> Use the builtin a==b, similar to (equal a b) >> >>     But how about extensibility? > [...] > > I see that you allow for a different comparison function. I d

  1   2   >