Re: Is there a maximum size to a Python program?

2009-04-26 Thread John Machin
On Apr 27, 2:34 pm, "Paul Hemans" wrote: > entry = schema.BILLS() > exists = session.query(schema.BILLS).filter(schema.BILLS.REFNO==u"1") > if exists.count == 0: >     entry.REFNO = u"1" >     entry.THRDPTY = u"""C5""" >     entry.AMOUNT = 0 >     entry.TIMESTAMP = 0 >     entry.ALLOCATED = 0 In

Re: getting linux distro used...

2009-04-26 Thread David Lyon
perphaps platform.uname()? On Sun, 26 Apr 2009 22:35:29 -0700 (PDT), deostroll wrote: > Hi, > > I just found that you could use platform.system() to get the > underlying os used. But is there a way to get the distro used...? > > --deostroll > -- > http://mail.python.org/mailman/listinfo/python

Re: Is there a maximum size to a Python program?

2009-04-26 Thread John Machin
On Apr 27, 3:48 pm, Steven D'Aprano wrote: > On Sun, 26 Apr 2009 21:51:00 -0700, John Machin wrote: > > ἐδάκρυσεν ὁ Ἰησοῦς > > Alright, I give up. Your googler cactus? > Is that APL code? *grin* No but +1 anyway :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: getting linux distro used...

2009-04-26 Thread Benjamin Kaplan
On Mon, Apr 27, 2009 at 1:35 AM, deostroll wrote: > Hi, > > I just found that you could use platform.system() to get the > underlying os used. But is there a way to get the distro used...? > > --deostroll > -- > http://mail.python.org/mailman/listinfo/python-list > platform.linux_distribution()

Re: Re: ActiveState Komodo Edit?

2009-04-26 Thread Dave Angel
John Doe wrote: George Sakkis wrote: John Doe wrote: Having trouble tabifying a section of Python code. Code -- Tabify Region Does it work for anyone else? Yes it does, you have to select a region before (e.g. ctrl+A for the whole file). Regardless, the common standard i

Re: Is there a maximum size to a Python program?

2009-04-26 Thread John Machin
On Apr 27, 3:31 pm, "Paul Hemans" wrote: > Thanks John, I understand where you are coming from and will try and digest > it all. One problem though that I didn't mention in my original posting was > that the replication may only require updating one or more fields, that is a > problem with a gener

Re: Is there a maximum size to a Python program?

2009-04-26 Thread Steven D'Aprano
On Sun, 26 Apr 2009 21:51:00 -0700, John Machin wrote: > ἐδάκρυσεν ὁ Ἰησοῦς Alright, I give up. Is that APL code? *grin* -- Steven -- http://mail.python.org/mailman/listinfo/python-list

getting linux distro used...

2009-04-26 Thread deostroll
Hi, I just found that you could use platform.system() to get the underlying os used. But is there a way to get the distro used...? --deostroll -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a maximum size to a Python program?

2009-04-26 Thread Paul Hemans
Thanks John, I understand where you are coming from and will try and digest it all. One problem though that I didn't mention in my original posting was that the replication may only require updating one or more fields, that is a problem with a generating a single SQL statement to cover all reque

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

2009-04-26 Thread Martin v. Löwis
> How about another str-like type, a sequence of char-or-bytes? That would be a different PEP. I personally like my own proposal more, but feel free to propose something different. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a maximum size to a Python program?

2009-04-26 Thread Emmanuel Surleau
On Monday 27 April 2009 05:01:22 Carbon Man wrote: > I have a program that is generated from a generic process. It's job is to > check to see whether records (replicated from another system) exist in a > local table, and if it doesn't, to add them. I have 1 of these programs for > every table in th

Re: ActiveState Komodo Edit?

