Re: Why not just show the out-of-range index?

2006-12-04 Thread Russ
Fredrik Lundh wrote: > Russ wrote: > > >> No one is castigating the OP for bringing up the issue. His suggestion > >> that his > >> time is worth more than that of anyone else, though, is drawing some ire. > > > > I'm afraid that any such "suggestion" is purely in your own > > imagination. > >

Re: Parsing data from pyserial, an (inefficient) solution

2006-12-04 Thread Giovanni Bajo
Dennis Lee Bieber wrote: > >> The really sad thing is that I get a perfectly constructed >> packet from the reading variable, and that gets butchered when I >> try to slice it up to pick out individual elements. Since >> pyserial doesn’t do anything to rearrange the data, then the >> CMUcam must d

Re: Why not just show the out-of-range index?

2006-12-04 Thread Robert Kern
Russ wrote: > And > excuse me for suggesting a minor new feature to enhance the > productivity of Python without implementing it myself! Geez! Like I said, no one is castigating you for making the request. It's been your attitude afterwards that is the problem. You've been pointed to t

Re: algorithm for sorting functional expressions

2006-12-04 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, chrisguest wrote: > So I suspect that this is a common problem for those familiar with > partially ordered sets or directed graphs. I'm wondering if anyone else > is familiar with this problem and knows an efficient algorithm that > will solve it. It would be good if any su

Re: Why not just show the out-of-range index?

2006-12-04 Thread Fredrik Lundh
Russ wrote: > Boy, some of you guys seem to have a very low self esteem yeah, of course. it's always someone else's fault. now, can you please go to the feature request tracker: http://sourceforge.net/tracker/?group_id=5470&atid=355470 and follow the instructions on that page? -- ht

Re: algorithm for sorting functional expressions

2006-12-04 Thread Christian Stapfer
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am trying to write some code that will take a list of functional > expressions, and order them so that those with primitive terms appear > at the beginning of the list and those that are defined by other terms > appear last. > > eg: >

Re: algorithm for sorting functional expressions

2006-12-04 Thread Fredrik Lundh
Marc 'BlackJack' Rintsch wrote: >> So I suspect that this is a common problem for those familiar with >> partially ordered sets or directed graphs. I'm wondering if anyone else >> is familiar with this problem and knows an efficient algorithm that >> will solve it. It would be good if any such alg

Re: RAD for python

2006-12-04 Thread Laurent Pointal
progman a écrit : > is there a VB-alike tool for python to create forms?? Maybe take a look at DaboDev http://dabodev.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Video stream server

2006-12-04 Thread Lad
Fredrik, Thank you for your reply > > but I think you're missing the point; you need to provide more > information about your specific requirements than just "a HTML > page that links to a video file". like, say, in what way this > is related to Python, what software you're using today, what >

Re: Why not just show the out-of-range index?

2006-12-04 Thread Russ
Robert Kern wrote: > Nothing is going to happen until you do one of these two things. Being more > rude > (and yes, you are being incredibly rude and insulting) won't move things > along. I re-read the thread, and I don't see anywhere where I was rude except in reply to rudeness by others. Sorr

Re: Why not just show the out-of-range index?

2006-12-04 Thread Robert Kern
Russ wrote: > Robert Kern wrote: > >> Nothing is going to happen until you do one of these two things. Being more >> rude >> (and yes, you are being incredibly rude and insulting) won't move things >> along. > > I re-read the thread, and I don't see anywhere where I was rude except > in reply t

Re: Multiple FTP download using Muliti thread

2006-12-04 Thread Justin Ezequiel
import ftplib, posixpath, threading from TaskQueue import TaskQueue def worker(tq): while True: host, e = tq.get() c = ftplib.FTP(host) c.connect() try: c.login() p = posixpath.basename(e) fp = open(p, 'wb') try:

Re: Multiple FTP download using Muliti thread

2006-12-04 Thread Fredrik Lundh
Justin Ezequiel wrote: > from TaskQueue import TaskQueue what Python version is this ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple FTP download using Muliti thread

