substituting list comprehensions for map()

2009-11-01 Thread Jon P.
I'd like to do: resultlist = operandlist1 + operandlist2 where for example operandlist1=[1,2,3,4,5] operandlist2=[5,4,3,2,1] and resultlist will become [6,6,6,6,6]. Using map(), I can do: map(lambda op1,op2: op1 + op2, operandlist1, operandlist2) Is there any reasonable way to do this via a

Re: stdin in embedded python

2009-11-01 Thread Gabriel Genellina
En Sun, 01 Nov 2009 23:13:10 -0300, Dave Angel escribió: Gabriel Genellina wrote: En Sun, 01 Nov 2009 13:34:44 -0300, KillSwitch escribió: On Nov 1, 5:34 am, Dave Angel wrote: KillSwitch wrote: > I have a C++ program, with a GUI, into which I have embedded python. I > have made severa

Re: About one class/function per module

2009-11-01 Thread Gabriel Genellina
En Sun, 01 Nov 2009 22:27:32 -0300, Peng Yu escribió: On Sun, Nov 1, 2009 at 7:02 PM, alex23 wrote: On Nov 2, 8:11 am, Peng Yu wrote: I prefer organized my code one class/function per file (i.e per module in python). I know the majority of programmers don't use this approach. Therefore, I'

Re: import bug

2009-11-01 Thread Gabriel Genellina
En Sun, 01 Nov 2009 19:51:04 -0300, Steven D'Aprano escribió: On Sun, 01 Nov 2009 17:34:19 -0300, Gabriel Genellina wrote: En Sun, 01 Nov 2009 02:54:15 -0300, Steven D'Aprano escribió: Shadowing a standard library module is no different. But that's what namespaces are for; if the standard

Re: import bug

2009-11-01 Thread Gabriel Genellina
En Sun, 01 Nov 2009 19:01:42 -0300, MRAB escribió: Gabriel Genellina wrote: One way to avoid name clashes would be to put the entire standard library under a package; a program that wants the standard re module would write "import std.re" instead of "import re", or something similar. You c

Re: About one class/function per module

2009-11-01 Thread Steven D'Aprano
On Sun, 01 Nov 2009 18:33:57 -0800, alex23 wrote: > Peng Yu wrote: >> So I am asking disadvantages besides python import mechanism is not >> friendly to it. > > Which part of "name collisions have to be resolved somehow" isn't > explicit enough for you? > > You can't keep saying "this works in

Re: spring effect in Python

2009-11-01 Thread Cleber Santos
You can try this: http://processingjs.org On Fri, Oct 30, 2009 at 5:26 AM, pochis40 wrote: > I'm trying to write in Python something similar to this: > (Java) > http://java.sun.com/applets/jdk/1.4/demo/applets/GraphLayout/example1.html > or these: > (Proce55ing) > http://www.cricketschirping.co

Re: Tkinter callback arguments

2009-11-01 Thread Lord Eldritch
Alf P. Steinbach wrote: > * MRAB: Thank you all! It is working now nicely! God! I love usenet..:D -- Lord Eldritch -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular express question

2009-11-01 Thread alex23
On Oct 31, 12:48 pm, elca wrote: > Hello, > i have some text document to parse. > sample text is such like follow > in this document, i would like to extract such like > SUBJECT = 'NETHERLANDS MUSIC EPA' > CONTENT = 'Michael Buble performs in Amsterdam Canadian singer Michael Buble > performs duri

Re: About one class/function per module

2009-11-01 Thread rustom
On Nov 2, 3:11 am, Peng Yu wrote: > I recently asked how to support one class/function per module under > the title 'How to import only one module in a package when the package > __init__.py has already imports the modules?' I summarize my key > points below. In particular, I have to two questions

disable image loading to speed up webpage load

2009-11-01 Thread elca
Hi, im using win32com 's webbrowser module. i have some question about it.. is it possible to disable image loading to speed up webpage load? any help ,much appreciate thanks in advance -- View this message in context: http://old.nabble.com/disable-image-loading-to-speed-up-webpage-load-tp261554

Re: Feedback wanted on programming introduction (Python in Windows)