2009-04-26 Thread John Doe
George Sakkis wrote: > John Doe wrote: >> Having trouble tabifying a section of Python code. >> Code -- Tabify Region >> Does it work for anyone else? > > Yes it does, you have to select a region before (e.g. ctrl+A for > the whole file). Regardless, the common standard indentation is 4 > spac

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Ciprian Dorin, Craciun
On Mon, Apr 27, 2009 at 2:14 AM, Dan Sommers wrote: > On Sun, 26 Apr 2009 12:30:40 +0300, Ciprian Dorin, Craciun wrote: > >> On Sun, Apr 26, 2009 at 12:08 PM, "Martin v. Löwis" >> wrote: > >>> No, the problem is that you are using way too many functions, that do >>> too little. The problem with t

Re: ActiveState Komodo Edit?

2009-04-26 Thread Dave Angel
John Doe wrote: Having trouble tabifying a section of Python code. Code -- Tabify Region Does it work for anyone else? Thanks. Hello JD, I'm using Komodo IDE 5.1.1, and tabify works fine, with a column setting of 4. However, I'd never tabify Python source code, not sure why you need t

Re: ActiveState Komodo Edit?

2009-04-26 Thread George Sakkis
On Apr 26, 11:08 pm, John Doe wrote: > Having trouble tabifying a section of Python code. > Code -- Tabify Region > Does it work for anyone else? Yes it does, you have to select a region before (e.g. ctrl+A for the whole file). Regardless, the common standard indentation is 4 spaces; avoid tabs

Re: Is there a maximum size to a Python program?