2006-12-04 Thread Justin Ezequiel
Fredrik Lundh wrote: > Justin Ezequiel wrote: > > > from TaskQueue import TaskQueue > > what Python version is this ? > > oops. forgot to note... http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475160 -- http://mail.python.org/mailman/listinfo/python-list

Inheritance doesn't work

2006-12-04 Thread zefciu
I have a problem with inheritance under python. The class definition is longer, but the troublesome thing is: from PIL import Image class MandelbrotImage (Image): pass I am getting the following error: Traceback (most recent call last): File "", line 1, in ? File "mandelimage.py

Re: Inheritance doesn't work

2006-12-04 Thread Robert Kern
zefciu wrote: > I have a problem with inheritance under python. The class definition is > longer, but the troublesome thing is: > > from PIL import Image > class MandelbrotImage (Image): > pass > > I am getting the following error: > Traceback (most recent call last): >File "", line

Re: Inheritance doesn't work

2006-12-04 Thread Fredrik Lundh
zefciu wrote: > I have a problem with inheritance under python. The class definition is > longer, but the troublesome thing is: > > from PIL import Image that's a module, not a class. > class MandelbrotImage (Image): > pass PIL's Image class isn't designed to be inherited from. to cr

Re: Multiple FTP download using Muliti thread

2006-12-04 Thread Peter Otten
Justin Ezequiel wrote: > Fredrik Lundh wrote: >> Justin Ezequiel wrote: >> >> > from TaskQueue import TaskQueue >> >> what Python version is this ? >> >> > > oops. forgot to note... > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475160 Also noteworthy: "This recipe was accepted fo

Python Jobs

2006-12-04 Thread Matt H
I'm writing from an IT Recruitment consultancy, I have an opportunity for either an experienced Python developer or someone looking to cross train in to Python in a permanent role. The role is based in the Amersham, Buckinghamshire for a small but well established software house. You will be requi

Re: RAD for python

2006-12-04 Thread hg
progman wrote: > > is there a VB-alike tool for python to create forms?? http://wxglade.sourceforge.net/ http://boa-constructor.sourceforge.net/ http://www.activestate.com/Products/Komodo/ http://www.roebling.de/ hg -- http://mail.python.org/mailman/listinfo/python-list

Re: os.mkdir and mode

2006-12-04 Thread Nick Craig-Wood
Peter Otten <[EMAIL PROTECTED]> wrote: > >> "Where it is used, the current umask value is first masked out." > >> > >> Use os.chmod() after os.mkdir() to get the desired permissions. > > > > I think you meant use os.umask(0) before the os.mkdir() ? > > No, I didn't. What is the difference/adv

Re: os.mkdir and mode

2006-12-04 Thread Nick Craig-Wood
Martin v. Löwis <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood schrieb: > > So it looks like python mkdir() is applying the umask where as > > /bin/mkdir doesn't. From man 2 mkdir > > Actually, mkdir(1) has no chance to not apply the umask: it also > has to use mkdir(2), which is implemented in

get script path

2006-12-04 Thread hg
Hi, must I parse argv[0] to get it, or is there an easier way (that works under Windows and *nix)? Ex: python /home/hg/test/test.py ==> test.py #knows it is in /home/hg/test Thanks, hg -- http://mail.python.org/mailman/listinfo/python-list

Re: global name 'self' is not defined

2006-12-04 Thread Evan
The problem seems to be with ipython, which I have been using to run these scripts. My calling script (call.py) is: import canaryPlaces_test as canp sum=canp.addme(3,5) print sum estoc=canp.estocStn() print estoc The problem script is this one, named canaryPlaces_test.py: def estocStn():

Re: Printing Barcodes from webapp?

2006-12-04 Thread John J. Lee
"Andy Dingley" <[EMAIL PROTECTED]> writes: > Burhan wrote: > > > Is there an easy way to generate barcodes using Python > > Easy way for any application or language to generate barcodes is to > install a barcode font on the client machine, then just generate a > suitable text string for it. Th

Re: get script path

