Reference Cycles with instance method

2011-03-08 Thread Amit Dev
Simple question. If I have the following code: class A: def __init__(self, s): self.s = s self.m2 = m1 def m1(self): pass if __name__ == '__main__': a = A("ads") a.m1() a = None The object is not garbage collected, since there appears to be a cycle (b

Re: Defining class attributes + inheritance

2011-03-08 Thread Santoso Wijaya
Remember the mantra, "Explitic is better than implicit." ;-) ~/santa On Tue, Mar 8, 2011 at 7:15 PM, Martin De Kauwe wrote: > On Mar 9, 12:53 pm, "Rhodri James" > wrote: > > On Wed, 09 Mar 2011 01:00:29 -, Martin De Kauwe > > > wrote: > > > > > class BaseClass(object): > > >def __ini

Re: Python language changes that first shipped in something besides CPython?

2011-03-08 Thread Paul Rubin
Terry Reedy writes: > For that type of feature, I am pretty sure the answer is no. There are > developers from other implementations that have cpython commit rights > and they have contributed new tests. Modules? I have never seen 'We > first did this with xpython on the tracker, but it is possibl

Re: Defining class attributes + inheritance

2011-03-08 Thread Martin De Kauwe
On Mar 9, 12:53 pm, "Rhodri James" wrote: > On Wed, 09 Mar 2011 01:00:29 -, Martin De Kauwe   > wrote: > > > class BaseClass(object): > >    def __init__(self, a, b, c, d): > >         self.a = a > >         self.b = b > >         self.c = c > >         self.d = d > > > class NewClass(BaseCla

Re: Defining class attributes + inheritance

2011-03-08 Thread Rhodri James
On Wed, 09 Mar 2011 01:00:29 -, Martin De Kauwe wrote: class BaseClass(object): def __init__(self, a, b, c, d): self.a = a self.b = b self.c = c self.d = d class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new)

Re: Defining class attributes + inheritance

2011-03-08 Thread Santoso Wijaya
Here's how you do inheritance: C:\>python Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> class BaseClass(object): ... def __init__(self, a, b, c, d): ... self.a = a ... self.b = b ...

Re: Python language changes that first shipped in something besides CPython?

2011-03-08 Thread Terry Reedy
On 3/8/2011 4:39 PM, Larry Hastings wrote: Adding to my previous response, extended slices and ellipses were added for numerical python, but that is cpython extension, not alternative. The 3.x memoryview came from there too, I believe. -- Terry Jan Reedy -- http://mail.python.org/mailman/list

Re: Python language changes that first shipped in something besides CPython?

2011-03-08 Thread Terry Reedy
On 3/8/2011 4:39 PM, Larry Hastings wrote: I'm doing a talk at PyCon about changes to the Python language. I'm wondering: are there any Python language changes that first shipped in an implementation of Python besides CPython? The sort of answer I'm looking for: "set literals first shipped in J

Re: Defining class attributes + inheritance

2011-03-08 Thread Martin De Kauwe
On Mar 9, 11:50 am, "Rhodri James" wrote: > On Wed, 09 Mar 2011 00:29:18 -, Martin De Kauwe   > wrote: > > > > > > > > > On Mar 9, 10:20 am, Ethan Furman wrote: > [snip] > >> Just make sure and call the parent's constructor, either with > > >> class NewClass(BaseClass): > >>      def __init_

Re: Defining class attributes + inheritance

2011-03-08 Thread Rhodri James
On Wed, 09 Mar 2011 00:29:18 -, Martin De Kauwe wrote: On Mar 9, 10:20 am, Ethan Furman wrote: [snip] Just make sure and call the parent's constructor, either with class NewClass(BaseClass): def __init__(self, ): BaseClass.__init__(self, other_params) or class NewC

Re: Defining class attributes + inheritance

2011-03-08 Thread James Mills
On Wed, Mar 9, 2011 at 9:20 AM, Ethan Furman wrote: > Just make sure and call the parent's constructor, either with > > class NewClass(BaseClass): >    def __init__(self, ): >        BaseClass.__init__(self, other_params) > > or > > class NewClass(BaseClass): >    def __init__(self, ): >  

