Re: Python less error-prone than Java

2006-06-04 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: >>> Simon Percivall wrote: First: It's perfectly simple in Java to create a binary sort that sorts all arrays that contain objects; so wrong there. >>> My point was that the *same* Java source example, directl

Re: Python less error-prone than Java

2006-06-03 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Neil Hodgson <[EMAIL PROTECTED]> wrote: >Alan Morgan wrote: > >> Since Java doesn't allow function overloading that clearly can't be >> the way. J2SE 5.0 allows generic classes and functions that operate >> on generic

Re: Python less error-prone than Java

2006-06-03 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: >Simon Percivall wrote: > > First: It's perfectly simple in Java to create a binary sort that > > sorts all arrays that contain objects; so wrong there. > >My point was that the *same* Java source example, directly conv

Re: Queue can result in nested monitor deadlock

2006-04-17 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Jonathan Amsterdam <[EMAIL PROTECTED]> wrote: >If you don't want to call it deadlock, fine, but the program execution >I describe will make no progress to the end of time. Thread 2 can never >put anything in the queue, because Thread 1 holds M, and Thread 1 will >nev

Re: list.clear() missing?!?

2006-04-12 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Peter Hansen <[EMAIL PROTECTED]> wrote: >Alan Morgan wrote: >> Right. I was wondering what would happen in this case: >> >> s=[1,2,3] >> t=s >> s.clear() >> t # [] or [1,2,3]?? >> >> If you know y

Re: list.clear() missing?!?

2006-04-12 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Wed, 12 Apr 2006 15:36:47 -0700, Alan Morgan wrote: > >> Serious question: Should it work more like "s=[]" or more like >> "s[:]=[]". I'm assuming the latte

Re: list.clear() missing?!?

2006-04-12 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Raymond Hettinger <[EMAIL PROTECTED]> wrote: >[Steven Bethard] >> I think these are all good reasons for adding a clear method, but being >> that it has been so hotly contended in the past, I don't think it will >> get added without a PEP. Anyone out there willing t

Re: How can I reduce the number of queries to my PostgreSQL database?

2006-04-10 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, SR <[EMAIL PROTECTED]> wrote: >As a starter project for learning Python/PostgreSQL, I am building a >Books database that stores information on the books on my bookshelf. > >Say I have three tables. > >Table "books" contains rows for book_id, title, subtitle, ISBN. >

Re: efficiency of range() and xrange() in for loops

2006-04-06 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Georg Brandl <[EMAIL PROTECTED]> wrote: >Alan Morgan wrote: > >>>range is giving you a real list, while xrange is giving you an xrange object. >>>Have you tried to slice an xrange object? Or using .append on it? >> >

Re: efficiency of range() and xrange() in for loops

2006-04-05 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Erik Max Francis <[EMAIL PROTECTED]> wrote: >Alan Morgan wrote: > >> In article <[EMAIL PROTECTED]>, >> Giovanni Bajo <[EMAIL PROTECTED]> wrote: > > >>>Because you assume that the only use-case of range() is

Re: efficiency of range() and xrange() in for loops

2006-04-05 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Georg Brandl <[EMAIL PROTECTED]> wrote: >Alan Morgan wrote: >> In article <[EMAIL PROTECTED]>, >> Giovanni Bajo <[EMAIL PROTECTED]> wrote: >>>Steve R. Hastings wrote: >>> >>>>> in Pyth

Re: efficiency of range() and xrange() in for loops

2006-04-05 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Giovanni Bajo <[EMAIL PROTECTED]> wrote: >Steve R. Hastings wrote: > >>> in Python 2.X, range is defined to return a list. if you start >>> returning something else, you'll break stuff. >> >> Perhaps I'm mistaken here, but I don't see how this optimization could >>

Re: Too Many if Statements?

2006-02-08 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Pierre Quentel <[EMAIL PROTECTED]> wrote: >This is because Python has a hidden mechanism to detect programs >generated by Perl scripts, and make them crash with no explanation In my case it turned out to be python having a hidden method to detect when you are using

Re: Too Many if Statements?

2006-02-07 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Bryan Olson <[EMAIL PROTECTED]> wrote: >Alan Morgan wrote: >> slogging_away wrote: >> >>>Hi - I'm running Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 >>>32 bit (Intel)] on win32, and have a

Re: Too Many if Statements?

2006-02-07 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, slogging_away <[EMAIL PROTECTED]> wrote: >Hi - I'm running Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 >32 bit (Intel)] on win32, and have a script that makes numerous checks >on text files, (configuration files), so discrepancies can be reported. > The scr

Re: How do I dynamically create functions without lambda?

2006-02-02 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Alex Martelli <[EMAIL PROTECTED]> wrote: >Alan Morgan <[EMAIL PROTECTED]> wrote: > ... >> Excessive cleverness can lead to unmaintainable code. So can excessive >> stupidity. > >+1 QOTW. import blush >> Sinc

Re: How do I dynamically create functions without lambda?

2006-02-01 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Sat, 28 Jan 2006 00:13:28 -0800, Kay Schluehr wrote: > >[snip lambda calculus stuff] > >> In Python you can write: >> >> Y = lambda g: (lambda f: g(lambda arg: f(f)(arg))) (lambda f: g(lambda >> arg: f(f)(arg))) >> >>

Re: lies about OOP

2004-12-14 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, projecktzero <[EMAIL PROTECTED]> wrote: >I know this might not be the correct group to post this, but I thought >I'd start here. > >A co-worker considers himself "old school" in that he hasn't seen the >light of OOP.(It might be because he's in love with Perl...but t