2006-12-04 Thread hg
hg wrote: > Hi, > > must I parse argv[0] to get it, or is there an easier way (that works > under Windows and *nix)? > > Ex: > > python /home/hg/test/test.py ==> test.py #knows it is in /home/hg/test > > Thanks, > > hg got it: os.path.dirname(sys.argv [0]) -- http://mail.python.org/mailman

Re: get script path

2006-12-04 Thread Rob Wolfe
hg wrote: > Hi, > > must I parse argv[0] to get it, or is there an easier way (that works under > Windows and *nix)? > > Ex: > > python /home/hg/test/test.py ==> test.py #knows it is in /home/hg/test IMHO it is easy enough: >>> dname, fname = os.path.split("/home/hg/test/test.py") >>> dname '/ho

Re: Beautiful Soup Question: Filtering Images based on their width and height attributes

2006-12-04 Thread David Coffin
> Hello, > > I want to extract some image links from different html pages, in > particular i want extract those image tags which height values are > greater than 200. Is there an elegant way in BeautifulSoup to do this? Yes. soup.findAll(lambda tag: tag.name=="img" and tag.has_key("height") an

Re: get script path

2006-12-04 Thread hg
Rob Wolfe wrote: > > hg wrote: >> Hi, >> >> must I parse argv[0] to get it, or is there an easier way (that works >> under Windows and *nix)? >> >> Ex: >> >> python /home/hg/test/test.py ==> test.py #knows it is in /home/hg/test > > IMHO it is easy enough: > dname, fname = os.path.split("/

Execution time of lines within a function

2006-12-04 Thread monkeyboy
Hello, I have a function that hotshot says is very slow. I can get the aggregate execution time, but is there a way to get the execution time of each line so I can find the bottleneck? Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheritance doesn't work

2006-12-04 Thread Michael S
How about calling base class __init__ and then the pass statement? --- zefciu <[EMAIL PROTECTED]> wrote: > I have a problem with inheritance under python. The > class definition is > longer, but the troublesome thing is: > > from PIL import Image > class MandelbrotImage (Image): > pass

Re: please provide urls for some python success stories.

2006-12-04 Thread Bernard
http://pythonology.org/success this should be enough...but why don't you write a solid app in python and show it to them? Seeing is believing. Bernard krishnakant Mane a écrit : > hello all. > actually I have been recently appointed as a technology consulltent at > a huge company. > and I have

Re: Execution time of lines within a function

2006-12-04 Thread Neil Cerutti
On 2006-12-04, monkeyboy <[EMAIL PROTECTED]> wrote: > I have a function that hotshot says is very slow. I can get the > aggregate execution time, but is there a way to get the > execution time of each line so I can find the bottleneck? Try 'print_callees' on the stats object for your bottleneck. T

Re: About alternatives to Matlab

2006-12-04 Thread Filip Wasilewski
Jon Harrop wrote: [...] > I first wrote an OCaml translation of the Python and wrote my own > little "slice" implementation. I have since looked up a C++ solution and > translated that into OCaml instead: > > let rec d4_aux a n = > let n2 = n lsr 1 in > let tmp = Array.make n 0. in > for i=0

Re: Why not just show the out-of-range index?

2006-12-04 Thread Carsten Haese
On Mon, 2006-12-04 at 01:04 -0800, Russ wrote: > Robert Kern wrote: > > > Nothing is going to happen until you do one of these two things. Being more > > rude > > (and yes, you are being incredibly rude and insulting) won't move things > > along. > > I re-read the thread, and I don't see anywhe

Re: Pimping the 'cgi' module

2006-12-04 Thread Harry George
robert <[EMAIL PROTECTED]> writes: > Harry George wrote: > > When I came from Perl, I too missed perl-isms and specifically CGI.pm, so > > wrote my own: > > http://www.seanet.com/~hgg9140/comp/index.html > > http://www.seanet.com/~hgg9140/comp/pyperlish/doc/manual.html > > http://www.seanet.com/~

Annoucement- pyljvim-0.0.3 Released.

2006-12-04 Thread Phoe6
pyljvim is a a Livejournal Plugin for Vim. One can post to the Livejournal directly from vim! :) It is available at: http://www.vim.org/scripts/script.php?script_id=1724 Installation is pretty easy and so is the usage. Thanks, Senthil http://phoe6.livejournal.com Contemptuous lights flashed acr

