Re: python list handling and Lisp list handling

2009-04-25 Thread Mark Tarver
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 representation is implementation dependent. > > As far as

Re: python list handling and Lisp list handling

2009-04-25 Thread Mark Tarver
What is different is the concept of "all globals that > reference G".  For example: > > >>> a = [1, 2, 3] > >>> b = a > >>> a[0] = 0 > >>> print b > > [0, 2, 3] I see that Python had an id too ;). Mark -- 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 9: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

Re: confused with so many python package locations for imports

2009-04-25 Thread Krishnakant
On Sat, 2009-04-25 at 14:16 +0900, David Cournapeau wrote: > Some of those locations are OS specific - pyshare is specific to > debian I think, for example. > My Basic question is that, what package directory is Standard as far as all gnu/linux distros are concerned? In other words I would like to

Re: Learning Python the quick way

2009-04-25 Thread Martin P. Hellwig
mercur...@googlemail.com wrote: Hi guys, I have decided to learn Python a little more than I already do. Very good! 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 lack of a good com

Re: python list handling and Lisp list handling

2009-04-25 Thread Michele Simionato
On Apr 25, 9:07 am, 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 a 'yes'.

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread John Yeung
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). I don't get that impression

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread bearophileHUGS
Ciprian Dorin, Craciun: > Python way: > - > def eq (a, b) : >     return a == b > > 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 That'

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ciprian Dorin, Craciun
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) : >>         return False >>     for i in xrange (len (a)) : >>         if not comp (a[i], b[i]

Re: [plt-scheme] Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Neil Van Dyke
I believe this thread is off-topic for the "plt-scheme" list. Please cease cross-posting. -- http://mail.python.org/mailman/listinfo/python-list

Re: python list handling and Lisp list handling

2009-04-25 Thread Paul Rubin
Mark Tarver writes: > "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 a 'yes'. Any disagreement? I don't think it is equivalent: Python

Re: Lisp mentality vs. Python mentality

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

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Paul Rubin
"Ciprian Dorin, Craciun" writes: > Ok... Then what's pythonic? Please give a pythonic implementation... Use the builtin a==b, similar to (equal 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:04 AM, Paul Rubin wrote: > "Ciprian Dorin, Craciun" writes: >>     Ok... Then what's pythonic? Please give a pythonic implementation... > > Use the builtin a==b, similar to (equal a b) But how about extensibility? -- http://mail.python

Re: python list handling and Lisp list handling

2009-04-25 Thread Michele Simionato
On Apr 25, 10:01 am, Paul Rubin wrote: > Mark Tarver writes: > > "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?"

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Martin v. Löwis
>>> 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 ==. This is what Carl Banks referred in his original posting. You just *don'

Re: confused with so many python package locations for imports

2009-04-25 Thread Ben Finney
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 modules), compiled bytecode files (‘foo.pyc’), and module sou

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ben Finney
Carl Banks writes: > 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). That's not what the Zen says. The statement yo

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Ben Finney
"Ciprian Dorin, Craciun" writes: > On Sat, Apr 25, 2009 at 11:04 AM, Paul Rubin > wrote: > > Use the builtin a==b, similar to (equal a b) > > But how about extensibility? Easily extensible. If you want types that compare in different ways, just define your new

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Martin v. Löwis
> 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 and over again, just to enjoy the beauty of the result (and sometimes

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

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: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 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 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: > 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: 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: 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: 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: 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

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: [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

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

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: 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)

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

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: 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

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: 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

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: 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

Re: Learning Python the quick way

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

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: 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: 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: 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: 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: 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: 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: 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
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: 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

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: 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

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: 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

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: 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: 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: 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 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: 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

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_

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

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

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 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: 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: 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: 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 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: 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: 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: 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: 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: 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 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: 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

__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: 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

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

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: 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

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: 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: __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: 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 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: 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: 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: 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: 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: 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: 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: __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: 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: 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: 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

  1   2   >