HTML Conventions

2005-07-04 Thread Patrick Rutkowski
I couldn't help but make an even better list in reference to this thread: http://mail.python.org/pipermail/python-list/2005-July/288678.html Type Convention Example funtion action_with_underscores find_all vari

Re: importing pyc from memory?

2005-07-04 Thread Derek van Vliet
Up to now, I've had all my python scripts defined in XML elements, which were compiled when my program started up using Py_CompileString. This has worked great, but I'm finding that most of the time my app uses to start up is spent in that Py_CompileString, because of the large number of scripts th

Re: importing pyc from memory?

2005-07-04 Thread Derek van Vliet
The second method you describe sounds like it is along the lines of what I need to do. Is there a way to do this using the Python/C API? For instance, if I have the contents of a pyc file loaded entirely into memory, and I have a pointer to the beginning of the file and the size in bytes at my dis

Considering moving from Delphi to Python [Some questions]

2005-07-04 Thread Dark Cowherd
Hi, We program in Delphi in our shop and are generally very happy with it. We are now looking at cross-platform options especially for middle tier and web server. I have been doing a lot of reading and testing of Python, I am falling in love with the language :-) But seems to be be very difficul

Re: importing pyc from memory?

2005-07-04 Thread Thomas Heller
"Derek van Vliet" <[EMAIL PROTECTED]> writes: > The second method you describe sounds like it is along the lines of > what I need to do. Is there a way to do this using the Python/C API? > > For instance, if I have the contents of a pyc file loaded entirely into > memory, and I have a pointer to t

Re: math.nroot

2005-07-04 Thread Mike Meyer
"George Sakkis" <[EMAIL PROTECTED]> writes: > "Steven D'Aprano" <[EMAIL PROTECTED]> wrote: > >> But it doesn't make sense to say that two flags are equal: >> >> keep_processing = True >> more_reading_needed = True >> while more_reading_needed and keep_processing: >> get_more_records() >>

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Christopher Subich
Peter Hansen wrote: > [str(parrot) for parrot in sequence], for example, tells you much more > about what is going on than str(x) does. > > Exactly what, I have no idea... but it says _so_ much more. ;-) Yarr! Avast! Etc! -- http://mail.python.org/mailman/listinfo/python-list