2009-11-01 Thread Pascal J. Bourguignon
Thad Smith writes: > Richard Heathfield wrote: > >> ... so I cheerfully installed it on the user's desktop machine >> (Windows ME, would you believe), and then set about configuring the >> reader, when... ouch! No PDF reader on the machine. Not even an >> ancient Adobe version. Oh dear. Program s

Re: spring effect in Python

2009-11-01 Thread Cousin Stanley
> > I've problem to find something that give that physical effect > ( like a spring). > > Any idea? You may find VPython useful for simulating physical effects http://www.vpython.org/ Examples including a couple that are spring-related http://matterandinteracti

Re: self.__dict__ tricks

2009-11-01 Thread Steven D'Aprano
On Sat, 31 Oct 2009 11:15:48 -0500, Tim Johnson wrote: > Many programmers I know stay away from 'lists' such as this, because > they are afraid to show their ignorance. Me, I'm fearless, and I have > learned a lot that I might not have otherwise. The only stupid question is the one you are afraid

Re: list comprehension problem

2009-11-01 Thread Mel
Steven D'Aprano wrote: > (6) Metaphoric equivalence: > Kali is death. > Life is like a box of chocolates. OK to here, but this one switches between metaphor and simile, and arguably, between identity and equality. Mel. -- http://mail.python.org/mailman/listinfo/python-list

Re: list comprehension problem

2009-11-01 Thread Cousin Stanley
> > There are an infinite number of empty sets > that differ according to their construction: > > The set of all fire-breathing mammals. > Apparently, you have never been a witness to someone who recently ingested one of Cousin Chuy's Super-Burritos .. :-) -- Stan

Re: Pyfora, a place for python

2009-11-01 Thread Ben Finney
Saketh writes: > If you have any suggestions, let me know -- this is a community > effort! Suggestion: Please don't make efforts to fragment the community. Rather, please direct seekers to the existing forums (the IRC channel, the Usenet groups and mailing lists) rather than setting up new wall

The Python: Rag November issue available

2009-11-01 Thread Bernie
The November issue of The Python: Rag is available at: http://www.pythonrag.org A monthly, free, community run, Python magazine - issues are in pdf format, intended for anyone interested in Python. -- http://mail.python.org/mailman/listinfo/python-list

ANN: python-ldap-2.3.10

2009-11-01 Thread Michael Ströder
Find a new release of python-ldap: http://www.python-ldap.org/ python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related stuff (e.g. processin

Regular express question

2009-11-01 Thread elca
Hello, i have some text document to parse. sample text is such like follow in this document, i would like to extract such like SUBJECT = 'NETHERLANDS MUSIC EPA' CONTENT = 'Michael Buble performs in Amsterdam Canadian singer Michael Buble performs during a concert in Amsterdam, The Netherlands, 30

Re: About one class/function per module

2009-11-01 Thread Dave Angel
Peng Yu wrote: Some people mentioned an good IDE can do 1 and 4. But I'm not aware of an IDE that can allow me to change file name freely. I tried Visual Studio long time ago, I have to delete a file, change the file name and add the file back in order to change the file. I use Komodo IDE v

Re: Feedback wanted on programming introduction (Python in Windows)

2009-11-01 Thread Thad Smith
Richard Heathfield wrote: ... so I cheerfully installed it on the user's desktop machine (Windows ME, would you believe), and then set about configuring the reader, when... ouch! No PDF reader on the machine. Not even an ancient Adobe version. Oh dear. Program suddenly rendered completely use

Re: About one class/function per module

2009-11-01 Thread alex23
Peng Yu wrote: > So I am asking disadvantages besides python import mechanism is not > friendly to it. Which part of "name collisions have to be resolved somehow" isn't explicit enough for you? You can't keep saying "this works in C++" while refusing to accept that this is an implementation deci

Re: stdin in embedded python

2009-11-01 Thread Dave Angel
Gabriel Genellina wrote: En Sun, 01 Nov 2009 13:34:44 -0300, KillSwitch escribió: On Nov 1, 5:34 am, Dave Angel wrote: KillSwitch wrote: > I have a C++ program, with a GUI, into which I have embedded python. I > have made several python functions in C++, one of which I use to > override t

Re: Pyfora, a place for python

2009-11-01 Thread alex23
Saketh wrote: > If you have any suggestions, let me know -- this is a community > effort! I'd like to suggest Pyaspora as a more apropos name ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: About one class/function per module

