Re: Is inifinite loop not a good practice?

2006-02-20 Thread Sybren Stuvel
Alvin A. Delagon enlightened us with: > I have to write a python script that would continously monitor and > process a queue database. [...] I've been planning to do an infinite > loop within the script to do this but I've been hearing comments > that infinite loop is a bad programming practice. I

Re: Multiplication optimization

2006-02-20 Thread Peter Otten
Atanas Banov wrote: > Paul McGuire wrote: >> Does Python's run-time do any optimization of multiplication >> operations, like it does for boolean short-cutting? That is, for a >> product a*b, is there any shortcutting of (potentially expensive) >> multiplication operations > > no. and the reason

Re: zope 3.2 and imprt errors

2006-02-20 Thread zunbeltz
Hi Benji Thanks, but i've solved installing zope from svn instead of tarball Regars Zunbeltz -- http://mail.python.org/mailman/listinfo/python-list

Re: number ranges (was Re: Matlab page on scipy wiki)

2006-02-20 Thread Steven D'Aprano
John Zenger wrote: > I strongly agree that Python should promote range or xrange to syntax. I > favor [0..10] rather than [0:10] because 0..10 is inherently easier to > understand. "Inherently"? You mean people are born with an instinctive, unlearnt understanding of ..? Or that our brains are

Re: editor for Python on Linux

2006-02-20 Thread Petr Jakes
Endless stories about IDEs (try to browse through this discussion group first). Of course it depends about users personal needs and taste. So install them and try them (I know, it's really time consuming). I thing there is not the other way to decide which one is the best for YOU. Petr Jakes --

timeit module: am I missing something obvious?

2006-02-20 Thread Steven D'Aprano
When using the timeit module, you pass the code you want to time as strings: import timeit t = timeit.Timer("foo(x, y)", \ """from module import foo x = 27 y = 45 """) elapsed_time = t.timeit() This is all very well, but it feels quite unnatural to me. Why am I passing strings around when funct

Re: timeit module: am I missing something obvious?

2006-02-20 Thread Peter Otten
Steven D'Aprano wrote: > When using the timeit module, you pass the code you > want to time as strings: > > import timeit > t = timeit.Timer("foo(x, y)", \ > """from module import foo > x = 27 > y = 45 > """) > elapsed_time = t.timeit() > > This is all very well, but it feels quite unnatural to

Re: editor for Python on Linux

2006-02-20 Thread billie
I really think that IDLE is one of the best around in Python source editing. The only great lacks are tabs. Does somebody know if is there some IDLE modified version including tabbed browsing, out there? -- http://mail.python.org/mailman/listinfo/python-list

Quesion about the proper use of __slots__

2006-02-20 Thread Zefria
>>> class Fighter: ... '''Small one man craft that can only harm other fighters on their own.''' ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): ... self.fuel = statsTuple[0] ... self.life = statsTuple[1] ... self.armor = statsTuple[2] ...

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Michele Simionato
Alexander Schmolck wrote: > As common lisp and scheme demonstrate you can have high level of dynamism (and > in a number of things both are more dynamic than python) and still get very > good performance (in some cases close to or better than C). Just for personal enlightment, where do you think L

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Jonathon Blake
Steven wrote: > And I'm just waiting for somebody to mention Forth, Probably not the context you expected it to be mentioned in. > > Yet one could potentially have that bytecode interpreter in hardware. > Not potentially, in actuality. I know of only one example, Shouldn't the Forth Chips from

Re: Is inifinite loop not a good practice?

2006-02-20 Thread Alvin A. Delagon
Thanks for the quick heads up! The comparison between implementing an infinite loop and cron is great. I'm beginning to see cron as the better solution between the two specially during crash instances. I'll try to code the script using the two solutions and do some stress testing to determine w

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bonono
Zefria wrote: > >>> class Fighter: > ... '''Small one man craft that can only harm other fighters on > their own.''' > ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): > ... self.fuel = statsTuple[0] > ... self.life = statsTuple[1] > ... self.armor =

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bruno at modulix
Zefria wrote: class Fighter: Old-style classes are deprecated, use new-style class wherever possible: class Fighter(object): > ... '''Small one man craft that can only harm other fighters on > their own.''' > ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): > ...