Re: attach to process by pid?

2011-03-08 Thread James Mills
On Wed, Mar 9, 2011 at 9:20 AM, Danny Shevitz wrote: > Is there any way to attach to an already running process by pid? I want to > send > commands from python to an application that is already running. I don't want > to > give the command name to subprocess.Popen. Unless I'm missing something

Re: Defining class attributes + inheritance

2011-03-08 Thread Martin De Kauwe
On Mar 9, 10:20 am, Ethan Furman wrote: > Martin De Kauwe wrote: > > Hi, > > > I think this might be obvious? I have a base class which contains X > > objects which other classes inherit e.g. > > > class BaseClass(object): > >     def __init__(self, something, something_else): > >         self.som

Re: multiprocessing module in async db query

2011-03-08 Thread John Nagle
On 3/8/2011 3:34 PM, Philip Semanchuk wrote: On Mar 8, 2011, at 3:25 PM, Sheng wrote: This looks like a tornado problem, but trust me, it is almost all about the mechanism of multiprocessing module. [snip] So the workflow is like this, get() --> fork a subprocess to process the query re

Re: Deploying on Windows servers : advice sought a module

2011-03-08 Thread Waldemar Osuch
At my work place I still use py2exe but I do not rely on its automatic discovery and packaging. The setup.py lists all the dependencies explicitly in "packages" and "includes" parameters. These end up in library.zip. Then the source file paths with the actual business logic are gathered with

Re: multiprocessing module in async db query

2011-03-08 Thread Philip Semanchuk
On Mar 8, 2011, at 3:25 PM, Sheng wrote: > This looks like a tornado problem, but trust me, it is almost all > about the mechanism of multiprocessing module. [snip] > So the workflow is like this, > > get() --> fork a subprocess to process the query request in > async_func() -> when async_fun

attach to process by pid?

2011-03-08 Thread Danny Shevitz
Howdy, Is there any way to attach to an already running process by pid? I want to send commands from python to an application that is already running. I don't want to give the command name to subprocess.Popen. thanks, Danny -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickle a list

2011-03-08 Thread Irmen de Jong
On 07-03-11 17:38, Rogerio Luz wrote: import sys import pickle class MyClass: teste = 0 nome = None lista = ["default"] def __init__(self): for reg in range(1,10): self.lista.append(reg) ^^ This probably doesn't do w

Re: Defining class attributes + inheritance

2011-03-08 Thread Ethan Furman
Martin De Kauwe wrote: Hi, I think this might be obvious? I have a base class which contains X objects which other classes inherit e.g. class BaseClass(object): def __init__(self, something, something_else): self.something = something self.something_else = something_else

Re: Defining class attributes + inheritance

2011-03-08 Thread Benjamin Kaplan
On Mar 8, 2011 6:02 PM, "Martin De Kauwe" wrote: > > Hi, > > I think this might be obvious? I have a base class which contains X > objects which other classes inherit e.g. > > class BaseClass(object): >def __init__(self, something, something_else): >self.something = something >

Defining class attributes + inheritance

2011-03-08 Thread Martin De Kauwe
Hi, I think this might be obvious? I have a base class which contains X objects which other classes inherit e.g. class BaseClass(object): def __init__(self, something, something_else): self.something = something self.something_else = something_else # etc Typically I w

Re: A question about Cmd Class

2011-03-08 Thread Dog Walker
On Monday 2011 March 07 18:41, yuan zheng wrote: > Hello, everyone: > > I encouter a question when implementing a commmand line(shell). > I have implemented some commands, such as "start", "stop", "quit", > they are easily implemented by "do_start", "do_stop" and "do_quit". > there are no troub

Python language changes that first shipped in something besides CPython?

2011-03-08 Thread Larry Hastings
I'm doing a talk at PyCon about changes to the Python language. I'm wondering: are there any Python language changes that first shipped in an implementation of Python besides CPython? The sort of answer I'm looking for: "set literals first shipped in Jython 2.2, six months before they ship