2009-04-26 Thread John Machin
On Apr 27, 2:34 pm, "Paul Hemans" wrote: [snip] > exists = session.query(schema.BILLS).filter(schema.BILLS.REFNO==u"1") > if exists.count == 0: >     entry.REFNO = u"1" >     entry.THRDPTY = u"""C5""" >     entry.AMOUNT = 0 >     entry.TIMESTAMP = 0 >     entry.ALLOCATED = 0 >     session.add(en

Re: question about class vs class at

2009-04-26 Thread Tim Roberts
grocery_stocker wrote: > >Maybe. I guess I haven't been around python long enough to realize >that there was a difference in 'output' between the old-style class >and new-style class. Also remember that a class can define its own string to print there. What you see is the output of the __repr__

Re: Is there a maximum size to a Python program?

2009-04-26 Thread John Machin
On Apr 27, 1:01 pm, "Carbon Man" wrote: > I have a program that is generated from a generic process. It's job is to > check to see whether records (replicated from another system) exist in a > local table, and if it doesn't, to add them. I have 1 of these programs for > every table in the database

Re: Is there a maximum size to a Python program?

2009-04-26 Thread Paul Hemans
Thanks for the reply, > Sounds like a needlessly complicated way of doing things. Surely > replicating data from a database is a solved problem? The data is coming from a legacy system and going into SQLalchemy to give database independence. We will probably update the legacy apps in the future

Re: mod_python form upload: permission denied sometimes...

2009-04-26 Thread Lawrence D'Oliveiro
In message <0fc15bee-003a-45ca- b6b6-21ed0645b...@q2g2000vbr.googlegroups.com>, psaff...@googlemail.com wrote: > I have a mod_python application that takes a POST file upload from a > form. It works fine from my machine, other machines in my office and > my home machine. It does not work from my

Re: Is there a maximum size to a Python program?

2009-04-26 Thread Steven D'Aprano
On Mon, 27 Apr 2009 13:01:22 +1000, Carbon Man wrote: > I have a program that is generated from a generic process. It's job is > to check to see whether records (replicated from another system) exist > in a local table, and if it doesn't, to add them. I have 1 of these > programs for every table i

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

2009-04-26 Thread Aahz
In article , Grant Edwards wrote: >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 That's for doc bugs; regular bugs go to bugs.python.org (which is currently down due to hardware problems). -- Aa

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

2009-04-26 Thread Aahz
In article , Lawrence D'Oliveiro wrote: > >It's only in the proprietary-software world that we need to worry about >backward compatibility with old, obsolete software that the vendors >cannot or will not fix. In the Free Software world, we fix the software >to bring it up to date. Are you volunt

Re: How to import modules from specific Python installation?

2009-04-26 Thread kk
Hi Thank you for the suggestions, I will see what I can from here. -- http://mail.python.org/mailman/listinfo/python-list

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

2009-04-26 Thread Grant Edwards
On 2009-04-26, tinn...@isbd.co.uk wrote: > Grant Edwards wrote: >> > I suppose I could do the following:- >> > >> > lock the mbox >> > get the atime >> > add the new message with mailbox.mbox.add() >> > restore the atime >> > unlock the mbox >> >> You could fix mbox.add(). ;

ActiveState Komodo Edit?

2009-04-26 Thread John Doe
Having trouble tabifying a section of Python code. Code -- Tabify Region Does it work for anyone else? Thanks. -- Interested in making Windows and games obey your verbal commands? Continuous command recognition (much easier than speech recognition) can now be enabled using Naturally Speakin

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-26 Thread John Doe
John Doe wrote: ... > Another file manager, FreeCommander, does find text in Python files. However... It does not have Undo! Potentially risky. -- http://mail.python.org/mailman/listinfo/python-list

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

2009-04-26 Thread Grant Edwards
On 2009-04-26, Lawrence D'Oliveiro wrote: > 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 pro

Is there a maximum size to a Python program?

2009-04-26 Thread Carbon Man
I have a program that is generated from a generic process. It's job is to check to see whether records (replicated from another system) exist in a local table, and if it doesn't, to add them. I have 1 of these programs for every table in the database. Everything works well until I do the postcod

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

2009-04-26 Thread John Machin
On Apr 27, 11:43 am, jazbees wrote: > On Apr 25, 12:11 pm, Duncan Booth > wrote: > > > 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 functio

Re: ANN: PyGUI 2.0.5

2009-04-26 Thread greg
Suraj Barkale wrote: Minor nitpicks: 1. Menu accelerators are not enabled by default i.e. pressing Alt + F does not open the File menu. 2. Alt + F4 does not close the window. I'll see if I can do something about these. 3. None of the controls (except menus) have _Vista look_ to them I don'

Re: ANN: PyGUI 2.0.5

2009-04-26 Thread Greg Ewing
Randy Syring wrote: Could you tell me briefly how this project differs from something like wxPython? It wraps platform-specific libraries directly, rather than being a wrapper around another cross-platform library. This means less bloat and less dependencies. Chances are you already have the n

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

2009-04-26 Thread jazbees
On Apr 25, 12:11 pm, Duncan Booth wrote: > 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? Not at all. Do you object to my use of lambdas? I'

Re: ANN: PyGUI 2.0.5

2009-04-26 Thread greg
rzed wrote: I note that 2.0.5 comments the WM_MOUSELEAVE event, which wasnt' mapped in Events.py. Does that mean there is no way to signal such an event? I'm no longer promising to provide mouse_enter and mouse_leave events on any platform for the time being. It's not straightforward to imple

[ANN] pyxser-1.0rc1 --- python xml serialization

2009-04-26 Thread Daniel Molina Wegener
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello, I'm pleased to announce pyxser-1.0rc1, a Python-Object to XML serializer and deserializer. This package it's completly written in C and licensed under LGPLv3. The tested Python versions are 2.5.X and 2.7.X. * home page: http://coder.cl/so

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Carl Banks
On Apr 26, 3:03 pm, Paul Rubin wrote: > Carl Banks writes: > > Which is "communicating with the rest of the program periodically". > > > Presumably you have to protect objects to share them?  There you go: > > anytime you try to acquire a lock have the thread check t

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

2009-04-26 Thread Adrian
How about another str-like type, a sequence of char-or-bytes? Could be called strbytes or stringwithinvalidcharacters. It would support whatever subset of str functionality makes sense / is easy to implement plus a to_escaped_str() method (that does the escaping the PEP talks about) for people who

Re: Thread-killing, round 666 (was Re: Lisp mentality vs. Python mentality)

2009-04-26 Thread Aahz
In article <793a5176-ec2d-4ffd-b1e7-762077733...@v35g2000pro.googlegroups.com>, Vsevolod wrote: >On Apr 26, 6:28 pm, a...@pythoncraft.com (Aahz) wrote: >> >> The problem is that thread-killing (in the literal sense) doesn't work. >> Unlike processes, there's no thread-environment encapsulation at

Re: How to import modules from specific Python installation?

2009-04-26 Thread David Lyon
On Sun, 26 Apr 2009 13:07:24 -0700 (PDT), kk wrote: > I know there is a way to import from different Python installation but > I could not find the answer. I have Python 2.6 and 2.5 You can probably achieve this by adjusting the pythonpath to search through the site-packages directory of the ot

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Steven D'Aprano
On Sun, 26 Apr 2009 05:07:25 -0700, bearophileHUGS wrote: > Paul Rubin: >> Arnaud Delobelle: >> > Do you mean imap(comp, a, b)? >> >> Oh yes, I forgot you can do that.  Thanks. > > That works and is nice and readable: > > > import operator > from itertools import imap > > def equal_sequences(a

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

2009-04-26 Thread John Posner
Arnaud Delobelle wrote: return any( not val for val in value_list ) This is the same as: return not all(value_list) Yes, I should have remembered De Morgan's Theorem. Thanks! -John -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Dan Sommers
On Sun, 26 Apr 2009 12:30:40 +0300, Ciprian Dorin, Craciun wrote: > On Sun, Apr 26, 2009 at 12:08 PM, "Martin v. Löwis" > wrote: >> No, the problem is that you are using way too many functions, that do >> too little. The problem with that is then that you have to give names >> to all the functio

Re: confused with so many python package locations for imports

2009-04-26 Thread Ben Finney
Scott David Daniels writes: > Ben Finney wrote: > > Thank you for the correction. Please mentally substitute into my > > argument the files that *are* compiled C extension modules; it > > remains otherwise unchanged. > > But the compiled C extension modules are called ".pyd" files and > they are

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Paul Rubin
Scott David Daniels writes: > But precisely because of that sharing the thread may be in the middle > something that "must complete" -- no with-statement locking will get > unlocked, no "finally:" clauses in code in the standard library, no > ... -- there is just too much that goes wrong when a th

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Paul Rubin
Carl Banks writes: > Which is "communicating with the rest of the program periodically". > > Presumably you have to protect objects to share them? There you go: > anytime you try to acquire a lock have the thread check to see whether > to abort. Normally, acquiring a lock doesn't require runnin

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Scott David Daniels
Paul Rubin wrote: Carl Banks writes: Say you are running a thread and you want the power to be able to kill it at any time. The thread is either communicating with the rest of the program periodically, or it isn't. If it is, then there are ample opportunities to tell the thread to terminate i

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Paul Rubin
Carl Banks writes: > Say you are running a thread and you want the power to be able to kill > it at any time. The thread is either communicating with the rest of > the program periodically, or it isn't. If it is, then there are ample > opportunities to tell the thread to terminate itself. If it

Re: question about class vs class at

2009-04-26 Thread grocery_stocker
On Apr 26, 2:07 pm, Arnaud Delobelle wrote: > grocery_stocker writes: > > When I do pexpect.spawn in the following example, I see > 'pexpect.spawn'> > > > [cdal...@localhost oakland]$ python > > Python 2.4.3 (#1, Oct 1 2006, 18:00:19) > > [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2 > > Ty

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Carl Banks
On Apr 26, 2:38 pm, Paul Rubin wrote: > Carl Banks writes: > > Say you are running a thread and you want the power to be able to kill > > it at any time.  The thread is either communicating with the rest of > > the program periodically, or it isn't.  If it is, then t

Re: python list handling and Lisp list handling

2009-04-26 Thread J Kenneth King
Steven D'Aprano writes: > On Sat, 25 Apr 2009 23:51:18 -0700, namekuseijin wrote: > >> On Apr 26, 1:31 am, Steven D'Aprano > cybersource.com.au> 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 Li

Re: How to import modules from specific Python installation?

2009-04-26 Thread Dave Angel
kk wrote: Hi I know there is a way to import from different Python installation but I could not find the answer. I have Python 2.6 and 2.5 thanks There's always the question of whether it's a good idea. My opinion is that if you want to use python source files from another version, you

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Carl Banks
On Apr 26, 5:40 am, Vsevolod wrote: > On Apr 25, 9:06 am, Carl Banks wrote: > > Carl Banks, who might be exaggerating > > > ...a little. > > I think you're exaggerating. Go ask this question in c.l.l and the > first answer you'll get is mismatch. What could have made you think I was exaggerating

Re: writing large dictionaries to file using cPickle

2009-04-26 Thread repi
Hello, I'm having the same problem. I'm creating two dictionaries with about 700,000 to 1,600,000 keys each, each key pointing to a smaller structure of embedded dictionaries. On a 8 x 3.0GHz Xeon Mac Pro with 17GB of RAM, cPickle is excruciatingly slow. Moreover, it crashes with memory error (12

Re: question about class vs class at

2009-04-26 Thread Arnaud Delobelle
grocery_stocker writes: > When I do pexpect.spawn in the following example, I see 'pexpect.spawn'> > > [cdal...@localhost oakland]$ python > Python 2.4.3 (#1, Oct 1 2006, 18:00:19) > [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2 > Type "help", "copyright", "credits" or "license" for more in

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

2009-04-26 Thread Arnaud Delobelle
John Posner writes: > jazbees wrote: > >> 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

question about class vs class at

2009-04-26 Thread grocery_stocker
When I do pexpect.spawn in the following example, I see [cdal...@localhost oakland]$ python Python 2.4.3 (#1, Oct 1 2006, 18:00:19) [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pexpect >>> pexpect.spawn >>>

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

2009-04-26 Thread John Posner
jazbees wrote: > 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.

How to import modules from specific Python installation?

2009-04-26 Thread kk
Hi I know there is a way to import from different Python installation but I could not find the answer. I have Python 2.6 and 2.5 thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Aahz
In article , Scott David Daniels wrote: > >I don't remember who, but something famously said, in effect: > Debugging is hard, maybe twice as hard as writing the code in > the first place. Unless you are one of those nonexistent few > who always write correct programs from the word go

Re: Thread-killing, round 666 (was Re: Lisp mentality vs. Python mentality)

2009-04-26 Thread Vsevolod
On Apr 26, 6:28 pm, a...@pythoncraft.com (Aahz) wrote: > The problem is that thread-killing (in the literal sense) doesn't work. > Unlike processes, there's no thread-environment encapsulation at the OS > level, which means that things don't get cleaned up properly. Even Java > has mostly given up

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread namekuseijin
Travis wrote: I've noticed that every one of you is wrong about programming. Since I can't say it effectively, here's someone who can: http://www.youtube.com/watch?v=XHosLhPEN3k That's the answer. Hmm, perhaps it was the answer by the time that song was written? ;) cool anyway... :) -- http:/

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Scott David Daniels
Ciprian Dorin, Craciun wrote: On Sun, Apr 26, 2009 at 12:08 PM, "Martin v. Löwis" wrote: From your comments I understand that the only problem with my code proposal are the function names... No, the problem is that you are using way too many functions, that do too little. The problem with

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread namekuseijin
Paul Rubin wrote: namekuseijin writes: return (len(a) == len(b)) and not any(not comp(*t) for t in (zip(a, b))) plus the zip call enclosed in parentheses got turned into an iterator. zip in python 2.x always makes a list. You want itertools.izip. You could also use itertools.starmap.

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Martin v. Löwis
> So if I'm reading right you are saying something in the lines: > "using too many functions is bad just because it is unreadable and > non-understandable to average (could I say mediocre?) programmers"... No, this style is also unreadable to advanced programmers, in particular when you fail t

Re: pyflakes, pylint, pychecker - and other tools

2009-04-26 Thread Zooko O'Whielacronx
I like pyflakes. I haven't tried the others. I made a setuptools plugin named "setuptools_pyflakes". If you install that package, then "python ./setup.py flakes" runs pyflakes on your package. Regards, Zooko -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt4 - widget signal trouble

2009-04-26 Thread Joacim Thomassen
Den Sun, 26 Apr 2009 14:04:47 +0100, skrev Phil Thompson: > On Sun, 26 Apr 2009 14:46:14 +0200, Marco Bizzarri > wrote: >> On Sun, Apr 26, 2009 at 12:38 PM, Joacim Thomassen >> wrote: >>> Den Sat, 25 Apr 2009 23:47:57 +0200, skrev Marco Bizzarri: >>> >>> >>> Hello Marco, >>> >>> python's fcntl()

Re: Into itertools

2009-04-26 Thread Arnaud Delobelle
AggieDan04 writes: > Good suggestions. Another useful function I'd like to see in > itertools is the Cartesian product. This can be implemented as: [snip implementation] You mean itertools.product? http://docs.python.org/library/itertools.html#itertools.product -- Arnaud -- http://mail.pyt

Re: PyQt4 - widget signal trouble

2009-04-26 Thread Joacim Thomassen
Thanks a lot! That's the magic I didn't find in my PyQT4 Programming book. Finally! Thank you Marco! :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Into itertools

2009-04-26 Thread AggieDan04
On Apr 26, 11:32 am, bearophileh...@lycos.com wrote: > Some idioms are so common that I think they deserve to be written in C > into the itertools module. > > 1) leniter(iterator) ... > 2) xpairwise(iterable) ... > 3) xpairs(seq) ... > 4) xsubsets(seq) ... Good suggestions. Another useful functio