Re: editor for Python on Linux

2006-02-20 Thread bruno at modulix
Rene Pijlman wrote: > F. Petitjean: > >>Rene Pijlman: >> >>>vi >> >>I beg to disagree :-) Use ed >>"Ed is the standard text editor." >>http://www.gnu.org/fun/jokes/ed.msg.html > > > That was 1991. This is 2006. Yes, but that rant is still a pure jewel of geek madness. -- bruno desthuilliers

Re: share function argument between subsequent calls but not between class instances!

2006-02-20 Thread Duncan Booth
Ben Finney wrote: > Duncan Booth <[EMAIL PROTECTED]> writes: >> If you intend to only use the default some of the time, and at other >> times pass in a different list, then save the 'default' in the >> instance and use a special marker value to indicate when you intend >> the default to be used: >

Re: editor for Python on Linux

2006-02-20 Thread bruno at modulix
Rene Pijlman wrote: > Sriram Krishnan: > >>Check out http://wiki.python.org/moin/PythonEditors. > > > This page can't be taken seriously. vi is not listed. Well, this prove that this page *is* to be taken seriously !-) (René, don't bother replying : this is a troll ;-) -- bruno desthuilli

Re: Removing Non-Unicode Support?

2006-02-20 Thread Jeff Rush
Neal Norwitz wrote: > On 2/17/06, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > >>Neal Norwitz wrote: > > >>Another candidate for removal is the --disable-unicode >>switch. >> >>We should probably add a deprecation warning for that in >>Py 2.5 and then remove the hundreds of >>#idef Py_USING_UNICODE

Re: Python vs. Lisp -- please explain

2006-02-20 Thread bruno at modulix
Torsten Bronger wrote: > Hallöchen! > > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > >>Alexander Schmolck a écrit : >> >> >>>Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >>> >>> [...] It's not a "scripting" language, and it's not interpreted. >>> >>>Of course it is. What d

multiple email recipients

2006-02-20 Thread eight02645999
hi i currently am using this email function that can send single email address def email(HOST,FROM,TO,SUBJECT,BODY,CC=None): import smtplib import string, sys body = string.join(( "From: %s" % FROM, "To: %s" % TO, "Subject: %s" % SUBJECT, "CC: %s" % CC, "", BODY)

Re: Python vs. Lisp -- please explain

2006-02-20 Thread bruno at modulix
Paul Boddie wrote: (snip) > I'm not sure why people get all defensive about Python's > interpreted/scripting designation Because it carries a negative connotation of "slow toy language not suitable for 'serious' tasks". Dynamicity apart, CPython's implementation is much closer to Java than to bas

Re: Python vs. Lisp -- please explain

2006-02-20 Thread bruno at modulix
Harald Armin Massa wrote: >>>OK, but then we should change , >>>which starts with "Python is an interpreted, interactive, >>>object-oriented programming language." > > > I second this motion. Even tried to persuade the site maintainer > before. We should really

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Zefria
>>> class Fighter(object): ... '''Small one man craft that can only harm other fighters on their own.''' ... __slots__ = ["fuel","life","armor","weapon","bulk"] ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): ... self.fuel = statsTuple[0] ... self.life = stat

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Peter Otten
Zefria wrote: > Also, I don't generally do any optimization at all yet (as a highschool > student projects get trashed often enough no to bother over), but in > this special case I'm expecting each "carrier" to have up to 150 > fighters, and 3 to 5 carriers for each of the two teams, which comes >

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bonono
Peter Otten wrote: > Zefria wrote: > > > Also, I don't generally do any optimization at all yet (as a highschool > > student projects get trashed often enough no to bother over), but in > > this special case I'm expecting each "carrier" to have up to 150 > > fighters, and 3 to 5 carriers for each

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Zefria wrote: > Also, I don't generally do any optimization at all yet (as a highschool > student projects get trashed often enough no to bother over), but in > this special case I'm expecting each "carrier" to have up to 150 > fighters, and 3 to 5 carriers for each of the

