Re: Modify arguments between __new__ and __init__

2007-12-23 Thread Arnaud Delobelle
On Dec 23, 5:03 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > When you call a new-style class, the __new__ method is called with the > user-supplied arguments, followed by the __init__ method with the same > arguments. > > I would like to modify the arguments after the __new__

Re: fiber(cooperative multi-threading)

2007-12-23 Thread Akihiro KAYAMA
Thanks for your replies. In article <[EMAIL PROTECTED]>, Arnaud Delobelle <[EMAIL PROTECTED]> writes: arnodel> def f1(): arnodel> print "f1 start" arnodel> yield f2, arnodel> print "f1 foo" arnodel> v = yield f2, arnodel> print "f1 v=%s world" % v arnodel> yield f2, "OK"

Re: Detecting memory leaks on apache, mod_python

2007-12-23 Thread Ilias Lazaridis
On Dec 23, 2:47 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 22 Dec 2007 13:05:23 -0800, Dennis Lee Bieber wrote: > > I've never encountered such items > > supported by the language. > > >OS specific extensions MIGHT supply it... > > Picky picky... but of course y

Re: Inter-process communication, how? Part 2

2007-12-23 Thread Guilherme Polo
2007/12/22, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Hello, > > just to recap: last time I asked how to do an interprocess > communitation, between one Manager process (graphical beckend) and > some Worker processes. > > I decided to go with sockets, thanks for replies, once more. > > However, I wo

Re: Element bug?(ElementTree)

2007-12-23 Thread Fredrik Lundh
limodou wrote: > I don't know if it's a bug? Try below code: > > >>> from elementtree.ElementTree import Element > >>> a = Element('a') > >>> if a: > ... print '' > ... > >>> a.__len__() > 0 > > You can see if I test a, the result will be False. I don't know if > it's an expected

Re: 5 queens

2007-12-23 Thread cf29
To make it simple and not have to deal with the 8 queens problem that is different with the 5 queens one, I'll ask in a different way. I am not familiar with implementing in Python such terms as "standard depth-first search of the solution space", "permutation", "recursion", "'canonical' form", ..

Local variables in classes and class instantiation

2007-12-23 Thread A.J. Bonnema
Hi all, I just started using Python. I used to do some Java programming, so I am not completely blank. I have a small question about how classes get instantiated within other classes. I have added the source of a test program to the bottom of this mail, that contains 3 methods within a testcla

Re: fiber(cooperative multi-threading)

2007-12-23 Thread Duncan Booth
Akihiro KAYAMA <[EMAIL PROTECTED]> wrote: > Thanks for your replies. > > But current Python generator specification requires me: > > def f1(): > for x in foo(f2, "foo"): yield x > for x in foo(f2, "foo"): yield x > # XXX v = ... (I don't know how to do this) > for x in foo(f2, "v

Re: Local variables in classes and class instantiation

2007-12-23 Thread Matt Nordhoff
A.J. Bonnema wrote: > Hi all, > > I just started using Python. I used to do some Java programming, so I am > not completely blank. > > I have a small question about how classes get instantiated within other > classes. I have added the source of a test program to the bottom of this > mail, that

Re: Passing by reference

2007-12-23 Thread MartinRinehart
Dennis Lee Bieber wrote: > Great if one is using a teletype as editor The original Dartmouth computer room was a basement that featured 8 teletypes. The original BASIC, Dennis, was implemented on a time-shared "mainframe" with a gigantic 8k words (20-bit words, if I remember) of core memory. D

Re: Local variables in classes and class instantiation

2007-12-23 Thread Peter Otten
A.J. Bonnema wrote: > I have a small question about how classes get instantiated within other > classes. I have added the source of a test program to the bottom of this > mail, that contains 3 methods within a testclass that each instantiate > the same class and bind it to a local variable. My

Re: Passing by reference

2007-12-23 Thread MartinRinehart
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a �crit : > > > > Bruno Desthuilliers wrote: > > > >>... that's definitively not > >>something I'd store in global. > > > > > > So where would you put it? > > You don't have to "put" functions arguments anywhere - they're already > local vars. Brun