Re: ANN: PyGUI 2.0.5

2009-04-26 Thread Suraj Barkale
Greg Ewing canterbury.ac.nz> writes: > > PyGUI 2.0.5 is available: > >http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ > > More bug fixes for various platforms. Tested on "Vista Home Premium 64bit" with Python 2.6.2 all tests pass except: 16-model_dialog.py - If the model dialog "Sp

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Mikael Jansson
On Apr 25, 9:36 am, John Yeung wrote: > > Ultimately, Lisp is first and foremost academic (Scheme especially so) > while Python is first and foremost practical.  I think Paul Graham's > essays on Lisp exemplify the Lisp mentality. > Oh, you mean Blub? http://www.paulgraham.com/avg.html ;-) --

Into itertools

2009-04-26 Thread bearophileHUGS
Some idioms are so common that I think they deserve to be written in C into the itertools module. 1) leniter(iterator) It returns the length of a given iterator, consuming it, without creating a list. I have discussed this twice in the past. Like itertools.izip_longest don't use it with infinite

Re: Weird lambda behavior (bad for)

2009-04-26 Thread Aahz
In article , namekuseijin wrote: > >I don't like *for* at all. It both makes it tough to get true closures >and also unnecessarily pollutes the namespace with non-local variables. Maybe. Consider this standard Python idiom: for x in L: if x == criterion: break doSomething(x) Obv

