Re: Python-list Digest, Vol 64, Issue 644
is python a pure objected oriented language? On Thu, Jan 29, 2009 at 2:08 PM, wrote: > Send Python-list mailing list submissions to >python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, visit >http://mail.python.org/mailman/listinfo/python-list > or, via email, send a message with subject or body 'help' to >python-list-requ...@python.org > > You can reach the person managing the list at >python-list-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Python-list digest..." > > Today's Topics: > > 1. Re: dicts,instances,containers, slotted instances, et cetera. > (Michele Simionato) > 2. Re: Recommendation for a small web framework like Perl's > CGI::Application to run as CGI? (Jeroen Ruigrok van der Werven) > 3. Re: Profiling Python Apps on Mac? (Robert Kern) > 4. Re: Results of executing hyperlink in script (Tino Wildenhain) > 5. Re: I'm a python addict ! (afri...@yahoo.co.uk) > 6. ANN: eGenix mx Base Distribution 3.1.2 > (eGenix Team: M.-A. Lemburg) > > > -- Forwarded message -- > From: Michele Simionato > To: python-list@python.org > Date: Wed, 28 Jan 2009 22:17:12 -0800 (PST) > Subject: Re: dicts,instances,containers, slotted instances, et cetera. > On Jan 29, 12:23 am, ocsch...@gmail.com wrote: > > > I just find it odd that there's no quick answer on the > > fastest way in Python to implement a mapping in this context. > > A Python dict is as fast as you can get. If that is not enough, your > only choice is to try something at the C level, which may give the > desired speedup or not. Good luck! > > Michele Simionato > > > > -- Forwarded message -- > From: Jeroen Ruigrok van der Werven > To: excord80 > Date: Thu, 29 Jan 2009 07:31:54 +0100 > Subject: Re: Recommendation for a small web framework like Perl's > CGI::Application to run as CGI? > -On [20090128 20:36], excord80 (excor...@gmail.com) wrote: > >If that's correct, it would be great if there were a Werkzeug tutorial > >on deploying it for use with CGI. > > There are some real life frontends for CGI, FCGI and WSGI in Zine[1]. Look > in the servers directory in the repository. > > I'll double check the documentation and expand where necessary. > > [1] http://zine.pocoo.org/ > > -- > Jeroen Ruigrok van der Werven / asmodai > イェルーン ラウフロック ヴァン デル ウェルヴェン > http://www.in-nomine.org/ | http://www.rangaku.org/ | GPG: 2EAC625B > Earth to earth, ashes to ashes, dust to dust... > > > > -- Forwarded message -- > From: Robert Kern > To: python-list@python.org > Date: Thu, 29 Jan 2009 00:47:46 -0600 > Subject: Re: Profiling Python Apps on Mac? > On 2009-01-28 13:14, RGK wrote: > >> I'm writing a python app on a Mac (in Eclipse + PyDev w/ Python2.5 & >> wxPython under OSX 10.4) >> >> As I make program architecture decisions, it would be nice to be able to >> profile the choices. Should I add that extra thread? Is this big-assed >> xml object I just created horribly bloated or kind of ordinary. >> >> Is there anything out there I should look into to if I want to see how >> those things are affecting my app? The closest I have is the widget >> iStat, but it's a very static low resolution view of what's really going >> on. >> > > I have a script kernprof.py which provides a few conveniences over the > builtin cProfile module. One of its modes of operation is to inject a > decorator into the __builtins__. It will enable the profiler on entry to the > method and disable it on exit. This lets you localize your profile results > to just the part of your code that you are interested in. I found this > especially useful in GUI apps which require user interaction to trigger the > part of the code you are actually interesting in profiling. You don't want > the interesting parts of your profile to be obscured by the GUI event loop > waiting for your input. > > You can get it as part of my line_profiler package (which you may also be > interested in; cProfile profiles function calls, line_profiler profiles > individual lines). > > http://pypi.python.org/pypi/line_profiler > > You can view the profile results interactively with "python -m pstats > my_script.py.prof", RunSnakeRun, or pyprof2calltree if you manage to install > kcachegrind on your system: > > http://www.vrplumber.com/programming/runsnakerun/ > http://pypi.python.org/pypi/pyprof2calltree/1.1.0 > > I don't recommend using hotshot because it is deprecated and slow to > postprocess the data dumps. Also, I don't recommend using the plain profile > module because it slows down your program rather more than cProfile. See the > Python documentation for an overview of these modules: > > http://docs.python.org/library/profile > > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, a harmless > enigma > that is made terrible by our own mad attempt to interpret it as though it > had > a
is python Object oriented??
Object oriented languages doesn't allow execution of the code without class objects, what is actually happening when we execute some piece of code, is it bound to any class? Those who have time and consideration can help me -- Regards, Maneesh KB Comat Technologies Bangalore Mob: 9740-192309 We work with the underprivileged and in rural India. If you are interested to be a part of it, please mail or call me. I will be happy to share and inform - http://www.comat.com -- http://mail.python.org/mailman/listinfo/python-list
Re: is python Object oriented??
but still I am not clear of the execution of the code, when we write or execute a piece of python code without defining class, predefined class attributes are available (not all but __name__ and __doc__ are available). does it mean anything to this topic. Is it necessory to have __module__, __dict__ and __bases__ for a class object in python? On Thu, Jan 29, 2009 at 5:21 PM, Tino Wildenhain wrote: > Muriel de Souza Godoi wrote: > >> Python offers support for object orientation, but it's not an >> object-oriented language. >> I mean, you can code a entire program in Python with no classes. So you >> use it if you want to. >> >> It's not like java, which you must use a class to code a Hello World, but >> Java isn't fully object-oriented, because it doesn't provide support for >> multiple inheritance and it has primitive types (multiple interfaces and >> wrappers to primitive types doesn't count :) ) >> >> AFAIK, the unique fully object oriented languagem is Smaltalk. (maybe >> Simula?), where everything is a class, even the primitive types. >> > > well actually except keywords, everything is an object in python too, > including of course primitive types (if you say so - practically python > does not have them). > > Regards > Tino > -- Regards, Maneesh KB Comat Technologies Bangalore Mob: 9740-192309 We work with the underprivileged and in rural India. If you are interested to be a part of it, please mail or call me. I will be happy to share and inform - http://www.comat.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python-list Digest, Vol 65, Issue 365
I think the given statement below will give you what you r looking .__file__print On Wed, Feb 18, 2009 at 2:43 PM, wrote: > Send Python-list mailing list submissions to >python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, visit >http://mail.python.org/mailman/listinfo/python-list > or, via email, send a message with subject or body 'help' to >python-list-requ...@python.org > > You can reach the person managing the list at >python-list-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Python-list digest..." > > Today's Topics: > > 1. Directory (gtillmon) > 2. Re: Is there something easier than ORM? (Michele Simionato) > 3. Re: flexible find and replace ? (OdarR) > 4. Re: urllib confusion (Steven D'Aprano) > 5. Re: numpy.memmap advice? (Carl Banks) > 6. Building python with sqlite3 (Justin Li) > 7. Calling a script requiring user input from another script > (mzagu...@gmail.com) > 8. Re: Python 3D CAD -- need collaborators, or just brave souls > :) (r) > 9. PyYaml in standard library? (Brendan Miller) > 10. Re: Building python with sqlite3 (Christian Heimes) > > > -- Forwarded message -- > From: gtillmon > To: > Date: Tue, 17 Feb 2009 17:18:11 -0800 (PST) > Subject: Directory > Hello. I am new to the Python language. > I would like to know how to display and store the path of each mondule > that is called. > Similar to the old READY TRACE in COBOL of long ago. > > Thanks, > George > > > > -- Forwarded message -- > From: Michele Simionato > To: > Date: Tue, 17 Feb 2009 08:46:02 -0800 (PST) > Subject: Re: Is there something easier than ORM? > On Feb 17, 5:35 pm, Philip Semanchuk wrote: > > > > I don't intend this as a criticism of SqlAlchemy. On the contrary I am > > impressed by what it does. But I often see people promoting ORM as the > > solution to all database access problems, and I certainly don't feel > > like it is. > > I am also not a big fan of ORM, especially in situations where you > have > performance issues and you are using database specific features. In > such situations > you don't care about portability, but you care about having your SQL > explicit, > so that you can run it directly under the profiler. > > > > -- Forwarded message -- > From: OdarR > To: > Date: Tue, 17 Feb 2009 11:29:19 -0800 (PST) > Subject: Re: flexible find and replace ? > Thanks to everybody. > I need to test your propositions now :) > > Olivier > > > > -- Forwarded message -- > From: Steven D'Aprano > To: python-list@python.org > Date: 18 Feb 2009 08:33:08 GMT > Subject: Re: urllib confusion > On Wed, 18 Feb 2009 01:17:40 -0700, Tim H wrote: > > > When I attempt to open 2 different pages on the same site I get 2 copies > > of the first page. ?? > ... > > Any thoughts? > > What does your browser do? > > What does your browser do if you turn off cookies, re-directions and/or > referers? > > > > -- > Steven > > > > -- Forwarded message -- > From: Carl Banks > To: python-list@python.org > Date: Wed, 18 Feb 2009 00:56:10 -0800 (PST) > Subject: Re: numpy.memmap advice? > On Feb 17, 3:08 pm, Lionel wrote: > > Hello all, > > > > On a previous thread (http://groups.google.com/group/comp.lang.python/ > > browse_thread/thread/64da35b811e8f69d/67fa3185798ddd12? > > hl=en&lnk=gst&q=keene#67fa3185798ddd12) I was asking about reading in > > binary data. Briefly, my data consists of complex numbers, 32-bit > > floats for real and imaginary parts. The data is stored as 4 bytes > > Real1, 4 bytes Imaginary1, 4 bytes Real2, 4 bytes Imaginary2, etc. in > > row-major format. I needed to read the data in as two separate numpy > > arrays, one for real values and one for imaginary values. > > > > There were several very helpful performance tips offered, and one in > > particular I've started looking into. The author suggested a > > "numpy.memmap" object may be beneficial. It was suggested I use it as > > follows: > > > > descriptor = dtype([("r", " > data = memmap(filename, dtype=descriptor, mode='r').view(recarray) > > print "First 100 real values:", data.r[:100] > > > > I have two questions: > > 1) What is "recarray"? > > Let's look: > > [GCC 4.3.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import numpy > >>> numpy.recarray > > >>> help(numpy.recarray) > > Help on class recarray in module numpy.core.records: > > class recarray(numpy.ndarray) > | recarray(shape, dtype=None, buf=None, **kwds) > | > | Subclass of ndarray that allows field access using attribute > lookup. > | > | Parameters > | -- > | shape : tuple > | shape of record array > | dtype : data-type or None > | The desired data-type. If this is None, then the data-type is > determine > | by the *formats*, *names*, *titles*, *aligned*, and > *byteorder* keywor
os module
Hi, I am writing a server side program, clients can be any machine but the server machine is Linux. In program I want to use the OS module based on the client's operating system. But when I do "import os" m only able to get the module with the property of Linux. ANy idea how to import the module with the property of clients OS. -- Regards, Maneesh KB Comat Technologies Bangalore Mob: 9740-192309 We work with the underprivileged and in rural India. If you are interested to be a part of it, please mail or call me. I will be happy to share and inform - http://www.comat.com -- http://mail.python.org/mailman/listinfo/python-list
Re: os module
Hi Chris, Thanks for quick and kind reply, but the python program runs on the server, sys.platform is linux only. What I want is I need to get a module, which shud be exactly same as if I import os module on the client machine On Mon, Mar 2, 2009 at 1:59 PM, Chris Rebert wrote: > On Mon, Mar 2, 2009 at 12:26 AM, M Kumar wrote: > > > > Hi, > > > > I am writing a server side program, clients can be any machine but the > > server machine is Linux. In program I want to use the OS module based on > the > > client's operating system. But when I do "import os" m only able to get > the > > module with the property of Linux. ANy idea how to import the module with > > the property of clients OS. > > You want sys.platform; see > http://docs.python.org/library/sys.html#sys.platform > > Cheers, > Chris > > -- > Shameless self-promotion: > http://blog.rebertia.com > -- Regards, Maneesh KB Comat Technologies Bangalore Mob: 9740-192309 We work with the underprivileged and in rural India. If you are interested to be a part of it, please mail or call me. I will be happy to share and inform - http://www.comat.com -- http://mail.python.org/mailman/listinfo/python-list
Re: os module
Oh that might be the problem, I m new to this and new to this kind of conversations. What you said was correct. But what I am looking for is, if one client reqst comes I need to process the data which I got from the client, so I need to use the os module. But since my program executes on the server os.sys.platform has the value "linux2". What I want is a module having clients platform value for os.sys.platform. Any way to get that? On Mon, Mar 2, 2009 at 2:17 PM, Chris Rebert wrote: > > On Mon, Mar 2, 2009 at 1:59 PM, Chris Rebert wrote: > >> > >> On Mon, Mar 2, 2009 at 12:26 AM, M Kumar wrote: > >> > > >> > Hi, > >> > > >> > I am writing a server side program, clients can be any machine but the > >> > server machine is Linux. In program I want to use the OS module based > on > >> > the > >> > client's operating system. But when I do "import os" m only able to > get > >> > the > >> > module with the property of Linux. ANy idea how to import the module > >> > with > >> > the property of clients OS. > >> > >> You want sys.platform; see > >> http://docs.python.org/library/sys.html#sys.platform > On Mon, Mar 2, 2009 at 12:43 AM, M Kumar wrote: > > Hi Chris, > > Thanks for quick and kind reply, but the python program runs on the > server, > > sys.platform is linux only. What I want is I need to get a module, which > > shud be exactly same as if I import os module on the client machine > > Um, you're not phrasing your request very clearly, so perhaps I'm not > understanding what you're looking for, but I can tell you that > sys.platform is certainly not Linux-only. If you'll read the docs I > pointed you to, you'll see a table: > System platform value > Windows 'win32' > > > Cheers, > Chris > > -- > Shameless self-promotion: > http://blog.rebertia.com > -- Regards, Maneesh KB Comat Technologies Bangalore Mob: 9740-192309 We work with the underprivileged and in rural India. If you are interested to be a part of it, please mail or call me. I will be happy to share and inform - http://www.comat.com -- http://mail.python.org/mailman/listinfo/python-list
Re: os module
Its just http, I am using pylons. Right now I am doing tht with extra parameter. But even if I get to know about the platform of the client machine, I need to use the other properties of the corresponding machine's os module. for example I need to use "os.path". So even if I know about the platform name how to use that information to get os module with the property of tht particular platform. On Mon, Mar 2, 2009 at 2:31 PM, Chris Rebert wrote: > > On Mon, Mar 2, 2009 at 2:17 PM, Chris Rebert wrote: > >> > >> > On Mon, Mar 2, 2009 at 1:59 PM, Chris Rebert > wrote: > >> >> > >> >> On Mon, Mar 2, 2009 at 12:26 AM, M Kumar > wrote: > >> >> > > >> >> > Hi, > >> >> > > >> >> > I am writing a server side program, clients can be any machine but > >> >> > the > >> >> > server machine is Linux. In program I want to use the OS module > based > >> >> > on > >> >> > the > >> >> > client's operating system. But when I do "import os" m only able to > >> >> > get > >> >> > the > >> >> > module with the property of Linux. ANy idea how to import the > module > >> >> > with > >> >> > the property of clients OS. > >> >> > >> >> You want sys.platform; see > >> >> http://docs.python.org/library/sys.html#sys.platform > >> On Mon, Mar 2, 2009 at 12:43 AM, M Kumar wrote: > >> > Hi Chris, > >> > Thanks for quick and kind reply, but the python program runs on the > >> > server, > >> > sys.platform is linux only. What I want is I need to get a module, > which > >> > shud be exactly same as if I import os module on the client machine > >> > >> Um, you're not phrasing your request very clearly, so perhaps I'm not > >> understanding what you're looking for, but I can tell you that > >> sys.platform is certainly not Linux-only. If you'll read the docs I > >> pointed you to, you'll see a table: > >> System platform value > >> Windows 'win32' > >> > >> > >> Cheers, > >> Chris > > On Mon, Mar 2, 2009 at 12:57 AM, M Kumar wrote: > > Oh that might be the problem, I m new to this and new to this kind of > > conversations. What you said was correct. But what I am looking for is, > if > > one client reqst comes I need to process the data which I got from the > > client, so I need to use the os module. But since my program executes on > the > > server os.sys.platform has the value "linux2". What I want is a module > > having clients platform value for os.sys.platform. Any way to get that?> > -- > > How are you getting the request? HTTP? XML-RPC? SOAP? Something else > altogether? > If you have control of both the client and the server, it'd be easiest > just to have the client include a parameter specifying what platform > it is in its request to the server. > > Cheers, > Chris > > -- > Shameless self-promotion: > http://blog.rebertia.com > -- Regards, Maneesh KB Comat Technologies Bangalore Mob: 9740-192309 We work with the underprivileged and in rural India. If you are interested to be a part of it, please mail or call me. I will be happy to share and inform - http://www.comat.com -- http://mail.python.org/mailman/listinfo/python-list
Help in reading the pdf file
Hi, I need to read pdf files and extract data from it, is there any way to do it through python. thanks & reagards Maneesh KB -- http://mail.python.org/mailman/listinfo/python-list
Help in getting the IP address of client machines
Hi, I am using pylons web framework for my server. I need to get the ip address of the client machine which made a request to the server in my python code. How can I do that, I am new to pylons and the existing server has so many applications. looking forward to get some solutions from the kind friendly users thanks & regards Maneesh KB -- http://mail.python.org/mailman/listinfo/python-list
help required with pylons
Hi, I am having an application server in pylons, which was giving error sometimes and sometimes it gives the result. I will copy paste the error below. I am new to pylons and not getting any clue of this kind of behavior. Please help me what should I do to avoid this kind of errors. Exception happened during processing of request from ('127.0.0.1', 33021) Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/httpserver.py", line 1046, in process_request_in_thread self.finish_request(request, client_address) File "/usr/lib/python2.5/SocketServer.py", line 254, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.5/SocketServer.py", line 522, in __init__ self.handle() File "/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/httpserver.py", line 425, in handle BaseHTTPRequestHandler.handle(self) File "/usr/lib/python2.5/BaseHTTPServer.py", line 316, in handle self.handle_one_request() File "/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/httpserver.py", line 420, in handle_one_request self.wsgi_execute() File "/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/httpserver.py", line 287, in wsgi_execute self.wsgi_start_response) File "/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/cascade.py", line 92, in __call__ return self.apps[-1](environ, start_response) File "/usr/lib/python2.5/site-packages/Paste-1.4.2-py2.5.egg/paste/registry.py", line 340, in __call__ app_iter = self.application(environ, start_response) File "/usr/lib/python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/authkit/authenticate/__init__.py", line 290, in __call__ return self.app(environ, start_response) File "/usr/lib/python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/authkit/authenticate/cookie.py", line 354, in __call__ return self.app(environ, cookie_setting_start_response) File "/usr/lib/python2.5/site-packages/AuthKit-0.4.0-py2.5.egg/authkit/authenticate/multi.py", line 64, in __call__ raise Exception('WSGI start_response was not called before a result' Exception: WSGI start_response was not called before a result was returned thanks in advance Maneesh KB -- http://mail.python.org/mailman/listinfo/python-list
commands module for windows
Dear all, Is there any python module for windows which is equivalent to commands module in linux? -- thanks & regards, Maneesh KB -- http://mail.python.org/mailman/listinfo/python-list
Re: commands module for windows
can I use this module to store output to a python variable? I am looking for something similar to commands.getoutput("") On Wed, Dec 2, 2009 at 11:42 AM, Chris Rebert wrote: > On Tue, Dec 1, 2009 at 10:05 PM, M Kumar wrote: > > Is there any python module for windows which is equivalent to commands > > module in linux? > > `subprocess` should work: http://docs.python.org/library/subprocess.html > > The `commands` docs even say: > "The subprocess module provides more powerful facilities for spawning > new processes and retrieving their results. > Using the subprocess module is preferable to using the commands module." > > Cheers, > Chris > -- > http://blog.rebertia.com > -- thanks & regards, Maneesh KB Sent from Delhi, DL, India -- http://mail.python.org/mailman/listinfo/python-list
Re: commands module for windows
thank you very much Chris :) On Wed, Dec 2, 2009 at 12:10 PM, Chris Rebert wrote: > > On Wed, Dec 2, 2009 at 11:42 AM, Chris Rebert wrote: > >> On Tue, Dec 1, 2009 at 10:05 PM, M Kumar wrote: > >> > Is there any python module for windows which is equivalent to commands > >> > module in linux? > >> > >> `subprocess` should work: > http://docs.python.org/library/subprocess.html > >> > >> The `commands` docs even say: > >> "The subprocess module provides more powerful facilities for spawning > >> new processes and retrieving their results. > >> Using the subprocess module is preferable to using the commands module." > > On Tue, Dec 1, 2009 at 10:34 PM, M Kumar wrote: > > can I use this module to store output to a python variable? > > I am looking for something similar to > > commands.getoutput("") > > Yes, of course it can. If it's more powerful, then it can do > everything the other module can. > It'd be silly for the `commands` docs to point people to `subprocess` > if this wasn't the case. > It will take more than a single line of code though. Read the module's > docs. > > Regards, > Chris > -- > http://blog.rebertia.com > -- thanks & regards, Maneesh KB Sent from Delhi, DL, India -- http://mail.python.org/mailman/listinfo/python-list