Re: Need a compelling argument to use Django instead of Rails

2006-07-27 Thread Kay Schluehr
Jaroslaw Zabiello wrote: > Of course, I you like, you can freeze every object you want and nobody can > be able to open and change it. You can also trace all activity for changing > something to objects because Ruby has nice system hooks implemented. Ruby > has nice security system (private, prote

Re: httplib, threading, wx app freezing after 4 hours

2006-07-27 Thread Dermot Doran
According to the "wxPython in Action" book using the wx.CallAfter function in a non-gui thread is a safe way for threads to call functions that will then update the gui in the gui thread.   Cheers!!   Dermot.   On 23/07/06, Mark rainess <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote:> Mark rain

Re: Re:[OT] Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
Bruno Desthuilliers wrote: > Ray wrote: > > Bruno Desthuilliers wrote: > > > >>Ray wrote: > >>Ray, please, don't top-post > > > > > > Um, top-post? I'm using Google News and it looks like it is placed > > correctly in the thread... or you're referring to a different thing? > > http://en.wikipedia.

Re:[OT] Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Bruno Desthuilliers
Ray wrote: > Bruno Desthuilliers wrote: > >>Ray wrote: >>Ray, please, don't top-post > > > Um, top-post? I'm using Google News and it looks like it is placed > correctly in the thread... or you're referring to a different thing? http://en.wikipedia.org/wiki/Top-posting -- bruno desthuilliers

Re: How to find difference in years between two dates?

2006-07-27 Thread John Machin
thebjorn wrote: > John Machin wrote: > > thebjorn wrote: > > > John Machin wrote: > > > > thebjorn wrote: > [...] > > > > Holy code bloat, Batman! Try this: > > > > > > > > return now.year - born.year - (birthday > now) > > > > > > yuck :-) > > > > But this: > > return now.year - born.year

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
Bruno Desthuilliers wrote: > Ray wrote: > Ray, please, don't top-post Um, top-post? I'm using Google News and it looks like it is placed correctly in the thread... or you're referring to a different thing? Ray -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
John Machin wrote: > Ray wrote: > > > The argument against this is that since development with Python is so > > rapid, you're supposed to always equip your code with extensive unit > > tests. I like Python but I've never really bought that argument--I > > guess I've been doing Java too long :) > >

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
Sybren Stuvel wrote: > Ray enlightened us with: > > Huh? No. The compiler will always tell you. Have you ever tried Java > > before? > > I know what I'm talking about, I've got a degree in Computer Science > from the University of Amsterdam. Then how come you didn't know that the Java compiler wi

Re: Worarrounding hardcoded Option class in optparse in Python 2.3

2006-07-27 Thread Pupeno
For the record, the copy and paste fix seems to have worked, so far. Pupeno wrote: > Hello, > I am doing some extreme use of optparse, that is, extending it as > explained on > http://docs.python.org/lib/optparse-other-reasons-to-extend-optparse.html > I have subclassed OptionParser and Option. M

Re: Need a compelling argument to use Django instead of Rails

2006-07-27 Thread Bruno Desthuilliers
Jaroslaw Zabiello wrote: > On Wed, 26 Jul 2006 18:23:22 +0200, Bruno Desthuilliers wrote: > > Care to write an external DSL in Ruby ? >>> >>>? >> >>I mean : write a parser and interpreter for a DSL. In Ruby. > > > I see. Nope. I do not like code generators. I'm not talking about "code gen

Re: self question

2006-07-27 Thread Duncan Booth
Mike wrote: > I think the answer is that 'def' is an executable statement in python > rather than a definition that the compiler interprets at compile time. > > As a result the compiler can evaluate 'foo()' when it defines 'bar', so > it does. > > The following works as expected: > def bar(): >

Re: Need a compelling argument to use Django instead of Rails

2006-07-27 Thread Bruno Desthuilliers
Jaroslaw Zabiello wrote: > On Wed, 26 Jul 2006 18:20:44 +0200, Bruno Desthuilliers wrote: > > >>May I suggest that you learn some Lisp dialect ? > > > Nope. I hate Lisp syntax. This should not prevent you from learning it - at least, you'd then avoid making dumb statements... > >>>Of course