Re: An unexpected visit_decref assertion fail (code works under python 2.4, doesn't under 2.5)

2009-04-26 Thread Aahz
In article <71ad1c1d-0b11-4c5c-9e97-e22adf480...@d19g2000prh.googlegroups.com>, Joe Ardent wrote: > >Does anyone have any tips for debugging this? I'd really like to know >what exactly is being decref'd. This has been driving me crazy for a >while. Thanks in advance for any insights or tips!

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Aaron Brady
On Apr 26, 10:52 am, Scott David Daniels wrote: > Travis wrote: > > ... I've noticed that every one of you is wrong about programming. > > Since I can't say it effectively, here's someone who can: > >http://www.youtube.com/watch?v=XHosLhPEN3k > > > That's the answer. > > That is a wonderful link.

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Scott David Daniels
Travis wrote: ... I've noticed that every one of you is wrong about programming. Since I can't say it effectively, here's someone who can: http://www.youtube.com/watch?v=XHosLhPEN3k That's the answer. That is a wonderful link. Thanks for sharing. --Scott David Daniels scott.dani...@acm.org -

Re: Python not importing mysqldb

2009-04-26 Thread Ioannis Lalopoulos
On Apr 25, 11:45 pm, 83nini <83n...@gmail.com> wrote: > 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'

Thread-killing, round 666 (was Re: Lisp mentality vs. Python mentality)

2009-04-26 Thread Aahz
In article , Vsevolod wrote: > >And let's look at my recent experience with Python: I wanted to >implement a daemon process and stumbled at a simplest problem with >threading: neither Thread, nor Threading module provides thread- >killing possibility. Surely, I'm not so experienced in Python as i

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

2009-04-26 Thread tinnews
Grant Edwards wrote: > > I suppose I could do the following:- > > > > lock the mbox > > get the atime > > add the new message with mailbox.mbox.add() > > restore the atime > > unlock the mbox > > You could fix mbox.add(). ;) > Yes, but I'm not sure that I'm that competant!

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