2009-11-01 Thread metal
On 11月2日, 上午9时27分, Peng Yu wrote: > On Sun, Nov 1, 2009 at 7:02 PM, alex23 wrote: > > On Nov 2, 8:11 am, Peng Yu wrote: > >> I prefer organized my code one class/function per file (i.e per module > >> in python). I know the majority of programmers don't use this > >> approach. Therefore, I'm won

Re: About one class/function per module

2009-11-01 Thread Peng Yu
On Sun, Nov 1, 2009 at 7:02 PM, alex23 wrote: > On Nov 2, 8:11 am, Peng Yu wrote: >> I prefer organized my code one class/function per file (i.e per module >> in python). I know the majority of programmers don't use this >> approach. Therefore, I'm wondering what its disadvantage is. > > You mean

Re: list comprehension problem

2009-11-01 Thread Mick Krippendorf
Steven D'Aprano wrote: > On Sun, 01 Nov 2009 21:32:15 +0100, Mick Krippendorf wrote: >> >> (Ax)(x is a fire-breathing animal <-> x is a real number equal to >> sqrt(-1)). >> >> And since there are neither such things, it follows that s1 = s2. > > That assumes that all({}) is defined as true. That

Re: About one class/function per module

2009-11-01 Thread alex23
On Nov 2, 8:11 am, Peng Yu wrote: > I prefer organized my code one class/function per file (i.e per module > in python). I know the majority of programmers don't use this > approach. Therefore, I'm wondering what its disadvantage is. You mean, what disadvantages it has _other_ than the ones you'v

Re: Feedback wanted on programming introduction (Python in Windows)

2009-11-01 Thread Alf P. Steinbach
* Rhodri James: On Sun, 01 Nov 2009 21:20:20 -, Alf P. Steinbach wrote: * Rhodri James: This is a weird attribution style, by the way. I don't think it helps. That's a pretty weird thing to comment on. And as far as I can see the comment doesn't make sense except as an attempt to f

Re: Feedback wanted on programming introduction (Python in Windows)

2009-11-01 Thread Rhodri James
On Sun, 01 Nov 2009 21:20:20 -, Alf P. Steinbach wrote: * Rhodri James: This is a weird attribution style, by the way. I don't think it helps. On Fri, 30 Oct 2009 03:26:45 -, Alf P. Steinbach wrote: * Rhodri James: On Thu, 29 Oct 2009 16:53:05 -, Alf P. Steinbach wrot

Doesn't MS-Windows likes Python ? (or: why more than 20 sec delay when running a program from Python)

2009-11-01 Thread Stef Mientki
hello, I've an AutoIt program that set some switches in the LAN settings. When I launch the AutoIt executable, the settings are changed immediately. When I launch the AutoIt executable from python (which is the intention), it hangs for about 20 seconds, before any action appears on the screen.

Re: Why 'import module' will not import module.py but the directory module?

2009-11-01 Thread Colin W.
Robert Kern wrote: On 2009-10-31 19:16 PM, Peng Yu wrote: On Sat, Oct 31, 2009 at 7:02 PM, Robert Kern wrote: On 2009-10-31 18:51 PM, Peng Yu wrote: If I have both the directory 'module' and the file 'module.py' in a directory in $PYTHONPATH, python will import 'module' rather than 'module.p

Re: Tkinter callback arguments

2009-11-01 Thread Alf P. Steinbach
* MRAB: Lord Eldritch wrote: Hi Maybe this is maybe something it has been answered somewhere but I haven't been able to make it work. I wanna pass one variable to a callback function and I've read the proper way is: Button(.., command=lambda: function(x)) So with def function(a): prin

Function states [was Re: How to import only one module in a package when the package __init__.py has already imports the modules?]

2009-11-01 Thread Steven D'Aprano
On Sun, 01 Nov 2009 08:07:37 -0600, Peng Yu wrote: > It is > reasonable to assume the log of the number of states of a function or a > class is proportional to it length. Hence, when a function or a > class is long, you will never be able to test all its states. def f(n): return n + 5 def

Re: How to import only one module in a package when the package __init__.py has already imports the modules?