Re: Finding keywords

2011-03-08 Thread Terry Reedy
On 3/8/2011 2:00 PM, Matt Chaput wrote: On 08/03/2011 8:58 AM, Cross wrote: I know meta tags contain keywords but they are not always reliable. I can parse xhtml to obtain keywords from meta tags; but how do I verify them. To obtain reliable keywords, I have to parse the plain text obtained from

multiprocessing module in async db query

2011-03-08 Thread Sheng
This looks like a tornado problem, but trust me, it is almost all about the mechanism of multiprocessing module. I borrowed the idea from http://gist.github.com/312676 to implement an async db query web service using tornado. p = multiprocessing.Pool(4) class QueryHandler(tornado.web.RequestHandl

Re: SCM

2011-03-08 Thread Rafe Kettler
On Mar 8, 7:21 am, Stefan Behnel wrote: > Cliff Scherer, 08.03.2011 12:42: > > > I am looking for a Python library, which can handle the modelling of > > material flows in Supply Chains. > > Note that TLAs do not always uniquely identify a subject. "SCM" is easily > read as "source code managemen

Re: embedded python 2.7.1 slow startup

2011-03-08 Thread Terry Reedy
On 3/8/2011 4:06 AM, bruce bushby wrote: Hi I've been playing with running python on embedded linux. I thought I would run some "straces" to see how the install went when I noticed python attempts to "open" loads of files that don't exist.is there a way to prevent these "open" attemptsth

Re: Numerical representation