Re: WxPython

2006-12-04 Thread Chris Mellon
On 3 Dec 2006 04:14:08 -0800, Raja <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to develop an application which would mainly do the > following 2 things . I would like to know how it can be achieved and > also the libraries needed for it . > > i) active window tracking > In this s

Re: About alternatives to Matlab

2006-12-04 Thread sturlamolden
Filip Wasilewski wrote: > So why not use C++ instead of all others if the speed really matters? > What is your point here? If speed matters, one should consider using hand-coded assembly. Nothing really beats that. But it's painful and not portable. So lets forget about that for a moment. Contr

Re: Parsing data from pyserial

2006-12-04 Thread Grant Edwards
On 2006-12-04, John Machin <[EMAIL PROTECTED]> wrote: > Try reading previous posts. The OP reported that to be returned from > the cam, based on print forty_bytes, not print repr(forty_bytes). I > think everybody (including possibly even the OP) is willing to believe > that the cam is *generating*

Re: Parsing data from pyserial, an (inefficient) solution

2006-12-04 Thread Grant Edwards
On 2006-12-04, Giovanni Bajo <[EMAIL PROTECTED]> wrote: [...] >> This should result in complete packets (from the "M" to a "\r") > > Oh well. readline(eol="\r") will do that much better. Yup. Using readline() has been suggested several times. It sure seems like the obvious solution to me as w

Printing unix Line endings from Windows.

2006-12-04 Thread Ant
Hi all, I've got a problem here which has me stumped. I've got a python script which does some text processing on some files and writes it back out to the same file using the fileinput module with inplace set to True. The script needs to run from Windows, but the files need to be written with Uni

Re: rdf, xmp

2006-12-04 Thread Andy Dingley
Imbaud Pierre wrote: > I have to add access to some XMP data to an existing python > application. > XMP is built on RDF, I'm just looking at the XMP Spec from the Adobe SDK. First impressions only, as I don't have time to read the whole thing in detail. This spec doesn't inspire me with confide

Re: Why not just show the out-of-range index?

2006-12-04 Thread Paul McGuire
I think your biggest initial recoil to the response you got was in the request that you submit a patch. You thought, "Geez, I just want one friggin' error message changed, and they want me to learn the whole Python development environment." Given your newbiness with Python, probably a better

Re: Execution time of lines within a function

2006-12-04 Thread monkeyboy
Thanks Neil, I looked at that, but maybe I don't understand the output. I was hoping to see the cummulative time for the function and then the time associated with each statement (line) within the function. In the hotshot output below, I can see the function being called 100 times, which is corre

Factory pattern implementation in Python

2006-12-04 Thread googlegroups
Hi, I need to parse a binary file produced by an embedded system, whose content consists in a set of events laid-out like this: ... Every "event" is a single byte in size, and it indicates how long is the associated "data". Thus, to parse all events in the file, I need to take it like a st

Re: Why not just show the out-of-range index?

2006-12-04 Thread rurpy
Carsten Haese wrote: > On Mon, 2006-12-04 at 01:04 -0800, Russ wrote: > > Robert Kern wrote: > > > > > Nothing is going to happen until you do one of these two things. Being > > > more rude > > > (and yes, you are being incredibly rude and insulting) won't move things > > > along. > > > > I re-r

Re: Inheritance doesn't work

2006-12-04 Thread John Salerno
zefciu wrote: > class MandelbrotImage (Image): > pass > I am getting the following error: > File "mandelimage.py", line 3, in ? > class MandelImage (Image): How do you get that error with that code? -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheritance doesn't work

2006-12-04 Thread Fredrik Lundh
John Salerno wrote: > How do you get that error with that code? $ python >>> import os >>> class foo(os): ... pass ... Traceback (most recent call last): File "", line 1, in TypeError: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given)