Re: Tkinter pack Problem

2006-07-27 Thread H J van Rooyen
"Simon Forman" <[EMAIL PROTECTED]> wrote: | I find the "Tkinter reference: a GUI for Python" under "Local links" on | this page http://infohost.nmt.edu/tcc/help/lang/python/tkinter.html to | be very helpful. It has a decent discussion of the grid layout | manager. | | HTH, | ~Simon Thanks am c

Re: splitting words with brackets

2006-07-27 Thread Paul McGuire
"Tim Chase" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> >>> r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+') > >> >>> r.findall(s) > >>['(a c)b(c d)', 'e'] > > > > Ah, it's exactly what I want! I thought the left and right > > sides of "|" are equal, but it is not true. > > I

Re: a print bug?

2006-07-27 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > > Sybren Stuvel wrote: >> It has nothing to do with the print command, and everything with >> floating point precision. See http://docs.python.org/tut/node16.html > > > how about the discrepancy between > print 1.2345 > > 1.2345 > print "%10.3f" % 1.2345

Re: How to find difference in years between two dates?

2006-07-27 Thread thebjorn
John Machin wrote: > thebjorn wrote: > > John Machin wrote: > > > thebjorn wrote: [...] > > > Holy code bloat, Batman! Try this: > > > > > > return now.year - born.year - (birthday > now) > > > > yuck :-) > > But this: > return now.year - born.year - (birthday > now and 1 or 0) is not yuck?

Re: MySql

2006-07-27 Thread Atanas Banov
[EMAIL PROTECTED] wrote: > sorry guys... > > forget about the auto incrementer for a second. > > the entry is not being recorded. that is my problem. the script does > not work. thanks. after Dijkstra: "the use of mySql cripples the mind; its teaching should, therefore, be regarded as a criminal

Re: MySql

2006-07-27 Thread John Machin
[EMAIL PROTECTED] wrote: > John Machin wrote: > > [EMAIL PROTECTED] wrote: > > > HI, > > > > > > I'm having trouble writing to a MySql db using python and the MySQLdb > > > module. Here is the code: > > > > > > import MySQLdb > > > base = MySQLdb.connect(host="localhost", user="blah", passwd="blah"

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Bruno Desthuilliers
Steve Jobless wrote: > Sybren Stuvel wrote: > >>Steve Jobless enlightened us with: >> >>>The first case can be just a typo, like: >>> >>> x.valeu = 5 >>> >>>I make typos all the time. Without a spell checker, this message >>>would be unreadable :). >> >>Then learn to read what you type, as you ty

locked file

2006-07-27 Thread Kirt
i have a code that backsup file from src to dest. Now if some of the files are locked , i need to skip those files.. I was trying to use fctl module but it can be used only in unix i suppose. is there anyother way? i am using windows os. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread John Machin
Ray wrote: > The argument against this is that since development with Python is so > rapid, you're supposed to always equip your code with extensive unit > tests. I like Python but I've never really bought that argument--I > guess I've been doing Java too long :) > In Java, if you don't always e

Re: MySql