2009-11-01 Thread Steven D'Aprano
On Sun, 01 Nov 2009 13:46:42 -0600, Robert Kern wrote: > Peng Yu wrote: >> On Sat, Oct 31, 2009 at 11:40 PM, Steven D'Aprano >> wrote: > >>> Oh wait, I get it... you want to do a global search-and-replace over >>> the entire file. *face-palm* >> >> Yes. You get it. > > In any capable programme

Re: list comprehension problem

2009-11-01 Thread Steven D'Aprano
On Sun, 01 Nov 2009 21:32:15 +0100, Mick Krippendorf wrote: > When we want find out if two sets s1 and s2 are the same we only need to > look at their extensions, so given: > > (i s1)(Ay)(y e s1 <-> y is a fire-breathing animal) (i s2)(Ay)(y e s2 > <-> y is a real number equal to sqrt(-1)) >

Re: import bug

2009-11-01 Thread Steven D'Aprano
On Sun, 01 Nov 2009 17:34:19 -0300, Gabriel Genellina wrote: > En Sun, 01 Nov 2009 02:54:15 -0300, Steven D'Aprano > escribió: >> On Sun, 01 Nov 2009 01:38:16 -0300, Gabriel Genellina wrote: > Incorrect. Simplicity of implementation and API is a virtue, in and of itself. The existing m

Re: About one class/function per module

2009-11-01 Thread Robert Kern
Peng Yu wrote: So far, I haven't find one. It seems impossible in python, but I want to double check if there is one solution. We have already told you more than twice that the answer is "No." Please don't triple check. -- Robert Kern "I have come to believe that the whole world is an enig

Re: Sqlite3. Substitution of names in query.

2009-11-01 Thread Carsten Haese
Lawrence D'Oliveiro wrote: > Says someone who hasn't realized where the real inefficiencies are. Remember > what Tony Hoare told us: "premature optimization is the root of all evil". > These are databases we're talking about. Real-world databases are large, and > reside on disk, which is several

Re: About one class/function per module

2009-11-01 Thread Diez B. Roggisch
Peng Yu schrieb: I recently asked how to support one class/function per module under the title 'How to import only one module in a package when the package __init__.py has already imports the modules?' I summarize my key points below. In particular, I have to two questions: 1. What disadvantages

About one class/function per module

2009-11-01 Thread Peng Yu
I recently asked how to support one class/function per module under the title 'How to import only one module in a package when the package __init__.py has already imports the modules?' I summarize my key points below. In particular, I have to two questions: 1. What disadvantages there are to enforc

Re: import bug

2009-11-01 Thread MRAB
Gabriel Genellina wrote: [snip] One way to avoid name clashes would be to put the entire standard library under a package; a program that wants the standard re module would write "import std.re" instead of "import re", or something similar. Every time the std package is suggested, the main argume

Re: Sqlite3. Substitution of names in query.

2009-11-01 Thread Lawrence D'Oliveiro
In message , Carsten Haese wrote: > Lawrence D'Oliveiro wrote: > >> In message , >> Carsten Haese wrote: > >>> On what grounds are you asserting that it's not necessary to mix the >>> two? Please elaborate your point. >> >> On the grounds that Python has more general and powerful string >> param

Re: __str__ difficulty with lists

2009-11-01 Thread Diez B. Roggisch
Jabba Laci schrieb: Hi, I have a list that contains custom objects. When printing the list, I'd like to have a readable result, i.e. I'd like to see the output of the __str__ functions. See an example below. When I call "print li", I would like to get "[3, 5]". How to do that? Use __repr__ ins

Re: Feedback desired on reworked ch 1 progr. intro (now Python 3.x, Windows)

2009-11-01 Thread Alf P. Steinbach
* Rhodri James: Before we start, can I just say that I find Google Docs loathsome? On Sat, 31 Oct 2009 07:40:36 -, Alf P. Steinbach wrote: I hope this new version of ch 1 is, well, better, addresses some of the concerns raised? Section 1.1 needs serious work. Could you please expan

Re: Feedback wanted on programming introduction (Python in Windows)

2009-11-01 Thread Alf P. Steinbach
* Rhodri James: On Fri, 30 Oct 2009 03:26:45 -, Alf P. Steinbach wrote: * Rhodri James: On Thu, 29 Oct 2009 16:53:05 -, Alf P. Steinbach wrote: with the best knowledge of the program's environment, is unable to handle (such as delete) files or folders with paths greater than some