Re: Using win32gui.SendMessage and SysListView32 control

2006-12-04 Thread geskerrett
Thanks for your help. I will check them out. -- http://mail.python.org/mailman/listinfo/python-list

python Noob - basic setup question / problem

2006-12-04 Thread Lilavivat
Running SUSE 10.1 on an AMD64. When I try and run a python program I get the following error: /usr/bin/python2: bad interpreter: No such file or directory "which python" gives me "/usr/local/bin/python" "which python2.4" gives me "/usr/local/bin/python2.4" But /

Ensure a variable is divisible by 4

2006-12-04 Thread geskerrett
I am sure this is a basic math issue, but is there a better way to ensure an int variable is divisible by 4 than by doing the following; x = 111 x = (x /4) * 4 Just seems a bit clunky to me. -- http://mail.python.org/mailman/listinfo/python-list

Re: Factory pattern implementation in Python

2006-12-04 Thread George Sakkis
[EMAIL PROTECTED] wrote: > Hi, > > I need to parse a binary file produced by an embedded system, whose > content consists in a set of events laid-out like this: > > ... > > Every "event" is a single byte in size, and it indicates how long is > the associated "data". Thus, to parse all events

Re: Why not just show the out-of-range index?

2006-12-04 Thread Carsten Haese
On Mon, 2006-12-04 at 08:49 -0800, [EMAIL PROTECTED] wrote: > Carsten Haese wrote: > > On Mon, 2006-12-04 at 01:04 -0800, Russ wrote: > > > Robert Kern wrote: > > > > > > > Nothing is going to happen until you do one of these two things. Being > > > > more rude > > > > (and yes, you are being incr

Re: Ensure a variable is divisible by 4

2006-12-04 Thread Kay Schluehr
[EMAIL PROTECTED] schrieb: > I am sure this is a basic math issue, but is there a better way to > ensure an int variable is divisible by 4 than by doing the following; > > x = 111 > x = (x /4) * 4 > > Just seems a bit clunky to me. Division with rest: >>> x % 4 3 -- http://mail.python.org/m

Re: Ensure a variable is divisible by 4

2006-12-04 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I am sure this is a basic math issue, but is there a better way to > ensure an int variable is divisible by 4 than by doing the following; > > x = 111 > x = (x /4) * 4 > > Just seems a bit clunky to me. > Use modulo operator '%' if not x % 4: # # Arrive here if

Re: Ensure a variable is divisible by 4

2006-12-04 Thread George Sakkis
[EMAIL PROTECTED] wrote: > I am sure this is a basic math issue, but is there a better way to > ensure an int variable is divisible by 4 than by doing the following; > > x = 111 > x = (x /4) * 4 > > Just seems a bit clunky to me. if x % 4 == 0: # x is divisible by 4 George -- http://mail.pyt

Re: python Noob - basic setup question / problem

2006-12-04 Thread Christophe
Lilavivat a écrit : > Running SUSE 10.1 on an AMD64. When I try and run a python program I get > the following error: > > /usr/bin/python2: bad interpreter: No such file or directory > > "which python" gives me "/usr/local/bin/python" > > "which python2.4" gives me "/usr/local

Best way for inter-process communication in Python

2006-12-04 Thread Hugo Ferreira
Hi everyone! Here's the current scenario: I have a program in Python that computes something very fast (<1s), but it takes a considerable amount of time to read the startup data (>90s). Since the startup data is pretty static, I want this program to be resident and ready in memory all the time. T

Re: Printing unix Line endings from Windows.

2006-12-04 Thread Larry Bates
Ant wrote: > Hi all, > > I've got a problem here which has me stumped. I've got a python script > which does some text processing on some files and writes it back out to > the same file using the fileinput module with inplace set to True. > > The script needs to run from Windows, but the files ne

Re: How do I print a numpy array?

2006-12-04 Thread David E. Konerding DSD staff
On 2006-12-02, Robert Kern <[EMAIL PROTECTED]> wrote: > Beliavsky wrote: >> When I print an array in any language, I (and I think most programmers) >> expect by default to have all elements displayed. Matlab, R, and >> Fortran 95 have somewhat similar arrays to numpy, and that is what they >> do. I

Re: About alternatives to Matlab

2006-12-04 Thread Carl Banks
Jon Harrop wrote: [snip] > >> That's my point, using numpy encouraged the programmer to optimise in the > >> wrong direction in this case (to use slices instead of element-wise > >> operations). > > > > Ok, I can see that. We have a sort of JIT compiler, psyco, that works > > pretty well but I don

Re: Ensure a variable is divisible by 4

2006-12-04 Thread Tim Chase
> I am sure this is a basic math issue, but is there a better way to > ensure an int variable is divisible by 4 than by doing the following; > > x = 111 > x = (x /4) * 4 > > Just seems a bit clunky to me. You're right...you'll want to read up on the "modulo" operator: if x % 4 <> 0: pri

Re: Factory pattern implementation in Python

2006-12-04 Thread Chris Mellon
On 4 Dec 2006 08:39:17 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I need to parse a binary file produced by an embedded system, whose > content consists in a set of events laid-out like this: > > ... > > Every "event" is a single byte in size, and it indicates how long is >

Re: Ensure a variable is divisible by 4

2006-12-04 Thread Will McGugan
[EMAIL PROTECTED] wrote: > I am sure this is a basic math issue, but is there a better way to > ensure an int variable is divisible by 4 than by doing the following; > > x = 111 > x = (x /4) * 4 > > Just seems a bit clunky to me. > Depends what you mean by 'make it divisable'. Do you want to ch

Re: Factory pattern implementation in Python

2006-12-04 Thread Romulo A. Ceccon
George Sakkis wrote: > If you actually intend to > 1) name your Event subclasses Evt1, Evt2, ... EvtN and not give more > descriptive (but unrelated to the magic event number) names No, those names are just an example. The actual classes have descriptive names. > By the way, it is not clear from