module time

2006-02-20 Thread Sergey
There is function mktime() -- convert local time tuple to seconds since Epoch in module time. But how about to convert *GMT time tuple* to seconds since Epoch? Is there such function? -- http://mail.python.org/mailman/listinfo/python-list

Re: editor for Python on Linux

2006-02-20 Thread Mystilleef
I'm writing a simple yet powerful text editor for GNOME that is great for Python development called Scribes. It features Snippets (ala Textmate/Eclipse) Automatic word completion Automatic indentation Automatic bracket completion Automatic saving Bookmarks Syntax Highlight etc.. Flash Movie: http

Re: Format file size for printing

2006-02-20 Thread Fuzzyman
abcd wrote: > is there a built-in way of printing the size of a file nicely? > > So if the file size is 103803 bytes it prints out like: 103.8K > or > 0.1MB > > something liek that? Pathutils (small extension module - not builtin) contains a basic function that does this. http://www.voidspac

Re: module time

2006-02-20 Thread jean-michel bain-cornu
Sergey wrote: > There is function > mktime() -- convert local time tuple to seconds since Epoch > in module time. > But how about to convert *GMT time tuple* to seconds since Epoch? > > Is there such function? > > Does mktime(gmtime()) suit your needs ? Regs, jm -- http://mail.python.org/mailma

Re: Komodo - Will it Lock Me In?

2006-02-20 Thread Fuzzyman
Matt wrote: > "Peter Decker" <[EMAIL PROTECTED]> wrote: > > >You should take a look at Dabo, > > Yes, I have Dabo installed on my system. I made a small test app, but was > unable to deploy it. I was getting an error from py2exe, I think, about how my > wxPython installation was not correct. This

Re: multiple email recipients

2006-02-20 Thread Tim Williams (gmail)
On 20 Feb 2006 01:01:38 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:hii currently am using this email function that can send single email address[SNIP]was wondering how to modify the code so as i can send to multiple emailrecipients using "TO"? thanks. You are making the common mistake of t

cElementTree encoding woes

2006-02-20 Thread Diez B. Roggisch
Hi, I've got to deal with a pretty huge XML-document, and to do so I use the cElementTree.iterparse functionality. Working great. Only trouble: The guys creating that chunk of XML - well, lets just say they are "encodingly challanged", so they don't produce utf-8, but only cp1252 instead, togethe

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Torsten Bronger
Hallöchen! bruno at modulix <[EMAIL PROTECTED]> writes: > Torsten Bronger wrote: > >> [...] >> >> I've had such a discussion about TeX already, and my personal >> conclusion was that you can defend almost any opinion in that >> area. However, one should ensure that the definitions make a >> prag

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Zefria
Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd prefer not to see things slipping into Swap space if I can avoid it, and the fighter data would be only part of a larger program. And as I said, learning how to

Regular expression gone mad

2006-02-20 Thread fileexit
Hi, Would someone please tell me what is going on here??!! Why does the following code work >>> a=r"Mem" >>> pat = re.compile(a) >>> m=pat.search(ProcMem, re.DOTALL) >>> m <_sre.SRE_Match object at 0xb7f7eaa0> >>> m.group(0) 'Mem' But this one does not!!! (Search finds nothing) >>> a=r"MemT" >>

Re: multiple email recipients

2006-02-20 Thread Rene Pijlman
[EMAIL PROTECTED]: >was wondering how to modify the code so as i can send to multiple email >recipients using "TO"? thanks. You add RFC 2822 headers. http://www.ietf.org/rfc/rfc2822.txt ("3.6.3. Destination address fields") -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: why does close() fail miserably on popen with exit code -1 ?!