Re: Trapping user logins in python ( post #1)

2005-07-04 Thread Jeff Epler
I don't know of a portable way for an inetd-style daemon to "listen" for user logins. On some systems (including RedHat/Fedora and debian), you may be able to use PAM to do this. (pam modules don't just perform authentication, they can take other actions. As an example, pam_lastlog "prints the l

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Christopher Subich
Carl Banks wrote: > I suspect you're misunderstanding what I mean by heavily functional. > Heavily functional programming is a different mindset altogether. In > heavily functional programming, things like maps and filters and > function applications are actually what you're thinking about. map

Re: importing pyc from memory?

2005-07-04 Thread Jeff Epler
This stupid code works for modules, but not for packages. It probably has bugs. import marshal, types class StringImporter: def __init__(self, old_import, modules): self._import = old_import self._modules = modules def __call__(self, name, *args): module = self.

Re: Considering moving from Delphi to Python [Some questions]

2005-07-04 Thread flamesrock
The curve may take a while, but I'd definately recommend it. While you're at it, why not switch th front end to python too? -- http://mail.python.org/mailman/listinfo/python-list

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-04 Thread Steven Bethard
Erik Max Francis wrote: > Ron Adam wrote: > >> In this case sum and product fulfill 90% (estimate of course) of >> reduces use cases. It may actually be as high as 99% for all I know. >> Or it may be less. Anyone care to try and put a real measurement on it? > > Well, reduce covers 100% of th

Re: math.nroot

2005-07-04 Thread George Sakkis
"Mike Meyer" <[EMAIL PROTECTED]> wrote: > "George Sakkis" <[EMAIL PROTECTED]> writes: > > "Steven D'Aprano" <[EMAIL PROTECTED]> wrote: > > > >> But it doesn't make sense to say that two flags are equal: > >> > >> keep_processing = True > >> more_reading_needed = True > >> while more_reading_needed

Re: importing pyc from memory?

2005-07-04 Thread Bengt Richter
On Mon, 04 Jul 2005 19:25:13 +0200, Thomas Heller <[EMAIL PROTECTED]> wrote: >"Derek van Vliet" <[EMAIL PROTECTED]> writes: > >> The second method you describe sounds like it is along the lines of >> what I need to do. Is there a way to do this using the Python/C API? >> >> For instance, if I have

Existance of of variable

2005-07-04 Thread Josiah Manson
Hello. I am very new to Python, and have been unable to figure out how to check if a variable exists or not. In the following code I have made a kludge that works, but I think that it would be clearer to check if closest exists and not have to initialize it in the first place. How is that check don

Re: Folding in vim

2005-07-04 Thread Terry Hancock
On Monday 04 July 2005 07:42 am, Ivan Van Laningham wrote: > Terry Hancock wrote: > > I also got "space_hi.vim" which highlights tabs > > and trailing spaces, which made it a lot easier to fix the > > problem. > > Is that really the name? I tried searching for it & got no hits. Sorry, no unders

Re: How do you program in Python?

2005-07-04 Thread Aahz
In article <[EMAIL PROTECTED]>, Peter Hansen <[EMAIL PROTECTED]> wrote: > >After 25 years doing this, I've become something of a Luddite as far as >fancy IDEs and non-standard features go... and a huge believer in strict >decoupling between my tools, to the point of ignoring things that bundle

Re: importing pyc from memory?

2005-07-04 Thread Sybren Stuvel
Derek van Vliet enlightened us with: > Up to now, I've had all my python scripts defined in XML elements, > which were compiled when my program started up using > Py_CompileString. This has worked great, but I'm finding that most > of the time my app uses to start up is spent in that > Py_CompileS

Re: importing pyc from memory?

2005-07-04 Thread Derek van Vliet
I do have to do everything you describe here in the current implementation of my system. I realize that importing a pyc file and compiling a string results in two different things. This is okay though as I'm fairly sure this will still suit my needs. As I said, the file format I plan to store thes

Re: Accepted Summer of Code proposals

2005-07-04 Thread Terry Reedy
"A.M. Kuchling" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Fri, 1 Jul 2005 14:22:51 -0400, > Terry Reedy <[EMAIL PROTECTED]> wrote: >> Thanks for posting this and thanks for coordinating the PSF effort. > > I did little beyond writing up that wiki page. David Ascher > has b

Re: Existance of of variable

2005-07-04 Thread tiissa
Josiah Manson wrote: > Hello. I am very new to Python, and have been unable to figure out how > to check if a variable exists or not. In the following code I have made > a kludge that works, but I think that it would be clearer to check if > closest exists and not have to initialize it in the first

Re: Considering moving from Delphi to Python [Some questions]

2005-07-04 Thread Terry Reedy
"Dark Cowherd" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > We program in Delphi in our shop and are generally very happy with it. > We are now looking at cross-platform options especially for middle > tier and web server. > > I have been doing a lot of reading and testing of Pyt

Re: Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread Grig Gheorghiu
How is your Firebird database configured -- Classic Server or Super Server? If it's in classic server mode, you don't need to worry about the host portion. You do need to worry about permissions on the database file. I got it to work by making it 664 and owner + group firebird. Grig -- http://ma

Re: Existance of of variable

2005-07-04 Thread Peter Otten
Josiah Manson wrote: > Hello. I am very new to Python, and have been unable to figure out how > to check if a variable exists or not. In the following code I have made try: variable except NameError: # variable doesn't exist else: # variable exists But it is rare that you actually ne

threads and sleep?

2005-07-04 Thread Jeffrey Maitland
Hello all, I am in the process of writing a multithreading program and what I was wondering is a sleep command in an executing function will affect the threads below it? Here is a basic example of what I mean. def main(): temp_var = True while temp_var == True: if t = threa

Re: Existance of of variable

2005-07-04 Thread Terry Reedy
"Josiah Manson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello. I am very new to Python, and have been unable to figure out how > to check if a variable exists or not. In the following code Python does not have variables is the sense some other languages do. It has (typele

Re: f*cking re module

2005-07-04 Thread Gustavo Niemeyer
> > the only thing I want are the number of places blabla, Re modules > > sucks! and blabla are. > > Your question is still not clear. What you're searching for is > '', which isn't there, so .search returns None, and so > you get that exception (.group takes an argument, anyway). That's what

Re: math.nroot [was Re: A brief question.]

2005-07-04 Thread James Dennett
Steven D'Aprano wrote: > James Dennett wrote: > >> > Yes: 5^2 + -2^2 is 29, however you write it. >> >> *If* you take -2 as a number, but not if you take the number >> as 2 and the unary minus as an operator with lower precedence >> than exponentiation. > > > [snip] > >> Not in this respect.

Re: Existance of of variable

2005-07-04 Thread George Sakkis
Hi Josiah, > Hello. I am very new to Python, and have been unable to figure out how > to check if a variable exists or not. In the following code I have made > a kludge that works, but I think that it would be clearer to check if > closest exists and not have to initialize it in the first place. H

"long int..." exception reported with strange traceback location

2005-07-04 Thread Joe Peterson
I could not find another example of this via internet searches, so here it is... I am wondering if this is a python bug or otherwise. The first example of this happened in a larger program of mine, and the traceback reports the problem at the start of a "for" loop (making no sense), but I cannot

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-04 Thread Erik Max Francis
Steven Bethard wrote: > And it's almost two times slower: That's because you're not using operator.add. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Virtue has never been as respectable as money. -- Mar

Re: "long int..." exception reported with strange traceback location

2005-07-04 Thread Michael Hoffman
Joe Peterson wrote: > I could not find another example of this via internet searches, so here > it is... I am wondering if this is a python bug or otherwise. The > first example of this happened in a larger program of mine, and the > traceback reports the problem at the start of a "for" loop (mak

Re: Existance of of variable

2005-07-04 Thread Benjamin Niemann
George Sakkis wrote: > Hi Josiah, > >> Hello. I am very new to Python, and have been unable to figure out how >> to check if a variable exists or not. In the following code I have made >> a kludge that works, but I think that it would be clearer to check if >> closest exists and not have to initi

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Carl Banks
Christopher Subich wrote: > That said, Python itself is mostly a procedural language, with the > functional tools really being bolted on[1]. [etc., snip] Yeah, that's pretty much what I said in the first place. -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list

HTTP Open -v- File Read

2005-07-04 Thread [EMAIL PROTECTED]
I am relatively new to Python ... I have a script that uses urllib2 to open another XML file off of the same server the PY file is living on. urllib2.urlopen(url).read() I changed a bit of it to use: open(filename, 'r').read() to open the file locally rather than making an HTTP call however the

Re: Existance of of variable

2005-07-04 Thread Terry Reedy
"tiissa" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Variables are stored in two dictionnaries: globals() (for global > variables) and locals() (for the local ones, which are also global on > top level). Within a function, the local namespace is usually *not* a dictionary. D=lo

Re: Trapping user logins in python ( post #1)

2005-07-04 Thread Patrick Rutkowski
On Monday 04 July 2005 13:49, Jeff Epler wrote: > I don't know of a portable way for an inetd-style daemon to "listen" for > user logins. > > On some systems (including RedHat/Fedora and debian), you may be able to > use PAM to do this. (pam modules don't just perform authentication, > they can ta

Re: "long int..." exception reported with strange traceback location

2005-07-04 Thread Terry Reedy
"Michael Hoffman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I came up with a simpler testcase. Strangely, the exception occurs in > the statement *following* the os.utime() call: > > >>> import os, sys > >>> os.utime("foo_test_file", (0, float(sys.maxint+1))) > >>> print "hi"

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-04 Thread Ron Adam
George Sakkis wrote: > And finally for recursive flattening: > > def flatten(seq): > return reduce(_accum, seq, []) > > def _accum(seq, x): > if isinstance(x,list): > seq.extend(flatten(x)) > else: > seq.append(x) > return seq > > flatten(seq) > > [1, 2, 3,

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-04 Thread Steven Bethard
Erik Max Francis wrote: > Steven Bethard wrote: > >> And it's almost two times slower: > > That's because you're not using operator.add. Huh? Please re-read my post. That's exactly what I used. STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: "long int..." exception reported with strange traceback location

2005-07-04 Thread Peter Otten
Terry Reedy wrote: os.utime("foo_test_file", (0, float(sys.maxint+1))) > Traceback (most recent call last): > File "", line 1, in ? > TypeError: utime() arg 2 must be a tuple (atime, mtime) > > which is quite sane.  So maybe bug was introduced in 2.3 which you were > running. But arg 2 *is*

PROBLEM?? deepcopy

2005-07-04 Thread phil
I wrote the following to prove to myself that deepcopy would copy an entire dictionary which contains an instance of a class to one key of another dictionary. Note that after copying adict to ndict['x'] I delete adict. Then ndict['x'] contains a good copy of adict. works great. class aclass:

Re: threads and sleep?

2005-07-04 Thread Peter Hansen
Jeffrey Maitland wrote: > I am in the process of writing a multithreading program and what I was > wondering is a sleep command in an executing function will affect the > threads below it? Note that the "executing function" is itself running inside a thread, specifically the "main thread". The

Re: f*cking re module

2005-07-04 Thread James Stroud
On Monday 04 July 2005 12:39 pm, Gustavo Niemeyer wrote: > > > the only thing I want are the number of places blabla, Re modules > > > sucks! and blabla are. > > > > Your question is still not clear. What you're searching for is > > '', which isn't there, so .search returns None, and so > > you ge

Re: math.nroot [was Re: A brief question.]

2005-07-04 Thread Steven D'Aprano
On Mon, 04 Jul 2005 15:35:56 +0100, Tom Anderson wrote: >>> Also, would it be a good idea for (-1.0) ** 0.5 to evaluate to 1.0j? It >>> seems a shame to have complex numbers in the language and then miss this >>> opportunity to use them! >> >> It's generally true in Python that complex numbers are

Re: f*cking re module

2005-07-04 Thread Erik Max Francis
James Stroud wrote: > Its perhaps that they remember the frustration of being new to programming. > Those "wasted" 1.5 hr sessions getting nowhere add up pretty fast and then > the explicatives begin to flow. Also because the best way to make someone who's having a tantrum look foolish in publ

Re: Existance of of variable

2005-07-04 Thread Steven D'Aprano
On Mon, 04 Jul 2005 21:17:21 +0200, tiissa wrote: > Josiah Manson wrote: >> Hello. I am very new to Python, and have been unable to figure out how >> to check if a variable exists or not. In the following code I have made >> a kludge that works, but I think that it would be clearer to check if >>

Re: Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread Maurice LING
Mathias Waack wrote: > Maurice LING wrote: > > >>I've been using FB1.5 and access the database using Kinterbasdb + >>Python. My connection is established using kinterbasdb.connect() method >>and the parameters host, dns, database, user, password are all defaulted >>to 'None'. >> >>On my own machi

Re: Existance of of variable

2005-07-04 Thread Roy Smith
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Should we *really* be encouraging newbies to mess with globals() and > locals()? Isn't that giving them the tools to shoot their foot off before > teaching them how to put shoes on? Why risk damaging perfectly good footwear? But, seriously, I agree wit

Re: pexpect question....

2005-07-04 Thread [EMAIL PROTECTED]
Hi, I actually replied saying that the process dies when close(wait=0) is done (the reply doesn't show up yet). It is not correct. The process actually runs but ends up in zombie status (defunct). Raghu. -- http://mail.python.org/mailman/listinfo/python-list

readline: edit-and-execute-command

2005-07-04 Thread josh
anybody know why "edit-and-execute-command" doesn't work in python's readline? it doesn't even show up in a dump of readline functions: $ cat fc_test

Re: How do you program in Python?

2005-07-04 Thread Chris Smith
>> My question isn't as all-encompassing as the subject would >> suggest... >> >> I am almost a Python newbie, but I have discovered that I don't >> get along with IDLE, as i can't work out how to run and rerun a >> routine without undue messing about. >> >> What I

Re: How do you program in Python?

2005-07-04 Thread gene tani
+1 on investing in emacs. There's a shiny new release of the Oreilly, which is (a really large book) that a lot of people teach themself out of: http://www.oreilly.com/catalog/gnu3/ But i would also recommend komodo from activestate's IDE, easy and powerful, once you understand what all's in the

Re: pickle alternative

2005-07-04 Thread simonwittber
Ok, I've attached the proto PEP below. Comments on the proto PEP and the implementation are appreciated. Sw. Title: Secure, standard serialization of simple python types. Abstract This PEP suggests the addition of a module to the standard library, which provides a serialization class

What are __slots__ used for?

2005-07-04 Thread Ric Da Force
I am a C# programmer and new to the language and I am trying to debug some code which uses this feature. Can anyone elaborate on what it is and how it is used? Regards, Ric -- http://mail.python.org/mailman/listinfo/python-list

RE: What are __slots__ used for?

2005-07-04 Thread Delaney, Timothy (Tim)
Ric Da Force wrote: > I am a C# programmer and new to the language and I am trying to debug > some code which uses this feature. Can anyone elaborate on what it > is and how it is used? __slots__ is used for memory and performance gains in classes that need them. A class with __slots__ has a fix

Re: What are __slots__ used for?

2005-07-04 Thread Casey Hawthorne
To save a a few bytes (10?) per instance instead of having a dict to hold attributes one has slots! Designed for having lots of instances (millions?) at the same time to save space! "Ric Da Force" <[EMAIL PROTECTED]> wrote: >I am a C# programmer and new to the language and I am trying to debug s

Re: HTML Conventions

2005-07-04 Thread Chinook
Patrick Rutkowski wrote: > I couldn't help but make an even better list in reference to this thread: > I'll go you one better :<)) I found the source of what I pulled that table from: http://jaynes.colorado.edu/PythonGuidelines.html Lee C -- http://mail.python.org/mailman/listinfo/python-l

Re: Considering moving from Delphi to Python [Some questions]

2005-07-04 Thread Dark Cowherd
Stupid of me. I want some feedback on folllwing: anybody who has experience in writing SOAP servers in Python and data entry heavy web applications. Any suggestions? darkcowherd On 7/4/05, Dark Cowherd <[EMAIL PROTECTED]> wrote: > Hi, > > We program in Delphi in our shop and are generally very

Re: "long int..." exception reported with strange traceback location

2005-07-04 Thread Joe Peterson
Yep, my thinking too. Well, maybe it's all related to the same bug somehow. OK, I submitted a bug report, and I included a slight modification of the test case you guys suggested: import sys import os t = 2147483648L os.utime("foo_test_file", (t, t)) print "hi" ---

Re: f*cking re module

2005-07-04 Thread D H
Gustavo Niemeyer wrote: > That's what I love in that news group. Someone comes with a > stupid and arrogant question, and someone else answers in a > calm and reasonable way. ...and then someone else comes along and calls the first person stupid and arrogant, which is deemed QOTW. :) -- http://m

Re: pexpect question....

2005-07-04 Thread Jonathan Ellis
[EMAIL PROTECTED] wrote: > Currently, I am spawning a new thread > that just does pexpect_spawned_child.close(wait=1). It seems to work in > some cases but the child process is occassionally getting deadlocked. I think your only cross-platform option will be to fix the child process to die nicely

Re: wxPy + Py2Exe + sys.argv[0]

2005-07-04 Thread Miki Tebeka
Hello fowlertrainer, > Hi ! > > The problem that when I started the program from CMD, the sys.argv is > show the good path (in my machine the c:\dev\...) from Dialog1.py. > But when I compile it with Py2Exe, and try to start the exe, it has been > not found the hwinfo.ini file what store th

Tkinter + Tcl help

2005-07-04 Thread sunitajain
Hello all, I have a Tcldot package which I am using with Tcl (I source the package by 'load .\libtcldot.so.0' command. Now I want to use this package in Tkinter. Can anyone suggest me how to do this? I tried the foll: root=Tk() root.tk.eval('load ..\libtcldot.so.0') root.mainloop() But I ge

Re: Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread Mathias Waack
Maurice LING wrote: > What I am trying to do is "port" a workable program from my own machine > (Mac OSX) to a larger machine (Linux). So, the DB and the program are > also on the same Linux machine. > > On the Linux machine, I cannot use localhost, so I set host parameter in > kinterbasdb.connec

<    1   2