Re: Why not just show the out-of-range index?

2006-12-04 Thread Martin v. Löwis
Russ schrieb: > I love Python, but every time I get an out-of-range error message, I > wonder why it didn't just tell me what the out-of-range index was and > what the allowable range was. Certainly that information must be > available to the exception handler, or how would it know that it is out >

Re: Inheritance doesn't work

2006-12-04 Thread J. Clifford Dyer
Fredrik Lundh wrote: > John Salerno wrote: > >> How do you get that error with that code? > > $ python > import os class foo(os): > pass > > Traceback (most recent call last): > File "", line 1, in > TypeError: Error when calling the metaclass bases > module.__init

Re: Why not just show the out-of-range index?

2006-12-04 Thread Russ
Carsten Haese wrote: > You may not have meant this to be rude, but it does come off as rude and > arrogant, and I'll explain to you why: In your first post you stated > that the feature seems like a no-brainer to you. That implies to the > reader that you might have the necessary skill to impleme

Re: Why not just show the out-of-range index?

2006-12-04 Thread Martin v. Löwis
Russ schrieb: > My suggestion that it would be much easier for the Python maintainers > than for me to implement the requested feature is just basic common > sense. I would have to spend many hours or days just to familiarize > myself with the code, but they are obviously already very familiar with

Re: Best way for inter-process communication in Python

2006-12-04 Thread Hugo Ferreira
There is another option that I thought while writing this... I can use the database for data communication. Like having a table with both in and out parameters. On the client-side, I fill the in parameters columns. Then I signal the external application which reads the parameters, and write the out

Re: Why not just show the out-of-range index?

2006-12-04 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Thanks for explaining why the OP was rude. Having been > reading and listening to english for only a few decades > probably, I am sure the OP (and me too!) appreciates your > explanation of rudeness You mean, you don't feel insulted if somebody calls you silly? Regar

Re: Thread error