2006-02-20 Thread Rene Pijlman
Atanas Banov: >i ran onto this weirdness today: seems like close() on popen-ed >(pseudo)file fails miserably with exception instead of returning exit >code, when said exit code is -1. Not here. Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] Type "help", "copyright", "credit

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Paul Boddie
bruno at modulix wrote: > Paul Boddie wrote: > (snip) > > > I'm not sure why people get all defensive about Python's > > interpreted/scripting designation > > Because it carries a negative connotation of "slow toy language not > suitable for 'serious' tasks". Dynamicity apart, CPython's > implement

Re: multiple email recipients

2006-02-20 Thread Tim Williams (gmail)
On 20/02/06, Rene Pijlman <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED]:>was wondering how to modify the code so as i can send to multiple email >recipients using "TO"? thanks.You add RFC 2822 headers.http://www.ietf.org/rfc/rfc2822.txt("3.6.3. Destination address fields") RFC 2822 relates to the f

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bonono
Zefria wrote: > Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM > used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd > prefer not to see things slipping into Swap space if I can avoid it, > and the fighter data would be only part of a larger program. > > And

Re: Regular expression gone mad

2006-02-20 Thread Rene Pijlman
fileexit: >(Search finds nothing) > a=r"MemT" pat = re.compile(a) m=pat.search(ProcMem, re.DOTALL) m >From the docs: "Compiled regular expression objects support the following methods and attributes: match( string[, pos[, endpos]])" Your re.DOTALL is seen as start position.

Re: os.mkdir simple help

2006-02-20 Thread XBello
I'm new to python too, but I've read that sys.stdin.readline() is preferred. Is that right? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Paul Boddie
Fredrik Lundh wrote: > Alexander Schmolck wrote: > > > My point was that Guido probably (and fortunately!) was unaware of the > > extent > > to which you can have both dynamism and speed > > any my point was that chosing to ignore something doesn't mean > that you're ignorant. I think it's more c

Re: cElementTree encoding woes

2006-02-20 Thread Peter Otten
Diez B. Roggisch wrote: > I've got to deal with a pretty huge XML-document, and to do so I use the > cElementTree.iterparse functionality. Working great. > > Only trouble: The guys creating that chunk of XML - well, lets just say > they are "encodingly challanged", so they don't produce utf-8, bu

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Peter Otten
[EMAIL PROTECTED] wrote: > > Zefria wrote: >> Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM >> used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd >> prefer not to see things slipping into Swap space if I can avoid it, >> and the fighter data would be only

Pythonpath and gnome panel

2006-02-20 Thread egbert
My pygtk gui can not be started from a gnome panel, because, apparently, the panel doesn't know about my modified PYTHONPATH. So how can I instruct the panel ? -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 =

Re: cElementTree encoding woes

2006-02-20 Thread Fredrik Lundh
Diez B. Roggisch wrote: > I've got to deal with a pretty huge XML-document, and to do so I use the > cElementTree.iterparse functionality. Working great. > > Only trouble: The guys creating that chunk of XML - well, lets just say they > are "encodingly challanged", so they don't produce utf-8, but

Re: cElementTree encoding woes

2006-02-20 Thread Diez B. Roggisch
> Both my python2.3 and python2.4 interpreters seem to know "Windows-1252": > import codecs codecs.open("windows.xml", encoding="windows-1252") > > > Maybe the problem lies in the python installation rather than > cElementTree? Just guessing, though. Hm. No idea why I was under the im

Re: module time

2006-02-20 Thread Fredrik Lundh
"Sergey" wrote: > There is function > mktime() -- convert local time tuple to seconds since Epoch > in module time. > But how about to convert *GMT time tuple* to seconds since Epoch? > > Is there such function? >>> import calendar >>> help(calendar.timegm) Help on function timegm in module calend

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Steven D'Aprano
On Mon, 20 Feb 2006 01:14:20 -0800, Zefria wrote: class Fighter(object): > ... '''Small one man craft that can only harm other fighters on > their own.''' > ... __slots__ = ["fuel","life","armor","weapon","bulk"] > ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): > ...