2009-04-26 Thread tinnews
Lawrence D'Oliveiro wrote: > 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" ma

Re: confused with so many python package locations for imports

2009-04-26 Thread Scott David Daniels
Ben Finney wrote: 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: Lisp mentality vs. Python mentality

2009-04-26 Thread Arnaud Delobelle
Peter Otten <__pete...@web.de> writes: > Arnaud Delobelle wrote: > >> def equal_items(iter1, iter2, key=lambda x: x): >>     iter1, iter2 = iter(iter1), iter(iter2) >>     for x, y in izip(iter1, iter2): >>         if key(x) != key(y): >>             return False >>     for x, y in izip_longest(it

Re: ANN: PyGUI 2.0.5

2009-04-26 Thread rzed
Greg Ewing wrote in news:49f4278a.7010...@canterbury.ac.nz: > PyGUI 2.0.5 is available: > >http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ > > More bug fixes for various platforms. > > Still no idea what's causing the "object has been destroyed" > error on Windows XP, though. Does

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread bearophileHUGS
Arnaud Delobelle: > You don't want to silence TypeErrors that may arise from with key() when > x or y is not a Guard, as it could hide bugs in key(). So I would write > something like this: > > def equal_items(iter1, iter2, key=lambda x: x, _fill = object()): >     for x, y in izip_longest(iter1, i

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Piet van Oostrum
> "Ciprian Dorin, Craciun" (CDC) wrote: >CDC> About the compare (a, b, operator.lt) it does the same as a < b, >CDC> where a and b are lists of numbers. >>> a=[1, 2, 3] >>> b=[1, 2, 4] >>> compare (a, b, operator.lt) False >>> a < b True -- Piet van Oostrum URL: http://pietvanoostrum

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Peter Otten
Arnaud Delobelle wrote: > def equal_items(iter1, iter2, key=lambda x: x): >     iter1, iter2 = iter(iter1), iter(iter2) >     for x, y in izip(iter1, iter2): >         if key(x) != key(y): >             return False >     for x, y in izip_longest(iter1, iter2): >         return False >     return

Re: Get item from set

2009-04-26 Thread bearophileHUGS
Peter Otten: > [...] I think Raymond Hettinger posted > an implementation of this idea recently, but I can't find it at the moment. > [...] > class Grab: >     def __init__(self, value): >         self.search_value = value >     def __hash__(self): >         return hash(self.search_value) >     def

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Arnaud Delobelle
Arnaud Delobelle writes: > Another way would be: > > def equal_items(iter1, iter2, key=lambda x: x): > iter1, iter2 = iter(iter1), iter(iter2) > for x, y in izip(iter1, iter2): > if key(x) != key(y): > return False > for x, y in izip_longest(iter1, iter2): >

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Arnaud Delobelle
bearophileh...@lycos.com writes: > You can also use quite less code, but this is less efficient: > > def equal_items(iter1, iter2, key=lambda x: x): > class Guard(object): pass > try: > for x, y in izip_longest(iter1, iter2, fillvalue=Guard()): > if key(x) != key(y): >

Re: PyQt4 - widget signal trouble

2009-04-26 Thread Phil Thompson
On Sun, 26 Apr 2009 14:46:14 +0200, Marco Bizzarri wrote: > On Sun, Apr 26, 2009 at 12:38 PM, Joacim Thomassen > wrote: >> Den Sat, 25 Apr 2009 23:47:57 +0200, skrev Marco Bizzarri: >> >> >> Hello Marco, >> >> python's fcntl() call the regular C fcntl() function and as stated in the >> manual pag

Re: PyQt4 - widget signal trouble

2009-04-26 Thread Marco Bizzarri
On Sun, Apr 26, 2009 at 12:38 PM, Joacim Thomassen wrote: > Den Sat, 25 Apr 2009 23:47:57 +0200, skrev Marco Bizzarri: > > > Hello Marco, > > python's fcntl() call the regular C fcntl() function and as stated in the > manual pages for C fcntl: > > --- Snippet from fcntl man pages -

survey: cool but not so well-known python apps

2009-04-26 Thread Alia Khouri
This mini-survey's purpose is to raise awareness of certain apps that perhaps don't have the marketing profile/momentum of some of the better known python apps out there, but are cool and interesting nonetheless. To this end, please post 3-5+ apps that you think deserve more attention: Here's my

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Vsevolod
On Apr 25, 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 this task to

Re: ANN: PyGUI 2.0.5

2009-04-26 Thread David Robinow
On Sun, Apr 26, 2009 at 5:21 AM, Greg Ewing wrote: > PyGUI 2.0.5 is available: > Still no idea what's causing the "object has been destroyed" > error on Windows XP, though. Does this happen for everyone? > Is there anyone who *has* got 12-scroll.py working for them > on XP? Works fine for me. XP

Re: Get item from set

2009-04-26 Thread Peter Otten
Johannes Bauer wrote: > I have a very simple about sets. This is a minimal example: > The problem is: two instances of x() are equal (__eq__ returns true), > but they are not identical. I have an equal element ("z"), but want to > get the *actual* element ("a") in the set. I.d. in the above examp

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread bearophileHUGS
You can also use quite less code, but this is less efficient: def equal_items(iter1, iter2, key=lambda x: x): class Guard(object): pass try: for x, y in izip_longest(iter1, iter2, fillvalue=Guard()): if key(x) != key(y): return False except TypeError

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Tim Chase
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 zip(a, b)) But I have only one problem, it is suboptimal, in the sense that:

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread bearophileHUGS
Paul Rubin: > Arnaud Delobelle: > > Do you mean imap(comp, a, b)? > > Oh yes, I forgot you can do that.  Thanks. That works and is nice and readable: import operator from itertools import imap def equal_sequences(a, b, comp=operator.eq): """ a and b must have __len__ >>> equal_sequ

Get item from set

2009-04-26 Thread Johannes Bauer
Hi group, I have a very simple about sets. This is a minimal example: #!/usr/bin/python class x(): def __init__(self, y): self.__y = y def __eq__(self, other): return self.__y == other.__y def __hash__(self): return hash(self

Re: PyQt4 - widget signal trouble

2009-04-26 Thread Joacim Thomassen
Den Sat, 25 Apr 2009 23:47:57 +0200, skrev Marco Bizzarri: > Ciao, Joacim. > > Too much since I 'played' with low level calls, so I may be wrong. But > it seems to me you're opening the image and monitoring for changes the > directory. Hence the problem. If you read/write a file, I think the > di

  1   2   >