Re: pg_result_status() alternative?

2009-01-07 Thread Qian Xu
Gerhard Häring wrote: > What are you testing, really? "Normal" Python code should use a > PostgreSQL DB-API module or a wrapper on top of it, like SQLAlchemy. > > Generally, you shouldn't have to drop down to protocol-level functions, > unless you're developing a PostgreSQL adapter yourself. > >

Re: why cannot assign to function call

2009-01-07 Thread Steven D'Aprano
On Wed, 07 Jan 2009 10:17:55 +, Mark Wooding wrote: > Steven D'Aprano wrote: > >> Only in the sense that the behaviour of *real world* objects don't >> entirely match the behaviour of Python objects. If you just accept that >> Python objects can be in two places at once, an unintuitive conce

Re: Replying to list messages

2009-01-07 Thread Ben Finney
Paul McNett writes: > Ben Finney wrote: > > For Thunderbird (which I see you're using, Paul), the open bug > > report is > > https://bugzilla.mozilla.org/show_bug.cgi?id=45715>. > > Meanwhile, you can install an add-on to provide the function > > http://www.juergen-ernst.de/addons/replytolist.htm

os.fork and pty.fork

2009-01-07 Thread Eric Snow
I am trying to wrap my head around an issue here that has to do with running python without a tty. I use pexpect to connect to ssh and run some commands. However, if my script runs from a process which I forked using os.fork my pexpect spawn object can't open a good file descriptor in which to ru

Re: frontend + backend style application design

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 3:56 PM, Steven Woody wrote: > I am considering write an application, its core functionalities should > be implemented in a command-line application with which a user can > interact via its command line interface. This kind of command line > interface can help batch usage of

frontend + backend style application design

2009-01-07 Thread Steven Woody
Hi, I am considering write an application, its core functionalities should be implemented in a command-line application with which a user can interact via its command line interface. This kind of command line interface can help batch usage of the application. On the other hand, I still want a GUI

Re: parallel and/or synchronous start/run/stop on multiple boxes

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 3:44 PM, Ned Deily wrote: > The multiprocessing module, new in the 2.6 standard library and > available in PyPi as a backport to 2.4 and 2.5, supports managing of > processes on both local and remote machines. The 2.6 module > documentation has an "example/demo of how to us

Re: asynchronous events with multithreading and multiprocessing with circuits

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 3:45 PM, James Mills wrote: > For those interested, I have just completed implementing > multiprocessing support for circuits (1). (...) PS: circuits can be found on PyPi or here: http://trac.softcircuits.com.au/circuits/ The code/support I mentioned is in the development

asynchronous events with multithreading and multiprocessing with circuits

2009-01-07 Thread James Mills
Hi folks, For those interested, I have just completed implementing multiprocessing support for circuits (1). It has historically always had multithreading support. These components can be found in circuits.workers and are called: Thread and Process The reason these exist is to perform "work", ie:

Re: parallel and/or synchronous start/run/stop on multiple boxes

2009-01-07 Thread Ned Deily
In article , "James Mills" wrote: > On Thu, Jan 8, 2009 at 3:08 PM, Shane wrote: > > Consider a network of 3 fully-connected boxes i.e. every box as a TCP- > > IP connection to every other box. > > > > Suppose you start a python program P on box A. Is there a Python > > mechanism for P to send

Re: Replying to list messages

2009-01-07 Thread Paul McNett
Ben Finney wrote: Paul McNett writes: [Some day hopefully I'll remember to change the to: address to python-list@python.org instead of the original sender. Even better: Take full advantage of the standards-compliant messages from the list, by using the “Reply to list” function of your RFC 23

Re: length of a tuple or a list containing only one element

2009-01-07 Thread Glenn Linderman
On approximately 11/3/2008 11:55 AM, came the following characters from the keyboard of Tim Chase: For making a literal tuple, parentheses are irrelevant; only the commas matter: I don't think I'd go so far as to say that the parentheses around tuples are *irrelevant*...maybe just relevant in se

Re: why cannot assign to function call

2009-01-07 Thread Terry Reedy
Rhodri James wrote: On Thu, 08 Jan 2009 00:45:06 -, wrote: When I started using Python I had no problem with Python's assignment semantics because I had been using references in Perl for years. I did not have a very hard time with Perl's references, after I recognized their similarities t

Re: parallel and/or synchronous start/run/stop on multiple boxes

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 3:08 PM, Shane wrote: > Consider a network of 3 fully-connected boxes i.e. every box as a TCP- > IP connection to every other box. > > Suppose you start a python program P on box A. Is there a Python > mechanism for P to send a copy of itself to box B or C then start that >

RE: Multiprocessing takes higher execution time

2009-01-07 Thread Sibtey Mehdi
Hello, Please see the code I have send in attachment. Any suggestions will highly appreciate. Thanks and Regards, Gopal -Original Message- From: Grant Edwards [mailto:inva...@invalid] Sent: Wednesday, January 07, 2009 8:58 PM To: python-list@python.org Subject: Re: Multiprocessing takes

Replying to list messages (was: Unexpected scientific notation)

2009-01-07 Thread Ben Finney
Paul McNett writes: > [Some day hopefully I'll remember to change the to: address to > python-list@python.org instead of the original sender. Even better: Take full advantage of the standards-compliant messages from the list, by using the “Reply to list” function of your RFC 2369 compliant mail

parallel and/or synchronous start/run/stop on multiple boxes

2009-01-07 Thread Shane
Consider a network of 3 fully-connected boxes i.e. every box as a TCP- IP connection to every other box. Suppose you start a python program P on box A. Is there a Python mechanism for P to send a copy of itself to box B or C then start that program P on B or C by running a method p in P? Is there

Re: parse/slice/...

2009-01-07 Thread Tim Arnold
"rcmn" wrote in message news:51451b8a-6377-45d7-a8c8-54d4cadb2...@n33g2000pri.googlegroups.com... > I'm not sure how to call it sorry for the subject description. > Here what i'm trying to accomplish. > the script i'm working on, take a submitted list (for line in file) > and generate thread fo

Re: Unexpected scientific notation

2009-01-07 Thread Paul McNett
[Some day hopefully I'll remember to change the to: address to python-list@python.org instead of the original sender. I always end up sending the first reply to the sender, then going "oops, forgot to hit 'reply-all'", and sending another copy to the list.] Ben Finney wrote: Paul McNett writ

Re: Generator metadata/attributes

2009-01-07 Thread Rob Williscroft
wrote in news:d301c93a-8a73-4cbb-9601-fe0c18a94f97 @v5g2000prm.googlegroups.com in comp.lang.python: > I realise I could create my own wrapper that implements __next__ (I am > using Python 3 and haven't checked the exact interface required, but I > guess it's something like that), and add the inf

Re: Generator metadata/attributes

2009-01-07 Thread Jeff McNeil
You'll see the same behavior if you attempt to add an attribute to an instance of object as well. >>> object().t = 5 Traceback (most recent call last): File "", line 1, in AttributeError: 'object' object has no attribute 't' >>> You'll have to build your own iterator or wrap the generator obje

Re: Interpreter & Thread state & Frame structures.

2009-01-07 Thread Benjamin
On Jan 7, 7:42 am, alessiogiovanni.bar...@gmail.com wrote: > Hi to all, > there are some fields in the PyInterpreterState and PyThreadState > obscures. > PyInterpreterState: >   1) Why there are the fields *next and *tstate_head? When there are multiple interpreters active, they are kept in a link

Re: Generator metadata/attributes

2009-01-07 Thread James Stroud
acooke@gmail.com wrote: Hi, (I searched back and found some previous discussion on generator attributes that seemed to be related to callable generators - this is NOT that, as far as I can tell) I want to associate some data with a generator. This is in a decorator function, as it happens;

Re: How to store passwords?

2009-01-07 Thread Rhodri James
On Wed, 07 Jan 2009 21:06:07 -, Oltmans wrote: But the thing is that I will ask the user for user name and password only once i.e. when they start the application for the first time. After that, I'm not supposed to ask the user name and password again. So in this scenario, if I store a hash

Re: Distutils, bdist_XXX, rpmbuild issues

2009-01-07 Thread Gerry Reno
Ben Finney wrote: Gerry Reno writes: We have an application, foo-5.0.0, and we want to put out some pre-release candidates for testing, so we set the version to "5.0.0_rc1" in setup.py. That's where your problems start (as you no doubt surmised). If you want version numbers to compar

Generator metadata/attributes

2009-01-07 Thread acooke . org
Hi, (I searched back and found some previous discussion on generator attributes that seemed to be related to callable generators - this is NOT that, as far as I can tell) I want to associate some data with a generator. This is in a decorator function, as it happens; the generator is being retur

Re: why cannot assign to function call

2009-01-07 Thread Rhodri James
On Thu, 08 Jan 2009 00:45:06 -, wrote: When I started using Python I had no problem with Python's assignment semantics because I had been using references in Perl for years. I did not have a very hard time with Perl's references, after I recognized their similarities to C's pointers. But

subclassing multiprocessing.Process

2009-01-07 Thread James Mills
Hey all, Just a quick clarification on multiprocessing' Process object. If I were to subclass this, say: class Foo(Process): def foo(self): ... def run(self): ... Would the parent and child objects be identical ? That is, would the same methods of Foo exist in the child ? Ba

Re: Distutils, bdist_XXX, rpmbuild issues

2009-01-07 Thread Ben Finney
Gerry Reno writes: > We have an application, foo-5.0.0, and we want to put out some > pre-release candidates for testing, so we set the version to > "5.0.0_rc1" in setup.py. That's where your problems start (as you no doubt surmised). If you want version numbers to compare in a certain order, yo

mmap doesn't support weakref

2009-01-07 Thread Neal Becker
r = weakref.ref (m) TypeError: cannot create weak reference to 'mmap.mmap' object I believe it would be very useful for mmap object to support weakref. Can it be added? -- http://mail.python.org/mailman/listinfo/python-list

mmap only supports string

2009-01-07 Thread Neal Becker
Problem is, AFAIK a string can only be created as a copy of some other data. Say I'd like to take some large object and read/write to/from mmap object. A good way to do this would be the buffer protocol. Unfortunately, mmap only supports string. A string could only be created after copying t

Distutils, bdist_XXX, rpmbuild issues

2009-01-07 Thread Gerry Reno
I've been trying to use the "built distribution" distutils commands such as bdist_rpm to create distro-specific packages for python applications but I'm running into some thorny issues specifically with pre-release versioning of source distributions and built distributions and how to get a "fin

Re: Unexpected scientific notation

2009-01-07 Thread Paul McNett
Robert Kern wrote: Paul McNett wrote: One of my users has reported that my app is giving them scientific notation instead of decimal notation for one specific value among many that display properly. I am unable to reproduce on my end, and this is the first I've heard of anything like this sinc

Re: Unexpected scientific notation

2009-01-07 Thread Ben Finney
Paul McNett writes: > The app bundles python 2.5.2 using py2exe. > > It displays '3E+1' instead of '30.0'. > > As I can't reproduce I'm looking for an idea brainstorm of what > could be causing this. What would be choosing to display such a > normal number in scientific notation? As I understa

buffer creates only read-only buffer?

2009-01-07 Thread Neal Becker
m = mmap.mmap (fd, 64, prot=mmap.PROT_READ|mmap.PROT_WRITE, flags=mmap.MAP_SHARED) b2 = buffer (m) print b2 Why read-only? Why doesn't 'buffer' allow creation of read-write? Should buffer constructor take an additional optional arg for specifying this? Doc doesn't say anything about the fa

Re: Regular Expressions...

2009-01-07 Thread Cameron Simpson
On 07Jan2009 19:51, Ken D'Ambrosio wrote: | Hi, all. As a recovering Perl guy, I have to admit I don't quite "get" | the re module. For example, I'd like to do a few things (I'm going to use | phone numbers, 'cause that's what I'm currently dealing with): | 12345678900 -- How would I: | - Get ju

Re: Regular Expressions...

2009-01-07 Thread Ben Finney
"Ken D'Ambrosio" writes: > Hi, all. As a recovering Perl guy, I have to admit I don't quite "get" > the re module. For example, I'd like to do a few things (I'm going to use > phone numbers, 'cause that's what I'm currently dealing with): > 12345678900 -- How would I: > - Get just the area code

Re: Detecting a GUI session

2009-01-07 Thread Christian Heimes
Leith Bade schrieb: > I would like to know whether my GUI program is being run under python or > pythonw. > > I would like to know this so I can redirect stderr when their is no > console window (pythonw) otherwise leave it spitting to the console > window (python). > > This is because I debug

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread James Stroud
Ben Finney wrote: Why are people so reluctant to make error message templates clearer with named placeholders? Because they can never remember they even exist. Thanks for the reminder. -- http://mail.python.org/mailman/listinfo/python-list

Re: why cannot assign to function call

2009-01-07 Thread Benjamin Kaplan
On Wed, Jan 7, 2009 at 7:22 PM, Terry Reedy wrote: > Joe Strout wrote: > > That's not necessarily true. If you have >> >> a = "par" + "rot" >> b = "parrot" >> >> then, most likely (though it depends on how clever the compiler >> optimizations are), there are two different string objects conta

Re: Unexpected scientific notation

2009-01-07 Thread Robert Kern
Paul McNett wrote: One of my users has reported that my app is giving them scientific notation instead of decimal notation for one specific value among many that display properly. I am unable to reproduce on my end, and this is the first I've heard of anything like this since the app's launch 2

Re: why cannot assign to function call

2009-01-07 Thread Erik Max Francis
Terry Reedy wrote: Joe Strout wrote: That's not necessarily true. If you have a = "par" + "rot" b = "parrot" then, most likely (though it depends on how clever the compiler optimizations are), there are two different string objects containing the data "parrot". >>> a='par'+'rot' >>

Re: multiprocessing vs thread performance

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 10:55 AM, Arash Arfaee wrote: > Hi All , HI :) > Does anybody know any tutorial for python 2.6 multiprocessing? Or bunch of > good example for it? I am trying to break a loop to run it over multiple > core in a system. And I need to return an integer value as the result of

Re: State of the art: Tkinter, Tk 8.5, Tix?

2009-01-07 Thread Benjamin Kaplan
On Wed, Jan 7, 2009 at 2:31 PM, excord80 wrote: > Does Python work with Tk 8.5? I'm manually installing my own Python > 2.6.1 (separate from my system's Python 2.5.2), and am about to > install my own Tcl/Tk 8.5 but am unsure how to make them talk to > eachother. Should I install Tk first? If I p

Unexpected scientific notation

2009-01-07 Thread Paul McNett
One of my users has reported that my app is giving them scientific notation instead of decimal notation for one specific value among many that display properly. I am unable to reproduce on my end, and this is the first I've heard of anything like this since the app's launch 2 years ago. The ap

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Ben Finney
Scott David Daniels writes: > James Stroud wrote: > > ... > > def find(field, order_by='desc'): > > if order_by not in ['asc', 'desc']: > > raise ValueError, 'Bad order_by parameter.' > > ... > I'd try a little harder with that error message. > At least: > raise ValueError('Bad order_

Re: multiprocessing vs thread performance

2009-01-07 Thread Arash Arfaee
Hi All , Does anybody know any tutorial for python 2.6 multiprocessing? Or bunch of good example for it? I am trying to break a loop to run it over multiple core in a system. And I need to return an integer value as the result of the process an accumulate all of them. the examples that I found the

Regular Expressions...

2009-01-07 Thread Ken D'Ambrosio
Hi, all. As a recovering Perl guy, I have to admit I don't quite "get" the re module. For example, I'd like to do a few things (I'm going to use phone numbers, 'cause that's what I'm currently dealing with): 12345678900 -- How would I: - Get just the area code? - Get just the seven-digit number?

Re: why cannot assign to function call

2009-01-07 Thread rurpy
On Jan 5, 12:21 pm, Derek Martin wrote: ... > I understand why the assignment model works the way it does, and it's > quite sensible, *when you understand it*. However, I do also think > that to someone who has not encountered such a model before, and who > has not had it explained to them, and/o

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Scott David Daniels
James Stroud wrote: ... def find(field, order_by='desc'): if order_by not in ['asc', 'desc']: raise ValueError, 'Bad order_by parameter.' ... I'd try a little harder with that error message. At least: raise ValueError('Bad order_by parameter %r.' % (order_by,)) if not: raise Valu

Re: Regular Expressions...

2009-01-07 Thread bearophileHUGS
Ken D'Ambrosio: > But the Python stuff simply isn't clicking for me. For people coming from Perl that want to perform some string processing with Python I suggest to learn first array/string slices and string methods. And to try to use the regular expressions as little as possible. Bye, bearophil

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread James Stroud
Adal Chiriliuc wrote: Hello, Me and my colleagues are having an discussion about the best way to code a function (more Pythonic). Here is the offending function: def find(field, order): if not isinstance(order, bool): raise ValueError("order must be a bool") order_by = "asc" if

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Scott David Daniels
Adal Chiriliuc wrote: On Jan 7, 10:15 pm, Bruno Desthuilliers wrote: ... I'd either keep the argument as a boolean but rename it "ascending" ... Well, I lied a bit :-p But what if we can't solve it as elegantly, and we need to ... Should we typecheck in this case to ensure that if we p

Detecting a GUI session

2009-01-07 Thread Leith Bade
I would like to know whether my GUI program is being run under python or pythonw. I would like to know this so I can redirect stderr when their is no console window (pythonw) otherwise leave it spitting to the console window (python). This is because I debug using python while the customer rele

Re: linked list with cycle structure

2009-01-07 Thread Robert Kern
Terry Reedy wrote: David Hláčik wrote: But what if i have another condition , and that is *i can use only helping memory with constant size* ? This means i am not able to create any set and adding elements there. I need to have a constant size variables . This is complication a complication for

Re: why cannot assign to function call

2009-01-07 Thread Terry Reedy
Joe Strout wrote: That's not necessarily true. If you have a = "par" + "rot" b = "parrot" then, most likely (though it depends on how clever the compiler optimizations are), there are two different string objects containing the data "parrot". >>> a='par'+'rot' >>> b='parrot' >>> a is

Re: Regular Expressions...

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 10:03 AM, James Stroud wrote: (...) > Indeed it seems you are recovering from an especially bad case. I recommend > two doses of the python cookbook per day for one to two months. Report back > here after your first cycle and we'll tell you how you are doing. I'm very > opti

Re: socket.error 24: too many open files

2009-01-07 Thread Bryan Olson
TheDavidFactor wrote: [...] It's a deamon that runs on a linux box and every 15 seconds it checks a MySQL table for new records, if there are any it creates a .call file on the Asterisk server using ssh, it also checks the Asterisk server, again via ssh, for any finished calls and if there are an

Re: linked list with cycle structure

2009-01-07 Thread Terry Reedy
David Hláčik wrote: so okay, i will create a helping set, where i will be adding elements ID, when element ID will be allready in my helping set i will stop and count number of elements in helping set. This is how long my cycled linked list is. CPython now does this in printing and marshalling

Re: Regular Expressions...

2009-01-07 Thread James Stroud
Ken D'Ambrosio wrote: Hi, all. As a recovering Perl guy, [snip] In Perl, I'd so something like m/^1(...)(...)/; Indeed it seems you are recovering from an especially bad case. I recommend two doses of the python cookbook per day for one to two months. Report back here after your first

Re: socket.error 24: too many open files

2009-01-07 Thread Roy Smith
In article , TheDavidFactor wrote: > I have double checked that it is closing the socket. I don't know what > else to check, any suggestions would be much appreciated. All of the symptoms you report point to sockets not getting closed. What does "double checked" mean? Don't rely on __del__

Re: How to store passwords?

2009-01-07 Thread James Stroud
James Stroud wrote: If you check out sf.passerby.net and download the source, you will see a passerby.sf.net Shuffle things I did. -- http://mail.python.org/mailman/listinfo/python-list

Re: [SPAM] Re: How do you write to the printer ?

2009-01-07 Thread MRAB
da...@bag.python.org wrote: On Wed, 07 Jan 2009 15:17:19 -0800, Scott David Daniels wrote: David Lemper wrote: Can find nothing in the on-line docs or a book. Groping in the dark I attempted : Note that (1) You may have just created a file named stdprn. (2) You need to close that

Re: pg_result_status() alternative?

2009-01-07 Thread Gerhard Häring
Qian Xu wrote: Steve Holden wrote: Without knowing the full details of that particular module I would hazard a guess that any database errors will raise exceptions in Python. No exceptions means your database operation worked fine. result status is not an exception. It means the information of

Re: Regular Expressions...

2009-01-07 Thread MRAB
Ken D'Ambrosio wrote: Hi, all. As a recovering Perl guy, I have to admit I don't quite "get" the re module. For example, I'd like to do a few things (I'm going to use phone numbers, 'cause that's what I'm currently dealing with): > 12345678900 -- How would I: > - Get just the area code? > - Ge

Re: How do you write to the printer ?

2009-01-07 Thread David
On Wed, 07 Jan 2009 15:17:19 -0800, Scott David Daniels wrote: >David Lemper wrote: >> Can find nothing in the on-line docs or a book. >> Groping in the dark I attempted : >Note that (1) You may have just created a file named stdprn. > (2) You need to close that file bwhen you are done

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-07 Thread Jonathan Gardner
On Jan 7, 9:16 am, "Chris Mellon" wrote: > > The OP wants a Ruby-style DSL by which he means "something that lets > me write words instead of expressions". The ruby syntax is amenable to > this, python (and lisp, for that matter) syntax is not and you can't > implement that style of internal DSL i

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-07 Thread Jonathan Gardner
On Jan 7, 7:50 am, J Kenneth King wrote: > Jonathan Gardner writes: > > On Jan 6, 12:24 pm, J Kenneth King wrote: > >> Jonathan Gardner writes: > >> > On Jan 6, 8:18 am, sturlamolden wrote: > >> >> On Jan 6, 4:32 pm, mark wrote: > > >> >> > I want to implement a internal DSL in Python. I woul

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Adal Chiriliuc
On Jan 7, 10:15 pm, Bruno Desthuilliers wrote: > This being said, I can only concur with other posters here about the > very poor naming. As far as I'm concerned, I'd either keep the argument > as a boolean but rename it "ascending" (and use a default True value), > or keep the 'order' name but th

Re: why cannot assign to function call

2009-01-07 Thread Joe Strout
Dan Esch wrote: In essence, the implication of immutability for Python is that there is only one "parrot", one "spam,"in fact one anything. (This seems like it must hold for data primitives - does it hold for complex objects as well? It seems it must...) In addition there is only one 1, and on

Re: An idea of how to identify Israeli owned software companies

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 9:24 AM, Steve Holden wrote: (...) > OK, that's enough non-Python ramblings for this thread. God I wish we could delete threads :) cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: How to store passwords?

2009-01-07 Thread News123
Oltmans wrote: > I'm writing a program in which I will ask users to enter user name and > password once only. It's a console based program that will run on > Windows XP. Actually, I'm trying to provide the similar functionality > as "Remember me" thing in browsers. For that, I will need to store >

Re: How to store passwords?

2009-01-07 Thread Martin v. Löwis
> I'm writing a program in which I will ask users to enter user name and > password once only. It's a console based program that will run on > Windows XP. Actually, I'm trying to provide the similar functionality > as "Remember me" thing in browsers. For that, I will need to store > user name and p

Re: An idea of how to identify Israeli owned software companies

2009-01-07 Thread Steve Holden
Mensanator wrote: > On Jan 7, 3:52 pm, Marc 'BlackJack' Rintsch wrote: >> On Wed, 07 Jan 2009 10:17:55 -0800, Mensanator wrote: >>> On Jan 7, 8:45 am, Terje wrote: Is there a web service/API out there identifying Israel owned software/software companies/web sites/web services? If I am a

Re: How do you write to the printer ?

2009-01-07 Thread Scott David Daniels
David Lemper wrote: Can find nothing in the on-line docs or a book. Groping in the dark I attempted : script24 import io io.open('stdprn','w') # accepted Here's your first mistake: you need to get the result of that call. Try: stdprn = io.open('stdprn', 'w') stdprn.

Re: why cannot assign to function call

2009-01-07 Thread rurpy
On Jan 6, 9:20 pm, Mark Wooding wrote: > ru...@yahoo.com wrote: > > Is not the proper term "aliasing"? Perhaps Python "variables" should > > be called "alises". > > No. The proper term is most definitely `binding': see SICP, for > example. (Wikipedia has a link to the full text.) I thought yo

Re: An idea of how to identify Israeli owned software companies

2009-01-07 Thread Mensanator
On Jan 7, 3:52 pm, Marc 'BlackJack' Rintsch wrote: > On Wed, 07 Jan 2009 10:17:55 -0800, Mensanator wrote: > > On Jan 7, 8:45 am, Terje wrote: > >> Is there a web service/API out there identifying Israel owned > >> software/software companies/web sites/web services? If I am about to > >> buy a pi

Re: Regular Expressions...

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 8:54 AM, Ken D'Ambrosio wrote: > Hi, all. As a recovering Perl guy, I have to admit I don't quite "get" > the re module. For example, I'd like to do a few things (I'm going to use > phone numbers, 'cause that's what I'm currently dealing with): > 12345678900 -- How would I

Re: socket send help

2009-01-07 Thread Bryan Olson
Gabriel Genellina wrote: James Mills escribió: Bryan Olson wrote: I thought a firewall would block an attempt to bind to any routeable address, but not to localhost. So using INADDR_ANY would be rejected. No. My understanding is that firewalls block network traffic, not system calls. This

Re: Printed Documentation

2009-01-07 Thread excord80
On Jan 7, 5:14 pm, floob wrote: > On Jan 7, 1:39 pm, excord80 wrote: > > > > > On Jan 7, 4:00 pm, floob wrote: > > > > I have been searching for a way to print the official Python > > > documentation into some kind of book (for my own uses). > > > > http://docs.python.org/download.html > > > I'd

Re: formatted 'time' data in calculations

2009-01-07 Thread Scott David Daniels
John Machin wrote: On Jan 8, 6:23 am, Scott David Daniels wrote: ...some stuff perhaps too cranky... Have you read the entire time module document? If so, which functions in that module take strings as arguments? then even more cranky stuff... Indeed. Be not cranky at clueless bludgers a

Regular Expressions...

2009-01-07 Thread Ken D'Ambrosio
Hi, all. As a recovering Perl guy, I have to admit I don't quite "get" the re module. For example, I'd like to do a few things (I'm going to use phone numbers, 'cause that's what I'm currently dealing with): 12345678900 -- How would I: - Get just the area code? - Get just the seven-digit number?

Re: del behavior

2009-01-07 Thread Benjamin Kaplan
On Wed, Jan 7, 2009 at 2:39 PM, Eric Snow wrote: > I was reading in the documentation about __del__ and have a couple of > questions. Here is what I was looking at: > > http://docs.python.org/reference/datamodel.html#object.__del__ > > What is globals referring to in the following text from that

Re: del behavior 2

2009-01-07 Thread Martin v. Löwis
> Thanks for the responses. What I mean is when a python process is > interrupted and does not get a chance to clean everything up then what > is a good way to do so? For instance, I have a script that uses child > ptys to facilitate ssh connections (I'm using pxssh). When I ^C the > python proc

Re: Printed Documentation

2009-01-07 Thread floob
On Jan 7, 1:39 pm, excord80 wrote: > On Jan 7, 4:00 pm, floob wrote: > > > > > I have been searching for a way to print the official Python > > documentation into some kind of book (for my own uses).  I don't > > really care if it's printed on newspaper and bound with elmer's > > glue ... any way

Re: linked list with cycle structure

2009-01-07 Thread David Hláčik
Hi, so okay, i will create a helping set, where i will be adding elements ID, when element ID will be allready in my helping set i will stop and count number of elements in helping set. This is how long my cycled linked list is. But what if i have another condition , and that is *i can use only h

Re: why cannot assign to function call

2009-01-07 Thread Dan Esch
Okay, thanks... Still trying to wrap my fragile little VBA-corrupted brain around names, namespaces, and objects. Progress is being made. For me, the naive idea of variable ==> label for bin has been hard to get past simply because someone in the the back of my head is screaming, "Wait, if the

Re: How to store passwords?

2009-01-07 Thread MRAB
Oltmans wrote: On Jan 8, 1:55 am, "Sebastian Bassi" wrote: In general you don't store the password, but a "hash" of it. Then when the user logs-in, you hash it and compare the result with the stored hash. About hash, use sha, look here:http://docs.python.org/library/hashlib.html#module-hashl

Re: An idea of how to identify Israeli owned software companies

2009-01-07 Thread Marc 'BlackJack' Rintsch
On Wed, 07 Jan 2009 10:17:55 -0800, Mensanator wrote: > On Jan 7, 8:45 am, Terje wrote: >> Is there a web service/API out there identifying Israel owned >> software/software companies/web sites/web services? If I am about to >> buy a piece of software, but don't want to support the Israeli econom

Re: Creating new instances of subclasses.

2009-01-07 Thread Bruno Desthuilliers
J. Cliff Dyer a écrit : I want to be able to create an object of a certain subclass, depending on the argument given to the class constructor. I have three fields, and one might need to be a StringField, one an IntegerField, and the last a ListField. But I'd like my class to delegate to the pro

Re: Printed Documentation

2009-01-07 Thread excord80
On Jan 7, 4:00 pm, floob wrote: > I have been searching for a way to print the official Python > documentation into some kind of book (for my own uses).  I don't > really care if it's printed on newspaper and bound with elmer's > glue ... any way I can get relatively recent _official documentation

Re: why cannot assign to function call

2009-01-07 Thread Steve Holden
Dan Esch wrote: > Wait a sec... > > I think I get this... > > In essence, the implication of immutability for Python is that there is > only one "parrot", one "spam,"in fact one anything. (This seems like it > must hold for data primitives - does it hold for complex objects as > well? It seems

Re: Parsing Excel spreadsheets

2009-01-07 Thread brooklineTom
On Jan 2, 7:04 pm, John Machin wrote: > On Jan 3, 2:01 am, brooklineTom wrote: > > > > My point was that however the original XLS files were created or > acquired, the first step in your solution involves converting the XLS > file to "XML Spreadsheet" format, which requires a copy of Excel on a

Re: del behavior 2

2009-01-07 Thread Marc 'BlackJack' Rintsch
On Wed, 07 Jan 2009 12:03:36 -0800, Eric Snow wrote: > Thanks for the responses. What I mean is when a python process is > interrupted and does not get a chance to clean everything up then what > is a good way to do so? Well, if it doesn't get a chance then it doesn't get a chance. ;-) > For i

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-07 Thread Carl Banks
On Jan 6, 9:32 am, mark wrote: > I want to implement a internal DSL in Python. I would like the syntax > as human readable as possible. This means no disturbing '.;()\' > characters. I like to have the power of the hosting language as well. > Thats why I want to build it as an internal DSL and NOT

Re: formatted 'time' data in calculations

2009-01-07 Thread John Machin
On Jan 8, 6:23 am, Scott David Daniels wrote: > Ross wrote: > > There seems to be no shortage of information around on how to use the > > time module, for example to use time.ctime() and push it into strftime > > and get something nice out the other side, but I haven't found anything > > helpful i

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Bruno Desthuilliers
Adal Chiriliuc a écrit : Hello, Me and my colleagues are having an discussion about the best way to code a function (more Pythonic). Here is the offending function: def find(field, order): if not isinstance(order, bool): raise ValueError("order must be a bool") order_by = "asc"

Re: How to store passwords?

2009-01-07 Thread James Stroud
James Stroud wrote: Oltmans wrote: I'm writing a program in which I will ask users to enter user name and password once only. It's a console based program that will run on Windows XP. Actually, I'm trying to provide the similar functionality as "Remember me" thing in browsers. For that, I will n

Re: How to store passwords?

2009-01-07 Thread James Stroud
Oltmans wrote: I'm writing a program in which I will ask users to enter user name and password once only. It's a console based program that will run on Windows XP. Actually, I'm trying to provide the similar functionality as "Remember me" thing in browsers. For that, I will need to store user nam

Re: How to store passwords?

2009-01-07 Thread Oltmans
On Jan 8, 1:55 am, "Sebastian Bassi" wrote: > In general you don't store the password, but a "hash" of it. Then when > the user logs-in, you hash it and compare the result with the stored > hash. > About hash, use sha, look > here:http://docs.python.org/library/hashlib.html#module-hashlib But t

  1   2   3   >