Re: editor for Python on Linux

2006-02-20 Thread Tim Parkin
Mladen Adamovic wrote: >Hi! > >I wonder which editor or IDE you can recommend me for writing Python >programs. I tried with jEdit but it isn't perfect. > > > I've been using wing for quite some time and it's an excellent dedicated editor for python. If you want flexible debugging in a gui envir

Re: editor for Python on Linux

2006-02-20 Thread Doug Bromley
I did a review of Python IDE's at my blog.  If you're interested you can take a look:http://www.straw-dogs.co.uk/blog/python-ide-reviewI have a couple of links to other reviews on there too.  Worth a look if you're trying to find a good IDE. On 2/20/06, Tim Parkin <[EMAIL PROTECTED]> wrote: Mladen

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bonono
Peter Otten wrote: > > He could be working on a machine with < 1M RAM or some other > > constraints. > > I have 256K, by the way. > Impressive, curious to know what kind of environment it is as it has been a long time I have seen such limited spec. My first x86(IBM PC) had more than that. -- htt

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Peter Otten
[EMAIL PROTECTED] wrote: > > Peter Otten wrote: >> > He could be working on a machine with < 1M RAM or some other >> > constraints. >> >> I have 256K, by the way. >> > Impressive, curious to know what kind of environment it is as it has > been a long time I have seen such limited spec. My first x

Re: Python Oracle Interace on Solaris

2006-02-20 Thread Bill Scherer
Kenny wrote: > Thanks... Im not sure if you would know how to solve this one, but when > I ran my setup python scripts I got the error: library -lclntsh not > found. In the instantclient folder the library exists... is this a > matter of just copying the libraries to a different spot or just > set

Scientific Survey: Working Conditions in Open Source Projects

2006-02-20 Thread Dirk Jendroska
We like to invite you to a survey about the working conditions in Free/Open-Source Software development. This survey is conducted by the Open-Source Research Group of the University of Würzburg (Germany). We will compare work design in open source and proprietary software development. Our findi

Re: editor for Python on Linux

2006-02-20 Thread pikatxu
On Sun, 19 Feb 2006 20:52:54 +0100, Mladen Adamovic wrote: > Hi! > > I wonder which editor or IDE you can recommend me for writing Python > programs. I tried with jEdit but it isn't perfect. eclipse+pydev ? I've never tried it though -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Carl Friedrich Bolz
Torsten Bronger wrote: > Well, I think that it's fair to say that there are by principle deep > run time differences between CPython and, say, a typical > C++-compiled program. Your definition would not reproduce that. I > think it's also fair to say that these differences should be known > if so

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Kay Schluehr
> What's far more interesting to me, however, is that I think there a good > reasons to suspect python's slowness is more of a feature than a flaw: I'd not > be suprised if on the whole it greatly increases programmer productivity and > results in clearer and more uniform code. Yes, it's Guidos ma

Re: any ftpd written in python?

2006-02-20 Thread Kenneth Xie
[EMAIL PROTECTED] wrote: > Kenneth Xie <[EMAIL PROTECTED]> wrote: > >> I need a simple ftpd example in pure python. Is there already such a >> ftpd available? >> Thank you very much in advance. >> > > self-advertising: http://melkor.dnp.fmph.uniba.sk/~garabik/pyftpd.html > it is a bit date

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bruno at modulix
Zefria wrote: > Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM > used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd > prefer not to see things slipping into Swap space if I can avoid it, > and the fighter data would be only part of a larger program. > > And

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Torsten Bronger
Hallöchen! Carl Friedrich Bolz <[EMAIL PROTECTED]> writes: > Torsten Bronger wrote: > >> [...] >> >> My definiton would be that an interpreted language has in its >> typical implementation an interpreting layer necessary for >> typical hardware. Of couse, now we could discuss what is >> "typical

Re: How many web framework for python ?

2006-02-20 Thread bruno at modulix
Alex Martelli wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >... > >>>There are very good web framework for java and ruby , >>>Is there one for python ? >> >>In fact, there are actually too much *good* python web frameworks. > > > Dear Mr. BDFL, > > there are too many good web fra