2006-12-04 Thread Salvatore Di Fazio
Tnx Dennis, this is my first python program, so I don't know every modules :( Anyway thank you so much for the suggestions, corrections and for the whole program :) Thank you -- http://mail.python.org/mailman/listinfo/python-list

SQLObject release 0.7.2

2006-12-04 Thread Oleg Broytmann
Hello! I'm pleased to announce the 0.7.2 release of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started wit

Re: Execution time of lines within a function

2006-12-04 Thread Neil Cerutti
On 2006-12-04, monkeyboy <[EMAIL PROTECTED]> wrote: > Thanks Neil, > > I looked at that, but maybe I don't understand the output. I > was hoping to see the cummulative time for the function and > then the time associated with each statement (line) within the > function. > > Any suggestions? I don'

decorators question

2006-12-04 Thread king kikapu
Hi, i am new to python and i have a question about how decorators are working. I have understand HOW they do their magic but i am trying to figure out WHEN they do it... I have the following simple example: #- def author(author_name): def decorator(fu

ISAPI filter

2006-12-04 Thread Chris Curvey
Hi all, I'm trying to write an ISAPI filter in Python, using the examples that come in the "isapi" directory of the win32com package. The installation program itself runs fine, but when I examine the properties of my web server, my filter has a big red down arrow next to it. But I can't seem to

Re: Execution time of lines within a function

2006-12-04 Thread monkeyboy
The output was from print_callees(). It appears as though print_stats() and print_callees() return the same data, just in a different orangization. There is supposed to be a "lineevents=1" option in hotshot.Profile, for line timings, but it doesn't seem to work in Python 2.4. Thanks for your help

Re: About alternatives to Matlab

2006-12-04 Thread sturlamolden
Carl Banks wrote: > > Ok. Perhaps starting a Python JIT in something like MetaOCaml or Lisp/Scheme > > would be a good student project? > > ...and finishing would be a good project for a well-funded team of > experienced engineers. I think this is a good idea. We could use the AST from the CPyth

Re: decorators question

2006-12-04 Thread Fredrik Lundh
king kikapu wrote: > It will load all the module, all the functions and when it sees that > some function(s) are decorating, then it will start execute respectives > decorators ? @decorator def func(): pass is *exactly* the same thing as: def func(): pass f

Re: Factory pattern implementation in Python

2006-12-04 Thread George Sakkis
Romulo A. Ceccon wrote: > George Sakkis wrote: > > > If you actually intend to > > 1) name your Event subclasses Evt1, Evt2, ... EvtN and not give more > > descriptive (but unrelated to the magic event number) names > > No, those names are just an example. The actual classes have > descriptive name

Python bindings for RCS apps

2006-12-04 Thread [EMAIL PROTECTED]
There is pySVN for subversion but does other revision control system systems have some good python bindings/apis ? with good docs and some examples. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ensure a variable is divisible by 4

2006-12-04 Thread Nick Craig-Wood
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am sure this is a basic math issue, but is there a better way to > ensure an int variable is divisible by 4 than by doing the following; > > x = 111 > x = (x /4) * 4 You should use // for future compatibility which is guaranteed to be an intege

Re: Why not just show the out-of-range index?

2006-12-04 Thread OKB (not okblacke)
Russ wrote: > Every Python programmer gets this message occasionally: > > IndexError: list index out of range > > The message tells you where the error occurred, but it doesn't tell > you what the range and the offending index are. Why does it force > you to determine that information for yourse

Re: Why not just show the out-of-range index?

2006-12-04 Thread rurpy
Martin v. Löwis wrote: > [EMAIL PROTECTED] schrieb: > > Thanks for explaining why the OP was rude. Having been > > reading and listening to english for only a few decades > > probably, I am sure the OP (and me too!) appreciates your > > explanation of rudeness > > You mean, you don't feel insulte

Re: Ensure a variable is divisible by 4

2006-12-04 Thread Grant Edwards
On 2006-12-04, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am sure this is a basic math issue, but is there a better > way to ensure an int variable is divisible by 4 if x & 3: print "not divisible by 4" x &= ~3 print "it is now: x = %d" If you want to round to nearest power of 4 rather