Re: Inter-process communication, how? Part 2

2007-12-23 Thread ecir . hana
On Dec 23, 4:54 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sat, 22 Dec 2007 17:56:05 -0800 (PST), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > just to recap: last time I asked how to do an interprocess > > communitation, between one Manager process (graphical be

Re: Inter-process communication, how? Part 2

2007-12-23 Thread ecir . hana
On Dec 23, 10:30 am, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > 2007/12/22, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > Hello, > > > just to recap: last time I asked how to do an interprocess > > communitation, between one Manager process (graphical beckend) and > > some Worker processes. > > >

Re: Modify arguments between __new__ and __init__

2007-12-23 Thread Steven D'Aprano
On Sat, 22 Dec 2007 23:01:50 -0700, Steven Bethard wrote: > Steven D'Aprano wrote: >> When you call a new-style class, the __new__ method is called with the >> user-supplied arguments, followed by the __init__ method with the same >> arguments. >> >> I would like to modify the arguments after the

Re: 5 queens

2007-12-23 Thread Steven D'Aprano
On Sun, 23 Dec 2007 02:22:38 -0800, cf29 wrote: > How would you write a function that will populate a list with a list of > numbers with all the possibilities? For example a list of 3 numbers > taken among 4 [0,1,2,3] without duplicates. The result should be: > [0,1,2] > [0,1,3] > [0,2,3] > [1,2,3

Re: Element bug?(ElementTree)

2007-12-23 Thread limodou
On Dec 23, 2007 5:30 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > limodou wrote: > > > I don't know if it's a bug? Try below code: > > > > >>> from elementtree.ElementTree import Element > > >>> a = Element('a') > > >>> if a: > > ... print '' > > ... > > >>> a.__len__() > > 0 > > >

Python DLL in Windows Folder

2007-12-23 Thread Markus Gritsch
Hi, why does the Python installer on Windows put the Python DLL into the Windows system32 folder? Wouldn't it be more clean to place it into the Python installation folder beside the python.exe file? Kind regards, Markus -- http://mail.python.org/mailman/listinfo/python-list

Unicode Regular Expressions

2007-12-23 Thread bryan rasmussen
Hi, I'm writing a program that requires specifically Unicode regular expressions http://unicode.org/reports/tr18/ to be loaded in from an external file and then interpreted against the data. if I use Python Regular expressions is there a flag I can set to specify that the regular expressions that

Re: fiber(cooperative multi-threading)

2007-12-23 Thread Michael Sparks
Duncan Booth wrote: > Unfortunately generators only save a single level of stack-frame, so they > are not really a replacement for fibers/coroutines. The OP should perhaps > look at Stackless Python or Greenlets. See On the surface of things, the single level aspect *LOOKS* like a problem, but in

Re: Inter-process communication, how? Part 2

2007-12-23 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > What I don't like about FIFO, is that on Unix they are persistent > files. So whatever happens to Manager they would stay there... Nope. /tmp exists. Many distributions delete /tmp contents on reboot. > I was just wondering if there's another way of doing the above and

Re: Inter-process communication, how? Part 2

2007-12-23 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Ok, but how to redirect "print" statement into a socket? Create an object that has the socket's send-or-what-it's-called method as a member called "write" and bind this object to sys.stdout. Alternatively, you can use the "print "text" >> object" syntax (see language ref

Re: fiber(cooperative multi-threading)

2007-12-23 Thread Michael Sparks
Hi, > It just works, but using native Python threads for non-preemptive > threading is not cost-effective. Python has generator instead but it > seemed to be very restricted for general scripting. I wish I could > write nested (generator) functions easily at least. > > Is there any plan of imple

Re: Passing by reference

2007-12-23 Thread Marc 'BlackJack' Rintsch
On Sun, 23 Dec 2007 03:10:48 -0800, MartinRinehart wrote: > Bruno, right now I've got this: > > def __init__ ( self, t ): > """ Constructor, called with array of strings. """ > > self.text = t > ... > > Some other program will say: > tok = Toker( text_array ) > tokens = tok.tokenize

Re: Inter-process communication, how? Part 2

2007-12-23 Thread John Nagle
[EMAIL PROTECTED] wrote: > Hello, > > just to recap: last time I asked how to do an interprocess > communitation, between one Manager process (graphical beckend) and > some Worker processes. > > I decided to go with sockets, thanks for replies, once more. > > However, I would like to ask another

Re: Python DLL in Windows Folder

2007-12-23 Thread Thorsten Kampe
* Markus Gritsch (Sun, 23 Dec 2007 15:52:50 +0100) > why does the Python installer on Windows put the Python DLL into the > Windows system32 folder? Are you sure it does?! Thorsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode Regular Expressions

2007-12-23 Thread Jim
Have you googled? http://www.google.com/search?hl=en&q=python+regular+expression+unicode&btnG=Google+Search -- http://mail.python.org/mailman/listinfo/python-list

Re: Python DLL in Windows Folder

2007-12-23 Thread Markus Gritsch
On 23/12/2007, Thorsten Kampe <[EMAIL PROTECTED]> wrote: > * Markus Gritsch (Sun, 23 Dec 2007 15:52:50 +0100) > > why does the Python installer on Windows put the Python DLL into the > > Windows system32 folder? > > Are you sure it does?! Yes. Markus -- http://mail.python.org/mailman/listinfo/py

why does a disabled button respond to clicks

2007-12-23 Thread damonjulian
hi ,i created 3 buttons such that if button1 is clicked it will disable button2 ,and clicking button3 will restore state of button2 to normal, to my dismay i find that button2 still responds to clicks even if it is greyed out here is the code..am i doing something wrong? is there a way to truly d

Re: Python DLL in Windows Folder

2007-12-23 Thread Christian Heimes
Markus Gritsch wrote: > why does the Python installer on Windows put the Python DLL into the > Windows system32 folder? Wouldn't it be more clean to place it into > the Python installation folder beside the python.exe file? It's the easiest and best way to expose Python for 3rd party applications

Re:Re: Output buffer

2007-12-23 Thread Cesar D. Rodas
On 22/12/2007, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > Cesar D. Rodas wrote: > > > I am newbie in Python, but I like it very much. > > > > Right now I am having a problem, I am working with mod_python in apache. > > What I needing is a stdout buffering, that means that everything that I > > se

Re: Python DLL in Windows Folder

2007-12-23 Thread Markus Gritsch
On 23/12/2007, Christian Heimes <[EMAIL PROTECTED]> wrote: > Markus Gritsch wrote: > > why does the Python installer on Windows put the Python DLL into the > > Windows system32 folder? Wouldn't it be more clean to place it into > > the Python installation folder beside the python.exe file? > > It'

Releasing malloc'd memory using ctypes?

2007-12-23 Thread skip
I am starting to experiment with ctypes. I have a function which returns a pointer to a struct allocated in heap memory. There is a corresponding free function for that sort of struct, e.g.: from ctypes import * cdll.LoadLibrary("libthing.so") c_thing = CDLL("libthing.so") clas

=?UTF-8?Q?=E2=96=BA=E2=96=BA=E2=96=BA_Earn_MILLIONS_online, _working_One_Hour_a_D?= AY ◄◄◄

2007-12-23 Thread sandy
Would you like a side-income of 1000's of Dollars a month? YES, This is possible if you have the skills to trade Forex. AND you can do all this without monitoring the market constantly. The Website listed below is tailored to both the new as well as the intermediate trader. In it, you will lear

clearing selection in Tix.FileSelectBox

2007-12-23 Thread [EMAIL PROTECTED]
hello i am creating a Tix.FileSelectBox to select some jpeg files on clicking an OK button i wish to get the selected imagename as string ,so i code like below class TixGUI: def __init__(self, parent): self.imgsel=FileSelectBox(self.bgframe) self.i

Re: exception message output problem

2007-12-23 Thread Florian Diesch
Lie <[EMAIL PROTECTED]> wrote: > # Python have an odd (read: broken) singleton implementation > # single member tuple must have a comma behind it Otherwise (1+2)+(3+4) would evaluate to (3, 7) instead of 10. Florian --

Re: fiber(cooperative multi-threading)

2007-12-23 Thread Duncan Booth
Michael Sparks <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: > >> Unfortunately generators only save a single level of stack-frame, so >> they are not really a replacement for fibers/coroutines. The OP >> should perhaps look at Stackless Python or Greenlets. See > > On the surface of things,

MySQL-python Error

2007-12-23 Thread Steve Ametjan
I've been trying to get MySQL-python to install on Leopard for the past couple of days, and I keep running into relatively the same error. I'm hoping that someone on this list will be able to help me out in solving the issue. I'd like to get this solved so I can continue developing with Dja

Re: How to get Python to default to UTF8

2007-12-23 Thread Martin v. Löwis
> However, the situation is still unacceptable to me because I often make > mistakes and it is easy for me to miss places where encoding is necessary. I > rely on testing to find my faults. On my development environment, I get no > error message and it seems that everything works perfectly. Howe

Re: Unicode Regular Expressions

2007-12-23 Thread Martin v. Löwis
> I'm writing a program that requires specifically Unicode regular > expressions http://unicode.org/reports/tr18/ to be loaded in from an > external file and then interpreted against the data. if I use Python > Regular expressions is there a flag I can set to specify that the > regular expressions

Re: Python DLL in Windows Folder

2007-12-23 Thread Ross Ridge
Markus Gritsch <[EMAIL PROTECTED]> wrote: >... We are embedding Python into our application which >gets compiled using MSVC 8.0. We like to link dynamically, so the >Python interpreter is not statically linked into the program. The >Python DLL from the Python installer in the Windows system32 fol

Re: fiber(cooperative multi-threading)

2007-12-23 Thread Michael Sparks
Duncan Booth wrote: > Michael Sparks <[EMAIL PROTECTED]> wrote: > >> Duncan Booth wrote: >> >>> Unfortunately generators only save a single level of stack-frame, so >>> they are not really a replacement for fibers/coroutines. The OP >>> should perhaps look at Stackless Python or Greenlets. See >

Re: fiber(cooperative multi-threading)

2007-12-23 Thread Martin v. Löwis
> Is there any plan of implementing real (lightweight) fiber in Python? I have no such plan, and I don't know of anybody else's plan, either. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get Python to default to UTF8

2007-12-23 Thread John Nagle
weheh wrote: > Hi Fredrik, > > Thanks again for your feedback. I am much obliged. > Bear in mind that in Python, ASCII currently means ASCII, values 0..127. Type "str" will accept values > 127. However, the default conversion from "str" to "unicode" requires true ASCII values, in 0..127.

convert pdf to png

2007-12-23 Thread Carl K
I need to take the take the pdf output from reportlab and create a preview image for a web page. so png or something. I am sure ghostscript will be involved. I am guessing PIL or ImageMagic ? all sugestions welcome. Carl K -- http://mail.python.org/mailman/listinfo/python-list

Happy Christmas Pythoneers

2007-12-23 Thread Paddy
After quite enjoying participating in the group in 2007, I'd like to wish you all a Merry Xmas. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Happy Christmas Pythoneers

2007-12-23 Thread rishi pathak
Is santa clause subscribed to the list . I want a gift:) On 12/24/07, Paddy <[EMAIL PROTECTED]> wrote: > > After quite enjoying participating in the group in 2007, I'd like to > wish you all a Merry Xmas. > > - Paddy. > -- > http://mail.python.org/mailman/listinfo/python-list > -- Regards-

Re: Happy Christmas Pythoneers

2007-12-23 Thread Cesar D. Rodas
On 24/12/2007, rishi pathak <[EMAIL PROTECTED]> wrote: > > Is santa clause subscribed to the list . > I want a gift:) Me too!, :-) On 12/24/07, Paddy <[EMAIL PROTECTED]> wrote: > > > > After quite enjoying participating in the group in 2007, I'd like to > > wish you all a Merry Xmas. > > > >