__str__ difficulty with lists

2009-11-01 Thread Jabba Laci
Hi, I have a list that contains custom objects. When printing the list, I'd like to have a readable result, i.e. I'd like to see the output of the __str__ functions. See an example below. When I call "print li", I would like to get "[3, 5]". How to do that? Thanks, Laszlo == class MyNu

Re: stdin in embedded python

2009-11-01 Thread Gabriel Genellina
En Sun, 01 Nov 2009 13:34:44 -0300, KillSwitch escribió: On Nov 1, 5:34 am, Dave Angel wrote: KillSwitch wrote: > I have a C++ program, with a GUI, into which I have embedded python. I > have made several python functions in C++, one of which I use to > override the normal stdout and stder

Re: Feedback desired on reworked ch 1 progr. intro (now Python 3.x, Windows)

2009-11-01 Thread Rhodri James
Before we start, can I just say that I find Google Docs loathsome? On Sat, 31 Oct 2009 07:40:36 -, Alf P. Steinbach wrote: I hope this new version of ch 1 is, well, better, addresses some of the concerns raised? Section 1.1 needs serious work. You have a very assertive writing styl

Re: Feedback wanted on programming introduction (Python in Windows)

2009-11-01 Thread Rhodri James
On Fri, 30 Oct 2009 03:26:45 -, Alf P. Steinbach wrote: * Rhodri James: On Thu, 29 Oct 2009 16:53:05 -, Alf P. Steinbach wrote: with the best knowledge of the program's environment, is unable to handle (such as delete) files or folders with paths greater than some 260 character

Re: list comprehension problem

2009-11-01 Thread Mick Krippendorf
Steven D'Aprano wrote: > There are an infinite number of empty sets that differ according to their > construction: > > The set of all American Presidents called Boris Nogoodnik. > The set of all human languages with exactly one noun and one verb. > The set of all fire-breathing mammals. > The set

Re: import bug

2009-11-01 Thread Gabriel Genellina
En Sun, 01 Nov 2009 02:54:15 -0300, Steven D'Aprano escribió: On Sun, 01 Nov 2009 01:38:16 -0300, Gabriel Genellina wrote: Incorrect. Simplicity of implementation and API is a virtue, in and of itself. The existing module machinery is quite simple to understand, use and maintain. Uhm... mod

Tkinter callback arguments

2009-11-01 Thread Lord Eldritch
Hi Maybe this is maybe something it has been answered somewhere but I haven't been able to make it work. I wanna pass one variable to a callback function and I've read the proper way is: Button(.., command=lambda: function(x)) So with def function(a): print a I get the value of x. Ok. My

Re: Tkinter callback arguments

2009-11-01 Thread MRAB
Lord Eldritch wrote: Hi Maybe this is maybe something it has been answered somewhere but I haven't been able to make it work. I wanna pass one variable to a callback function and I've read the proper way is: Button(.., command=lambda: function(x)) So with def function(a): print a I ge

Tkinter callback arguments

2009-11-01 Thread Lord Eldritch
Hi Maybe this is maybe something it has been answered somewhere but I haven't been able to make it work. I wanna pass one variable to a callback function and I've read the proper way is: Button(.., command=lambda: function(x)) So with def function(a): print a I get the value of x. Ok. My

Re: How to import only one module in a package when the package __init__.py has already imports the modules?

2009-11-01 Thread Robert Kern
Peng Yu wrote: On Sat, Oct 31, 2009 at 11:43 PM, Steven D'Aprano wrote: On Sat, 31 Oct 2009 22:54:47 -0500, Peng Yu wrote: So python would not be able to accommodate my preference one class/function per file? Of course it does! You can do that RIGHT NOW -- just put one class per file. I.e.

Re: How to import only one module in a package when the package __init__.py has already imports the modules?

2009-11-01 Thread Robert Kern
Peng Yu wrote: On Sat, Oct 31, 2009 at 11:40 PM, Steven D'Aprano wrote: Oh wait, I get it... you want to do a global search-and-replace over the entire file. *face-palm* Yes. You get it. In any capable programmer's editor, it should not be hard to do a local search-and-replace over just