Re: SQLObject release 0.7.2

2006-12-04 Thread Robert Hicks
Oracle? Robert -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators question

2006-12-04 Thread king kikapu
> def func(): > pass > > is *exactly* the same thing as: > > def func(): > pass > func = decorator(func) Yes, i know that but i thought that it is so when I call the function, not when the runtime just loads the module... >Python calls the decorator, not the dec

Re: decorators question

2006-12-04 Thread Soni Bergraj
> Hmmm...ok...it calls the decorator but when ?? It (the runtime) loads > the .py file and start to call every decorator > it finds on it, regardless of the existance of code that actually calls > the decorated functions ?? > I understand thet Python does not call the decoratated functiond but it >

Re: decorators question

2006-12-04 Thread Fredrik Lundh
king kikapu wrote: > Hmmm...ok...it calls the decorator but when ?? It (the runtime) loads > the .py file and start to call every decorator you seem to be missing that the interpreter *always* executes the code in a module to find out what it contains. "def" and "class" are exe- cutable statem

Re: decorators question

2006-12-04 Thread Soni Bergraj
> Shouldn't this code called when we actually DO call it ? Python statements are always executed to create the corresponding class and function objects when a module is imported. Cheers, -- Soni Bergraj http://www.YouJoy.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators question

2006-12-04 Thread Soni Bergraj
There was a copy-and-paste error with my last message. Better try this for foobar.py: def foo(f): print "called foo" return 'some text' @foo def bar(): print "called bar" -- Soni Bergraj http://www.YouJoy.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not just show the out-of-range index?

2006-12-04 Thread BJörn Lindqvist
On 12/4/06, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Russ schrieb: > > I love Python, but every time I get an out-of-range error message, I > > wonder why it didn't just tell me what the out-of-range index was and > > what the allowable range was. Certainly that information must be > > availa

Re: Python bindings for RCS apps

2006-12-04 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > There is pySVN for subversion but does other revision control system > systems have some good python bindings/apis ? with good docs and some > examples. Here are some starting points for some different systems: Bazaar -- Something about the structure of bzrlib: htt

Re: Why not just show the out-of-range index?

2006-12-04 Thread BJörn Lindqvist
On 12/4/06, OKB (not okblacke) <[EMAIL PROTECTED]> wrote: > I think the same could be said of virtually all exceptions. What I > think would be ideal is that whenever an exception is raised, the > traceback tells you: > > 1) What the exception is > 2) The names of the varia

Re: Python spam?

2006-12-04 Thread John Draper
Hendrik van Rooyen wrote: >"Aahz" <[EMAIL PROTECTED]> wrote: > > > >>Anyone else getting "Python-related" spam? So far, I've seen messages >>"from" Barry Warsaw and Skip Montanaro (although of course header >>analysis proves they didn't send it). >>-- >> >> > >not like that - just the norma

Re: Why not just show the out-of-range index?

2006-12-04 Thread Fredrik Lundh
BJörn Lindqvist wrote: > Sorry I haven't thought this through 100% obviously not. -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (Dec 4)

2006-12-04 Thread Paul Boddie
QOTW: "We of all people should understand Worse Is Better. And I forgot to mention a little flash in the pan called Python, for which Tkinter (2+2 left as an exercise) is the GUI of choice." - Ken Tilton (on comp.lang.lisp, perhaps stretching the meaning of "of choice" somewhat) http://groups.

Re: Inheritance doesn't work

2006-12-04 Thread John Salerno
J. Clifford Dyer wrote: > Sure, but I think the question was more about how code that references > "MandelbrotImage could yield a stack that references MandelImage. Yeah, I guess I could have been more specific. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Factory pattern implementation in Python

2006-12-04 Thread bearophileHUGS
Dennis Lee Bieber: > Presuming the is a type code I'd just set up a list of functions: > Then create a dictionary of them, keyed by the code > processors = { "1" : process_1, > "2" : process_2, > > "x" : process_x } Jus

  1   2   >