2011-03-08 Thread Jon Herman
Thanks all for the input, the remark about printing intermediate steps was a very good one (and so obvious I can't believe it took me this long to get there...) The error was in my loop where I multiply by the "b" or "beta" coefficients. The range for this loop (marked by j) is set up properly in

Re: CentOS 5.5 x86_64 rpmbuild from source

2011-03-08 Thread J.O. Aho
William S. wrote: > I will answer myself. For those interested, because rpm will break the > dependencies on the OS, you can install 2.7 with a simple bash script: > http://willsani.com/2011/03/02/centos-5-5-x86_64-install-python-2-7/ If you use a spec file for the original RPM and modify it for

Re: Finding keywords

2011-03-08 Thread Vlastimil Brom
2011/3/8 Cross : > On 03/08/2011 06:09 PM, Heather Brown wrote: >> >> The keywords are an attribute in a tag called , in the section >> called >> . Are you having trouble parsing the xhtml to that point? >> >> Be more specific in your question, and somebody is likely to chime in. >> Although >> I'm

RE: CentOS 5.5 x86_64 rpmbuild from source

2011-03-08 Thread William S .
I will answer myself. For those interested, because rpm will break the dependencies on the OS, you can install 2.7 with a simple bash script: http://willsani.com/2011/03/02/centos-5-5-x86_64-install-python-2-7/ Regards, Will -- http://mail.python.org/mailman/listinfo/python-list

Re: Dijkstra Algorithm Help

2011-03-08 Thread yoro
On Mar 8, 6:49 pm, MRAB wrote: > On 08/03/2011 18:12, yoro wrote: > > > > > Hello, > > > I am having a little trouble writing Dijkstra's Algorithm, at the > > point where I have to calculate the distance of each node from the > > source - here is my code so far: > > > infinity = 100 > > invali

Re: Finding keywords

2011-03-08 Thread Matt Chaput
On 08/03/2011 8:58 AM, Cross wrote: I know meta tags contain keywords but they are not always reliable. I can parse xhtml to obtain keywords from meta tags; but how do I verify them. To obtain reliable keywords, I have to parse the plain text obtained from the URL. I think maybe what the OP is

Re: python cmd.Cmd auto complete feature

2011-03-08 Thread Peter Otten
Jean-Michel Pichavant wrote: > I'm trying to autoexpand values as well as arguments using the builtin > cmd.Cmd class. > > I.E. > Consider the following command and arguments: > > > sayHello target=Georges > 'Hello Georges !' > > I can easily make 'tar' expand into 'target=' however I'd like t

Re: Dijkstra Algorithm Help

2011-03-08 Thread MRAB
On 08/03/2011 18:12, yoro wrote: Hello, I am having a little trouble writing Dijkstra's Algorithm, at the point where I have to calculate the distance of each node from the source - here is my code so far: infinity = 100 invalid_node = -1 startNode = 0 class Node: distFromSource = in

Deploying on Windows servers : advice sought a module

2011-03-08 Thread Rory Campbell-Lange
We have written a cross-platform monitoring system that we have deployed on our Linux servers and wish to put on our Windows servers too. In the past I've played with py2exe and similar packages. However the frequent updates to the monitoring suite mean that reinstalling an exe for each update wou

Dijkstra Algorithm Help

2011-03-08 Thread yoro
Hello, I am having a little trouble writing Dijkstra's Algorithm, at the point where I have to calculate the distance of each node from the source - here is my code so far: infinity = 100 invalid_node = -1 startNode = 0 class Node: distFromSource = infinity previous = invalid_node

Re: Switching between Python releases under Windows

2011-03-08 Thread Thomas L. Shinnick
At 10:03 AM 3/8/2011, Tim Golden wrote: On 08/03/2011 15:58, Tim Golden wrote: On 08/03/2011 14:55, Edward Diener wrote: I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions

python cmd.Cmd auto complete feature

2011-03-08 Thread Jean-Michel Pichavant
Hello folks, I'm trying to autoexpand values as well as arguments using the builtin cmd.Cmd class. I.E. Consider the following command and arguments: > sayHello target=Georges 'Hello Georges !' I can easily make 'tar' expand into 'target=' however I'd like to be able to expand the value as

Re: Switching between Python releases under Windows

2011-03-08 Thread Ulrich Eckhardt
Edward Diener wrote: > I have multiple versions of Python installed under Vista. Is there any > easy way of switching between them so that invoking python and file > associations for Python extensions files work automatically ? These associations are stored in the registry. Just cut out the accord

Re: Switching between Python releases under Windows

2011-03-08 Thread Tim Golden
On 08/03/2011 15:58, Tim Golden wrote: On 08/03/2011 14:55, Edward Diener wrote: I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions files work automatically ? Well, the an

Re: Switching between Python releases under Windows

2011-03-08 Thread Tim Golden
On 08/03/2011 14:55, Edward Diener wrote: I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions files work automatically ? Well, the answer depends a bit on how au fait you ar

Switching between Python releases under Windows

2011-03-08 Thread Edward Diener
I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions files work automatically ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding keywords

2011-03-08 Thread Cross
On 03/08/2011 06:09 PM, Heather Brown wrote: The keywords are an attribute in a tag called , in the section called . Are you having trouble parsing the xhtml to that point? Be more specific in your question, and somebody is likely to chime in. Although I'm not the one, if it's a question of par

Re: A question about Cmd Class

2011-03-08 Thread Peter Otten
yuan zheng wrote: > Hello, everyone: > > I encouter a question when implementing a commmand line(shell). > I have implemented some commands, such as "start", "stop", "quit", > they are easily implemented by "do_start", "do_stop" and "do_quit". > there are no troubles. > But I want to imp

Re: Generate PDF with Tamil font problem

2011-03-08 Thread Robin Becker
On 05/03/2011 05:20, sathe...@e-ndicus.com wrote: Hi All, I am using python's reportlab to print some unicode Tamil characters 'பே'. I added necessary unicode font to reportlab. But It prints the output as 'ேப' (in reverse order). This issue happens for multi-byte characters, whereas for cha

Re: Finding keywords

2011-03-08 Thread Heather Brown
On 01/-10/-28163 02:59 PM, Cross wrote: Hello I have got a project in which I have to extract keywords given a URL. I would like to know methods for extraction of keywords. Frequency of occurence is one; but it seems naive. I would prefer something more robust. Please suggest. Regards Cross --

Re: A question about Cmd Class

2011-03-08 Thread Dave Angel
On 01/-10/-28163 02:59 PM, yuan zheng wrote: Hello, everyone: I encouter a question when implementing a commmand line(shell). I have implemented some commands, such as "start", "stop", "quit", they are easily implemented by "do_start", "do_stop" and "do_quit". there are no troubles. B

Re: SCM

2011-03-08 Thread Stefan Behnel
Cliff Scherer, 08.03.2011 12:42: I am looking for a Python library, which can handle the modelling of material flows in Supply Chains. Note that TLAs do not always uniquely identify a subject. "SCM" is easily read as "source code management" or "software configuration management" on a progra

Re: SCM

2011-03-08 Thread Chris Rebert
On Tue, Mar 8, 2011 at 3:42 AM, Cliff Scherer wrote: > Hi, > I am looking for a Python library, which can handle the modelling of > material flows in Supply Chains. > > Any idea ? Some googling turned up https://sites.google.com/a/logopt.com/www/ If you're doing simulations, GarlicSim might be u

SCM

2011-03-08 Thread Cliff Scherer
Hi, I am looking for a Python library, which can handle the modelling of material flows in Supply Chains. Any idea ? Thx -- http://mail.python.org/mailman/listinfo/python-list

Re: encoding hell - any chance of salvation ?

2011-03-08 Thread southof40
Thanks for both the suggestions. I haven't yet had time to try them out but will do so and report back. -- http://mail.python.org/mailman/listinfo/python-list

Re: embedded python 2.7.1 slow startup

2011-03-08 Thread Kushal Kumaran
On Tue, Mar 8, 2011 at 2:36 PM, bruce bushby wrote: > Hi > I've been playing with running python on embedded linux. I thought I would > run some "straces" to see how the install went when I noticed python > attempts to "open" > loads of files that don't exist.is there a way to prevent these "o

Re: Finding keywords

2011-03-08 Thread Ulrich Eckhardt
Cross wrote: > On 03/08/2011 01:27 PM, Chris Rebert wrote: > Well Chris, my implementation is in Python. :) That is as much > python-specific as it gets. > > Well the question is general of course and I want to discuss the problem > here. If you have anything written in Python yet and want to pre