Re: Print a PDF transparently

2006-02-20 Thread Daniel Crespo
> Have you seen this? > http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html > In particular, the section on using win32print directly. Yes, I have. The problems is that an external program is launched for handling the file and print it. In the case of PDF, acrobat is launched. In the

Re: editor for Python on Linux

2006-02-20 Thread zelova
It was said that Boa is good, but I prefer SPE. WingIDE is good but commercial, I tried it but didn't buy. -- http://mail.python.org/mailman/listinfo/python-list

Re: general coding issues - coding style...

2006-02-20 Thread calmar
On 2006-02-19, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: Bonjour, > > 1/ learn OO and get rid of globals. Well I created two classes now. I put some things global (your point 6). e.g. if it's on Windows or not, and other things. > 2/ use dict or list based dispatch instead of long if/elif/

Re: Print a PDF transparently

2006-02-20 Thread Daniel Crespo
> Have you seen this? > http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html > In particular, the section on using win32print directly. Yes, I have. The problems is that an external program is launched for handling the file and print it. In the case of PDF, acrobat is launched. In the

Re: editor for Python on Linux

2006-02-20 Thread Franz Steinhaeusler
On Sun, 19 Feb 2006 20:52:54 +0100, Mladen Adamovic <[EMAIL PROTECTED]> wrote: >Hi! > >I wonder which editor or IDE you can recommend me for writing Python >programs. I tried with jEdit but it isn't perfect. Maybe you try out DrPython. (Written in Python and wxPython, Autocompletion, Calltips,

Re: Komodo - Will it Lock Me In?

2006-02-20 Thread Peter Decker
On 2/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Yes, I have Dabo installed on my system. I made a small test app, but was > unable to deploy it. I was getting an error from py2exe, I think, about how my > wxPython installation was not correct. This is the kind of thing I am talking > ab

Re: Komodo - Will it Lock Me In?

2006-02-20 Thread BartlebyScrivener
matt> Any other thoughts on Komodo? If you code in any other languages (Perl, Ruby) or need to edit xml, html, php etc, Komodo will handle all of these for you with appropriate color coding, nested loops etc. rd www.dooling.com Matt wrote: > Hi Everybody, > > If I were to use Komodo to write in

Python for PHP Programmers

2006-02-20 Thread Doug Bromley
Hi AllPlease be gentle but I'm primarily a PHP coder after a few years of academic experience in Java I've lost my object orientated programming style and have become a procedural PHP coder.  I started using Python almost 12mths ago now but I'm still very much working in a PHP style.  Obviously I n

Re: number ranges (was Re: Matlab page on scipy wiki)

2006-02-20 Thread John Zenger
Steven D'Aprano wrote: > John Zenger wrote: > >> I strongly agree that Python should promote range or xrange to syntax. >> I favor [0..10] rather than [0:10] because 0..10 is inherently easier >> to understand. > > "Inherently"? > > You mean people are born with an instinctive, unlearnt unders

Re: Python vs. Lisp -- please explain

2006-02-20 Thread Alexander Schmolck
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > > My point was that Guido probably (and fortunately!) was unaware of the > > extent > > to which you can have both dynamism and speed For the convenience of other readers, allow me to restore the snipped second half of

Re: Tab Character?

2006-02-20 Thread Larry Bates
[EMAIL PROTECTED] wrote: > How do I make a tab character in code to split a line read with tabs in > it? > > > Thanks. > > Tom > You should also take a look at csv module. If you are reading lines that contain tab delimeted data the csv module can make splitting very easy. -Larry Bates -- ht

Re: editor for Python on Linux

2006-02-20 Thread Grant Edwards
On 2006-02-19, Rene Pijlman <[EMAIL PROTECTED]> wrote: >>I beg to disagree :-) Use ed >>"Ed is the standard text editor." >>http://www.gnu.org/fun/jokes/ed.msg.html > > That was 1991. This is 2006. That's a joke, son. A flag waver. You're built too low. The fast ones go over your head. Ya