ANN: blist 1.0.2

2009-11-01 Thread Daniel Stutzbach
blist 1.0.2 is now available: http://pypi.python.org/pypi/blist/ What is blist? -- The blist is a type that looks, acts, and quacks like a Python list, but has better asymptotic performance when inserting or deleting elements (O(log n)). For small lists, blists and the built-

Re: Can I run a python program from within emacs?

2009-11-01 Thread rustom
On Nov 1, 7:20 pm, Robinson wrote: > I have also just started with both Aquamacs and Python so I ask for   > your patience as well. > When I evaluate the buffer (C-c C-C) I don't see any response or   > output from my python program. Should another buffer open   > automatically? Should a terminal

Re: Can I run a python program from within emacs?

2009-11-01 Thread Robinson
Jason, Thanks, but I have already tried your suggestions (which seem like logical cause/effect actions) and nothing. There must be a python preference or something I haven't set correctly. There is no Aquamacs list, but I'll check further. Thanks again for the quick reply. On Nov 1, 2009

Re: stdin in embedded python

2009-11-01 Thread KillSwitch
On Nov 1, 5:34 am, Dave Angel wrote: > KillSwitch wrote: > > I have a C++ program, with a GUI, into which I have embedded python. I > > have made several python functions in C++, one of which I use to > > override the normal stdout and stderr so that they print to a text box > > of my GUI. One thi

Re: What is Islam?-1

2009-11-01 Thread omer azazi
from python to exe py2exe turns Python programs into packages that can be run on other Windows computers without needing to install Python on those computers. Python is needed on the computer where py2exe itself is run because py2exe is a Python program and it includes parts of Python in the pack

Re: Can I run a python program from within emacs?

2009-11-01 Thread Jason Sewall
On Sun, Nov 1, 2009 at 9:20 AM, Robinson wrote: > I have also just started with both Aquamacs and Python so I ask for your > patience as well. > When I evaluate the buffer (C-c C-C) I don't see any response or output from > my python program. Should another buffer open automatically? Should a > te

Re: Pyfora, a place for python

2009-11-01 Thread Martijn Arts
I think it's a really good idea :) My accountname is "TotempaaltJ" On Sun, Nov 1, 2009 at 8:48 AM, Paul Rubin wrote: > Saketh writes: > > I am proud to announce the release of Pyfora (http://pyfora.org), an > > online community of Python enthusiasts to supplement co

Re: How to import only one module in a package when the package __init__.py has already imports the modules?

2009-11-01 Thread Peng Yu
On Sat, Oct 31, 2009 at 11:40 PM, Steven D'Aprano wrote: > On Sat, 31 Oct 2009 22:48:10 -0500, Peng Yu wrote: > >>> Variables in a function are already private.  How can the names in one >>> function be affected by other functions in the same module? >> >> You misunderstood me. >> >> If there are

Re: Looking for help getting tkinter to work.

2009-11-01 Thread Francesco Bochicchio
On Nov 1, 4:06 am, Shue Boks wrote: > I tried to compile Python and Tcl/Tk on Linux using the following > files: > > Python-3.1.1.tar.gz > tcl8.5.7-src.tar.gz > > Cannot get tkinter to work after compiling & installing Tcl/Tk.  I get > the following error after compiling Python: > > "Python build

Can I run a python program from within emacs?

2009-11-01 Thread Robinson
I have also just started with both Aquamacs and Python so I ask for your patience as well. When I evaluate the buffer (C-c C-C) I don't see any response or output from my python program. Should another buffer open automatically? Should a terminal window open? thanks for your patience. Rugbei

Re: How to import only one module in a package when the package __init__.py has already imports the modules?

2009-11-01 Thread Peng Yu
On Sat, Oct 31, 2009 at 11:43 PM, Steven D'Aprano wrote: > On Sat, 31 Oct 2009 22:54:47 -0500, Peng Yu wrote: > >> So python would not be able to accommodate my preference one >> class/function per file? > > Of course it does! You can do that RIGHT NOW -- just put one class per > file. > >> I.e.,

Re: How to import only one module in a package when the package __init__.py has already imports the modules?