embedded python 2.7.1 slow startup

2011-03-08 Thread bruce bushby
Hi I've been playing with running python on embedded linux. I thought I would run some "straces" to see how the install went when I noticed python attempts to "open" loads of files that don't exist.is there a way to prevent these "open" attemptsthey're responsible for 40% of my scripts exe

Re: Generate PDF with Tamil font problem

2011-03-08 Thread Selvam
On Sat, Mar 5, 2011 at 5:28 PM, Tom Zych wrote: > sathe...@e-ndicus.com wrote: > >I am using python's reportlab to print some unicode Tamil characters > > 'பே'. I added necessary unicode font to reportlab. But It > > prints the output as 'ேப' (in reverse order). This issue > > happens for mul

Re: ImSim: Image Similarity

2011-03-08 Thread Ian Kelly
On Mon, Mar 7, 2011 at 6:30 AM, n00m wrote: > Remind me this piece of humor: > > One man entered a lift cabin at the 1st floor, > lift goes to the3rd floor, opens and ... it's empty! > Physicist, Chemist and Mathematician were asked: > what happened to the man? > > Physicist: he was squashed to th

Re: Finding keywords

2011-03-08 Thread Cross
On 03/08/2011 01:27 PM, Chris Rebert wrote: Complaint: This question is not Python-specific in any way. Regards, Chris Well Chris, my implementation is in Python. :) That is as much python-specific as it gets. Well the question is general of course and I want to discuss the problem here.

Re: Finding keywords

2011-03-08 Thread Chris Rebert
On Mon, Mar 7, 2011 at 11:18 PM, Cross wrote: > Hello > > I have got a project in which I have to extract keywords given a URL. I > would like to know methods for extraction of keywords. Frequency of > occurence is one; but it seems naive. I would prefer something more robust. > Please suggest. >