Re: Is Forth for real?

2006-02-20 Thread rickman
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > . > . > . > >on the web for each language. By comparison, even Forth gives 13 million > >plus hits, and who uses Forth? >

Re: [Python-Dev] (-1)**(1/2)==1?

2006-02-20 Thread Jesus Rivero - (Neurogeek)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello! it's Ok. Python gets from 1/2 0 as 0 is the integer part of that division. So, Python is interpreting -1**0 so you get 1 as answer. you should try this (-1)**(1.0/2.0) so 1.0/2.0 is an operation returning 0.5 completely. and you'll get:

Re: Regular expression gone mad

2006-02-20 Thread Paul McGuire
"fileexit" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > Would someone please tell me what is going on here??!! Why does the > following code work > > >>> a=r"Mem" > >>> pat = re.compile(a) > >>> m=pat.search(ProcMem, re.DOTALL) > >>> m > <_sre.SRE_Match object at 0xb7f7eaa0>

Modifying an instances dict to change attribute lookup

2006-02-20 Thread [EMAIL PROTECTED]
Hmm, I know this is something fundamental about how Python implements predicate dispatch, but for some reason I believed that this would work: class delegate_dict(dict): def __init__(self, orig, deleg): dict.__init__(self, orig) self.deleg = deleg def __getitem__(self, nam

Processing text using python

2006-02-20 Thread nuttydevil
Hey everyone! I'm hoping someone will be able to help me, cause I haven't had success searching on the web so far... I have large chunks of text ( all in a long string) that are currently all in separate notebook files. I want to use python to read these strings of text, THREE CHARACTERS AT A TIME.

Re: number ranges (was Re: Matlab page on scipy wiki)

2006-02-20 Thread Tim Hochberg
[EMAIL PROTECTED] wrote: > Tim Hochberg wrote: > >>Colin J. Williams wrote: >> >> It would be good if the range and slice could be merged in some way, although the extended slice is rather complicated - I don't understand it. The semantics for an extended slicing are as follows.

Re: How many web framework for python ?

2006-02-20 Thread Alex Martelli
bruno at modulix <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >... > >>>There are very good web framework for java and ruby , > >>>Is there one for python ? > >> > >>In fact, there are actually too much *good* python web frameworks. > >

Re: timeit module: am I missing something obvious?

2006-02-20 Thread Dan Christensen
Peter Otten <[EMAIL PROTECTED]> writes: > Steven D'Aprano wrote: > >> When using the timeit module, you pass the code you >> want to time as strings: ... >> This is all very well, but it feels quite unnatural to >> me. Why am I passing strings around when functions are >> first class objects? Have

Re: Processing text using python

2006-02-20 Thread Alex Martelli
nuttydevil <[EMAIL PROTECTED]> wrote: > Hey everyone! I'm hoping someone will be able to help me, cause I > haven't had success searching on the web so far... I have large chunks > of text ( all in a long string) that are currently all in separate > notebook files. I want to use python to read the

Re: Processing text using python

2006-02-20 Thread Xavier Morel
nuttydevil wrote: > Hey everyone! I'm hoping someone will be able to help me, cause I > haven't had success searching on the web so far... I have large chunks > of text ( all in a long string) that are currently all in separate > notebook files. I want to use python to read these strings of text, >

Re: Open Relay Test

2006-02-20 Thread Christoph Haas
On Friday 17 February 2006 05:31, D wrote: > Hi all .. how could one test to see if an open relay exists on a > specific email server? My simple favorite... run: telnet relay-test.mail-abuse.org from the mail server in question (and be patient). Kindly Christoph -- ~ ~ ".signature" [M

Re: Modifying an instances dict to change attribute lookup

2006-02-20 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > c = C() > c.x = 1 > assert c.__dict__.__getitem__('x') == c.x > > Could someone please tell me why the first example using a customized > dict does not perform as advertised? Because Python's __getattribute__ is currently not EXACTLY as you im

Re: Processing text using python

2006-02-20 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "nuttydevil" <[EMAIL PROTECTED]> wrote: > Hey everyone! I'm hoping someone will be able to help me, cause I > haven't had success searching on the web so far... I have large chunks > of text ( all in a long string) that are currently all in separate > notebook file

Re: Processing text using python

2006-02-20 Thread [EMAIL PROTECTED]
I think this is what you want: file = open(r'c:/test.txt','r') c = file.read(3) while c: print c c = file.read(3) file.close(); -- http://mail.python.org/mailman/listinfo/python-list

changing value of 'self' when subclassing int

2006-02-20 Thread David Coffin
I'd like to subclass int to support list access, treating the integer as if it were a list of bits. Assigning bits to particular indices involves changing the value of the integer itself, but changing 'self' obviously just alters the value of that local variable. Is there some way for me to c

Re: Tkinter / Aqua (OS X) question (canvas borders)

2006-02-20 Thread Dave Opstad
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > There appears to be an asymmetric "border" > around the inside of the canvas. There was a thread on this last May (you can search for the thread titled "Unusable outer edge of Tkinter canvases?") Fredrik Lundh sug

Re: Scientific Computing with NumPy

2006-02-20 Thread [EMAIL PROTECTED]
Terry Reedy wrote: > "kpp9c" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Numeric, Numarray, & Numpy... some one stick a screwdriver in my > > forehead and end the madness that Numeric has become. > > > For crying all night! Numpy was Numeric's nickname > > Given that NumPy *i

Re: Processing text using python

2006-02-20 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > I think this is what you want: > > file = open(r'c:/test.txt','r') > > c = file.read(3) > while c: > print c > c = file.read(3) > > file.close(); Or: def read3(): return file.read(3) for chars in iter(read3, ''): ... do something

Re: Processing text using python

2006-02-20 Thread Fredrik Lundh
"nuttydevil" <[EMAIL PROTECTED]> wrote: > Hey everyone! I'm hoping someone will be able to help me, cause I > haven't had success searching on the web so far... I have large chunks > of text ( all in a long string) that are currently all in separate > notebook files. I want to use python to read t

Re: preserving POST data

2006-02-20 Thread Christoph Haas
On Thursday 16 February 2006 22:35, Steve Young wrote: > Lets say that I'm filling out a form and the information gets sent to > another server first for some processing(before the one that it > "should" go to). But from there, I want that intermediate server to be > able to preserve this POST d

Re: Python 3000 deat !? Is true division ever coming ?

2006-02-20 Thread Dave Hansen
Caution: bunny trail ahead. Feel free to skip this message, as it contains no useful content whatever... On Sat, 18 Feb 2006 12:09:02 +1100 in comp.lang.python, Steven D'Aprano <[EMAIL PROTECTED]> wrote: [...] > >I've never even used Matlab. But I have a calculator. (Actually I have >about half

Re: Regular expression gone mad

2006-02-20 Thread plahey
This may not be enough for what you really want to do, but, given what you have shown above, regex is the wrong tool for the job. Use the string method startswith: for line in ProcMem.split('\n'): if line.startswith( 'Mem' ): # do stuff -- http://mail.python.org/mailman/listinfo/pyt

Re: How many web framework for python ?

2006-02-20 Thread Steve Holden
Alex Martelli wrote: > bruno at modulix <[EMAIL PROTECTED]> wrote: > > >>Alex Martelli wrote: >> >>>Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >>> ... >>> >There are very good web framework for java and ruby , >Is there one for python ? In fact, there are actually too much

Re: editor for Python on Linux

2006-02-20 Thread Fabio Zadrozny
You could try Eclipse with Pydev: http://pydev.sf.net or its commercial counterpart: Pydev Extensions: http://www.fabioz.com/pydev -- runs on linux / mac / windows ... Cheers, Fabio -- Fabio Zadrozny -- Software Developer ESSS - Engineering

  1   2   3   >