2009-11-01 Thread Peng Yu
On Sat, Oct 31, 2009 at 11:34 PM, Steven D'Aprano wrote: > On Sat, 31 Oct 2009 22:29:12 -0500, Peng Yu wrote: > In my question, module A and B exist just for the sake of implementation. Even if I have module A and B, I don't want the user feel the existence of module A and B. I want

Re: stdin in embedded python

2009-11-01 Thread Dave Angel
KillSwitch wrote: I have a C++ program, with a GUI, into which I have embedded python. I have made several python functions in C++, one of which I use to override the normal stdout and stderr so that they print to a text box of my GUI. One thing I cannot think of how to do is to redefine stdin so

Re: problem with read() write()

2009-11-01 Thread Steven D'Aprano
On Sun, 01 Nov 2009 10:44:45 +0100, Alf P. Steinbach wrote: > Could you post (copy and paste) the code, and description of results? Using Python 2.6 under Linux (Fedora 7): >>> f = open('garbage', 'r') # prove the file doesn't exist Traceback (most recent call last): File "", line 1, in IOEr

Re: problem with read() write()

2009-11-01 Thread Matt Nordhoff
Gertjan Klein wrote: > Alf P. Steinbach wrote: > >> So with 'w+' the only way to get garbage is if 'read' reads beyond the end >> of >> file, or 'open' doesn't conform to the documentation. > > It does read beyond the end of file. This is perhaps the way the > underlying C library works, but it

Re: problem with read() write()

2009-11-01 Thread Gertjan Klein
Alf P. Steinbach wrote: >* Gertjan Klein: >> I reproduced (with Python 2.5.2 on WinXP) the code the OP wrote after >> creating an empty (0-byte) test file; after the write() the read() >> returns random garbage. I can't imagine why anyone would want that >> behaviour. The file grew to be 4099 byte

Re: python os.path.exists failure

2009-11-01 Thread Roel Schroeven
koranthala schreef: > Hi all, >My code is as follows: > > path = r'C:/"Program Files"/testfolder/2.3/test.txt' > if os.path.lexists(path): > print 'Path Exists' > else: > print 'No file found in path - %s' %path > print Popen(path, stdout=PIPE, shell=True).stdout.read() > > The output

Re: problem with read() write()

2009-11-01 Thread Alf P. Steinbach
* Gertjan Klein: Alf P. Steinbach wrote: So with 'w+' the only way to get garbage is if 'read' reads beyond the end of file, or 'open' doesn't conform to the documentation. It does read beyond the end of file. This is perhaps the way the underlying C library works, but it looks like an "unexp

Re: problem with read() write()

2009-11-01 Thread Gertjan Klein
Alf P. Steinbach wrote: >So with 'w+' the only way to get garbage is if 'read' reads beyond the end of >file, or 'open' doesn't conform to the documentation. It does read beyond the end of file. This is perhaps the way the underlying C library works, but it looks like an "unexpected feature" (re

Re: Sqlite3. Substitution of names in query.

2009-11-01 Thread Carsten Haese
Lawrence D'Oliveiro wrote: >> On what grounds are you asserting that it's not necessary to mix the >> two? Please elaborate your point. > > On the grounds that Python has more general and powerful string parameter- > substitution mechanisms than anything built into any database API. That statemen

Re: Pyfora, a place for python

2009-11-01 Thread Paul Rubin
Saketh writes: > I am proud to announce the release of Pyfora (http://pyfora.org), an > online community of Python enthusiasts to supplement comp.lang.python > and #python. And the reason to want to further fragment Python discussion is exactly what? -- http://mail.python.org/mailman/listinfo/py

stdin in embedded python

2009-11-01 Thread KillSwitch
I have a C++ program, with a GUI, into which I have embedded python. I have made several python functions in C++, one of which I use to override the normal stdout and stderr so that they print to a text box of my GUI. One thing I cannot think of how to do is to redefine stdin so that it pauses the

Re: __eq__() inconvenience when subclassing set

2009-11-01 Thread Gabriel Genellina
En Fri, 30 Oct 2009 17:55:27 -0300, Jess Austin escribió: On Oct 29, 10:41 pm, "Gabriel Genellina" wrote: We know the last test fails because the == logic fails to recognize mySet (on the right side) as a "more specialized" object than frozenset (on the left side), because set and frozen