2006-07-27 Thread miker2
John Machin wrote: > [EMAIL PROTECTED] wrote: > > HI, > > > > I'm having trouble writing to a MySql db using python and the MySQLdb > > module. Here is the code: > > > > import MySQLdb > > base = MySQLdb.connect(host="localhost", user="blah", passwd="blah", > > db="test_py") > > cursor = base.curs

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Bruno Desthuilliers
Ray wrote: Ray, please, don't top-post (snip) > Also having to check whether a name has already existed can be a major > pain in the butt with Python. assert 'somename' not in dir(someObject) (snip) > Regarding the lack of privacy, s/privacy/language-inforced access restriction/ > --I guess

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
Sybren Stuvel wrote: > Ray enlightened us with: > > Also having to check whether a name has already existed can be a > > major pain in the butt with Python. With Java you always know when a > > name has already existed, and what type is bound to the name. I > > consider this to be a Good Thing (tm

Re: MySql

2006-07-27 Thread John Machin
[EMAIL PROTECTED] wrote: > HI, > > I'm having trouble writing to a MySql db using python and the MySQLdb > module. Here is the code: > > import MySQLdb > base = MySQLdb.connect(host="localhost", user="blah", passwd="blah", > db="test_py") > cursor = base.cursor() > cursor.execute("INSERT INTO table

Re: How to force a thread to stop

2006-07-27 Thread Nick Craig-Wood
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hans wrote: > > Is there a way that the program that created and started a thread also stops > > it. > > (My usage is a time-out). > > > > E.g. > > > > thread = threading.Thread(target=Loop.testLoop) > > thread.start() # This thread is expected to

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > John Henry wrote: > > Granted. Threaded program forces you to think and design your > > application much more carefully (to avoid race conditions, dead-locks, > > ...) but there is nothing inherently *non-robust* about threaded > > applications. > > Indeed. Let's just g

Re: MySql

2006-07-27 Thread miker2
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, miker2 wrote: > > > import MySQLdb > > base = MySQLdb.connect(host="localhost", user="blah", passwd="blah", > > db="test_py") > > cursor = base.cursor() > > cursor.execute("INSERT INTO table (field) VALUES (int)") > > > > this does not work

Re: function to convert degree (hour), minute, seconds string to integer

2006-07-27 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, John Machin wrote: > You may wish to put more restrictions on the separators ... I would be > suspicious of cases where dms[2] != dms[5]. What plausible separators > are there besides ":"? Why allow alphabetics? If there's a use case for > "23h59m59s", that would have to be

Re: How to force a thread to stop

2006-07-27 Thread bryanjugglercryptographer
Carl J. Van Arsdall wrote: > [EMAIL PROTECTED] wrote: > > Carl J. Van Arsdall wrote: > > > >> [EMAIL PROTECTED] wrote: > >> > >>> Carl J. Van Arsdall wrote: > >>> > >>> I don't get what threading and Twisted would to do for > >>> you. The problem you actually have is that you sometimes > >>> need

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
Russell Warren wrote: > This is something I have a streak of paranoia about (after discovering > that the current xmlrpclib has some thread safety issues). Is there a > list maintained anywhere of the modules that are aren't thread safe? It's much safer to work the other way: assume that librari

Re: How to force a thread to stop

2006-07-27 Thread Paul Rubin
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > Ugh... Seems to me it would be better to find some Python library > for SSH, something similar to telnetlib, rather than doing an > os.system() per command line. EACH of those os.system() calls probably > causes a full fork() operation on Linux/

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
John Henry wrote: > > > > Carl, > > OS writers provide much more tools for debugging, tracing, changing > > the priority of, sand-boxing processes than threads (in general) It > > *should* be easier to get a process based solution up and running > > andhave it be more robust, when compared to a th

Re: How to find difference in years between two dates?

2006-07-27 Thread Bruno Desthuilliers
thebjorn wrote: > Bruno Desthuilliers wrote: > [...] > >>Possible solution: >> >>import mx.DateTime as dt >>def age(date): >>return dt.Age(dt.today(), date).years >>born = dt.Date(1967, 5, 1) >>assert age(born) == 39 > > > dealbreaker: > age(datetime.date(1970,5,2)) > (snip traceback) W

Re: MySql

2006-07-27 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, miker2 wrote: > import MySQLdb > base = MySQLdb.connect(host="localhost", user="blah", passwd="blah", > db="test_py") > cursor = base.cursor() > cursor.execute("INSERT INTO table (field) VALUES (int)") > > this does not work but the interesting thing is, there is an > AUTO

Re: builtin function compile exceptions thrown?

2006-07-27 Thread Martin v. Löwis
James Thiele wrote: > What exceptions (if any) can the python builtin compile() function > throw besides SyntaxError? - TypeError, if the parameters are wrong/too many/too few - Any errors that a codec may raise, if there is an encoding declaration, plus (pre 2.5) MemoryError if the encoding is

Re: write()

2006-07-27 Thread miker2
manuhack wrote: > How about write mode? Changing r to w doesn't work... > > [EMAIL PROTECTED] wrote: > > manuhack wrote: > > > I copied the lines > > > > > > f=open('/tmp/workfile', 'w') > > > print f > > > f.close() > > > > > > from Python 2.4 Documentation 7.2. But it said IOerror No such file

<    1   2   3