Re: cache line length of a machine

2007-01-04 Thread Tim Roberts
"John" <[EMAIL PROTECTED]> wrote: > >How do I find out the cache line length of a machine in python? How would that piece of information be valuable in Python? There isn't anything you can do to take advantage of it in Python. You can look up the L2 and L3 cache size and speed using WMI (assumin

Re: Undefined symbol __pure_virtual when importing MySQLdb

2007-01-04 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > I have googled hard, and did see someone asking the same question, but > > haven't found a good solution to this problem. Could anyone give me a > > hint? Thanks a lot! > > googling for "undefined symbol: __pure_virtual" brings up hundreds of

Re: How do I add users using Python scripts on a Linux machine

2007-01-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Piet van Oostrum wrote: > The scenario is as follows: Suppose the script starts with the line: > #!/usr/bin/python > > (using #!/usr/bin/env python would be disastrous because the user could > supply his own `python interpreter' in his PATH.) > > Now a malicious u

Re: Undefined symbol __pure_virtual when importing MySQLdb

2007-01-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I have googled hard, and did see someone asking the same question, but > haven't found a good solution to this problem. Could anyone give me a > hint? Thanks a lot! googling for "undefined symbol: __pure_virtual" brings up hundreds of posts on this topic, and the ans

Re: Anyone persuaded by "merits of Lisp vs Python"?

2007-01-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Paul Hummer wrote: > I learned PHP for ease of web application development ... PHP is great for easily developing _insecure_ web applications. But if you want them not to leak like a sieve, things get a bit more complicated. -- http://mail.python.org/mailman/listi

Re: Anyone persuaded by "merits of Lisp vs Python"?

2007-01-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > [3] I thought it was particularly cool how Tcl could bolt on a class > based object oriented system as a library. The word "class" isn't > built into the language, but that kind of evaluator lets you add it. I have written about two notr

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Paddy
belinda thom wrote: > On Jan 4, 2007, at 9:28 PM, Carl Banks wrote: > > > jeremito wrote: > >> I am writing a class that is intended to be subclassed. What is the > >> proper way to indicate that a sub class must override a method? > > > > You can't (easily). > > > > If your subclass doesn't ove

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Robert Kern
belinda thom wrote: > I imagine the NotImplementedError is actually a defined object, but I > really don't know. It is. > So, back to my question: is a catalog of standard python errors > available? I've looked on the python site but had no success. http://docs.python.org/lib/module-excepti

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Dan Bishop
On Jan 4, 11:57 pm, belinda thom <[EMAIL PROTECTED]> wrote: ... > So, back to my question: is a catalog of standard python errors > available? I've looked on the python site but had no success. >>> [name for name in dir(__builtins__) if name.endswith('Error')] ['ArithmeticError', 'AssertionError',

Undefined symbol __pure_virtual when importing MySQLdb

2007-01-04 Thread [EMAIL PROTECTED]
I downloaded MySQL-python-1.2.1 from SourceForge and installed it on a Mandrake system (Mandrake Linux 9.2 3.3.1-2mdk on linux2). The installation was successful. The gcc version is 3.3. My Python version is 2.4.2. When I import MySQLdb, I get an error which says that __pure_virtual is an undef

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread belinda thom
On Jan 4, 2007, at 9:28 PM, Carl Banks wrote: > jeremito wrote: >> I am writing a class that is intended to be subclassed. What is the >> proper way to indicate that a sub class must override a method? > > You can't (easily). > > If your subclass doesn't override a method, then you'll get a big

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread belinda thom
On Jan 4, 2007, at 7:56 PM, Thomas Ploch wrote: > Gabriel Genellina schrieb: >> At Thursday 4/1/2007 23:52, jeremito wrote: >> >>> I am writing a class that is intended to be subclassed. What is the >>> proper way to indicate that a sub class must override a method? >> >> If any subclass *must*

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Grant Edwards
On 2007-01-05, Thomas Ploch <[EMAIL PROTECTED]> wrote: >>> I learn so much from this list. I didn't even know this error >>> existed. >> >> And remember: even if it didn't, you could have created your >> own: > > Erm, it wasn't me who asked. I just wanted to say that I didn't know > that there is

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Carl Banks
jeremito wrote: > I am writing a class that is intended to be subclassed. What is the > proper way to indicate that a sub class must override a method? You can't (easily). If your subclass doesn't override a method, then you'll get a big fat AttributeError when someone tries to call it. But thi

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Thomas Ploch
Grant Edwards schrieb: > On 2007-01-05, Thomas Ploch <[EMAIL PROTECTED]> wrote: > I am writing a class that is intended to be subclassed. What is the proper way to indicate that a sub class must override a method? >>> If any subclass *must* override a method, raise >>> NotImplement

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Grant Edwards
On 2007-01-05, Thomas Ploch <[EMAIL PROTECTED]> wrote: >>> I am writing a class that is intended to be subclassed. What >>> is the proper way to indicate that a sub class must override a >>> method? >> >> If any subclass *must* override a method, raise >> NotImplementedError in the base class (a

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread jeremito
Gabriel Genellina wrote: > At Thursday 4/1/2007 23:52, jeremito wrote: > > >I am writing a class that is intended to be subclassed. What is the > >proper way to indicate that a sub class must override a method? > > If any subclass *must* override a method, raise NotImplementedError > in the base

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Thomas Ploch
Gabriel Genellina schrieb: > At Thursday 4/1/2007 23:52, jeremito wrote: > >> I am writing a class that is intended to be subclassed. What is the >> proper way to indicate that a sub class must override a method? > > If any subclass *must* override a method, raise NotImplementedError in > the ba

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Gabriel Genellina
At Thursday 4/1/2007 23:52, jeremito wrote: I am writing a class that is intended to be subclassed. What is the proper way to indicate that a sub class must override a method? If any subclass *must* override a method, raise NotImplementedError in the base class (apart from documenting how yo

Re: clarification on open file modes

2007-01-04 Thread Gabriel Genellina
At Thursday 4/1/2007 23:46, tubby wrote: I understand that doing the following on Windows to a binary file (a jpeg or exe files for example) can cause file corruption, is that correct? fp = open(file_name, 'r') fp.close() How can a simple open in read mode corrupt data??? You can't corrupt *

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Robert Kern
jeremito wrote: > I am writing a class that is intended to be subclassed. What is the > proper way to indicate that a sub class must override a method? raise NotImplementedError -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible b

Weekly Python Patch/Bug Summary

2007-01-04 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 418 open ( +5) / 3522 closed ( +1) / 3940 total ( +6) Bugs: 959 open (+13) / 6405 closed ( +5) / 7364 total (+18) RFE : 250 open ( +2) / 245 closed ( -1) / 495 total ( +1) New / Reopened Patches __ update to

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread Thomas Ploch
jeremito schrieb: > I am writing a class that is intended to be subclassed. What is the > proper way to indicate that a sub class must override a method? > > Thanks, > Jeremy > What do you mean by 'indicate'? Writing it to the docstring of the class/method? Writing a comment? class Foo:

Re: subclassing a module: misleading(?) error message

2007-01-04 Thread Gabriel Genellina
At Thursday 4/1/2007 17:49, Erik Johnson wrote: Python 2.3.4 (#1, Feb 7 2005, 15:50:45) Traceback (most recent call last): File "", line 1, in ? File "Sub.py", line 4, in ? class Sub(Super): TypeError: function takes at most 2 arguments (3 given) Why does python complain about a functi

Re: pow() works but sqrt() not!?

2007-01-04 Thread Grant Edwards
On 2007-01-05, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Thursday 4/1/2007 10:12, siggi wrote: > >>Thanks for the explanation. I am astonished what an interpreted >>language is able to do! > > Python is as interpreted as Java. But it's far more interactive -- at least when compared with my

Re: bug in copy.deepcopy or in getattr or in my understanding?

2007-01-04 Thread Gabriel Genellina
At Thursday 4/1/2007 17:26, Emin wrote: I got some unexpected behavior in getattr and copy.deepcopy (see transcript below). I'm not sure if this is actually a bug in copy.deepcopy or if I'm doing something too magical with getattr. Comments would be appreciated. Both examples are different. #1

What is proper way to require a method to be overridden?

2007-01-04 Thread jeremito
I am writing a class that is intended to be subclassed. What is the proper way to indicate that a sub class must override a method? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

clarification on open file modes

2007-01-04 Thread tubby
Does a py script written to open and read binary files on Windows affect files on a Linux or Mac machine in a negative way? My concern is portability and safety. I want scripts written within Windows to work equally well on Linux and Mac computers. Is this the safest, most portable way to open

Re: Draw rectangle on a Window DC

2007-01-04 Thread Gabriel Genellina
At Thursday 4/1/2007 07:07, Raymond wrote: I want to Draw rectangle on Dc when gived a position. Can you teach me? Let me view your code? This is more a Windows question. See http://msdn.microsoft.com/library/en-us/gdi/rectangl_4b03.asp py>from win32gui import GetDC py>hdc=GetDC(0) py>from

Re: pow() works but sqrt() not!?

2007-01-04 Thread Gabriel Genellina
At Thursday 4/1/2007 10:12, siggi wrote: Thanks for the explanation. I am astonished what an interpreted language is able to do! Python is as interpreted as Java. Its numerical capabilities are more or less independent of this fact, I'd say. -- Gabriel Genellina Softlab SRL

Re: pow() works but sqrt() not!?

2007-01-04 Thread Dan Bishop
On Jan 4, 10:00 am, "siggi" <[EMAIL PROTECTED]> wrote: > Thanks for that, too! > > Would be interesting to learn how these different algorithms [for pow] > influence the > precision of the result!? For an integer (i.e., int or long) x and a nonnegative integer y, x**y is exact: >>> 101 ** 12

Re: minidom utf-8 encoding

2007-01-04 Thread Martin v. Löwis
fscked schrieb: > # Create the base element > boxes = doc.createElement("boxes") > myfile = open('ClientsXMLUpdate.txt') > csvreader = csv.reader(myfile) > for row in csvreader: > mainbox = doc.createElement("box") > doc.appendChild(boxes) > r2 = csv.reader(myfile) > b = r2.next()

Re: Turn off line wrap for lists?

2007-01-04 Thread Michael Tobis
_ wrote: > (I did google for this, I promise) > > How do I get python NOT to insert newlines into string representations > of lists when I do something like this: > > strCollector += "%s" % (['a', 'list', 'with', 'lots', 'of', 'elements'] > * 100) It shouldn't and doesn't insert newlines. ##

Re: Turn off line wrap for lists?

2007-01-04 Thread Carsten Haese
On Thu, 2007-01-04 at 17:01 -0800, _ wrote: > (I did google for this, I promise) > > How do I get python NOT to insert newlines into string representations > of lists when I do something like this: > > strCollector += "%s" % (['a', 'list', 'with', 'lots', 'of', 'elements'] > * 100) What makes yo

Turn off line wrap for lists?

2007-01-04 Thread _
(I did google for this, I promise) How do I get python NOT to insert newlines into string representations of lists when I do something like this: strCollector += "%s" % (['a', 'list', 'with', 'lots', 'of', 'elements'] * 100) ? I would like to set a default never to do this, if possible. (Never

[ANN] argparse 0.4 - Command-line parsing library

2007-01-04 Thread Steven Bethard
Announcing argparse 0.4 --- argparse home: http://argparse.python-hosting.com/ argparse single module download: http://argparse.python-hosting.com/file/trunk/argparse.py?format=raw argparse bundled downloads at PyPI: http://www.python.org/pypi/argparse/ New in this

Re: When argparse will be in the python standard installation

2007-01-04 Thread Steven Bethard
Steven Bethard schrieb: > If someone has an idea how to include argparse features into optparse, > I'm certainly all for it. But I tried and failed to do this myself, so > I don't know how to go about it. Martin v. Löwis wrote: > It's not necessary that the implementation is retained, only tha

cache line length of a machine

2007-01-04 Thread John
How do I find out the cache line length of a machine in python? Thanks, --j -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem Running Working Code on Mac

2007-01-04 Thread hg
goodepic wrote: > I'm newish to python and just got my first mac, so sorry if this is > stupid. I have a little app developed by someone else in wxGlade that > implements a complex stats package and language package, all in python. > It works fine on my work PC, but not on my laptop. I have a n

Re: subclassing a module: misleading(?) error message

2007-01-04 Thread Huayang Xia
So you know you are subclassing a module. There is an answer @ http://www.velocityreviews.com/forums/showpost.php?p=1819038&postcount=2 On Jan 4, 3:49 pm, "Erik Johnson" wrote: > I ran into a problem I didn't understand at first. I got part of it figured > out. Let me first demonstrate the origi

Re: Problem Running Working Code on Mac

2007-01-04 Thread goodepic
Also, if it makes a difference, the lines quoted in the error message were actually written automatically by wxGlade. -- http://mail.python.org/mailman/listinfo/python-list

Problem Running Working Code on Mac

2007-01-04 Thread goodepic
I'm newish to python and just got my first mac, so sorry if this is stupid. I have a little app developed by someone else in wxGlade that implements a complex stats package and language package, all in python. It works fine on my work PC, but not on my laptop. I have a new macbook 2ghz core duo,

Re: subclassing a module: misleading(?) error message

2007-01-04 Thread Carl Banks
Erik Johnson wrote: > My questions are: > > Why does python complain about a function here? (it's a class definition > statement, right?) Because you're calling the function with the wrong number of arguments. > Is there really a function being called here? Yes. (Well, it's not exactly a functi

Re: When argparse will be in the python standard installation

2007-01-04 Thread John J. Lee
Steven Bethard <[EMAIL PROTECTED]> writes: > Martin v. Löwis wrote: > > Steven Bethard schrieb: > >> If someone has an idea how to include argparse features into optparse, > >> I'm certainly all for it. But I tried and failed to do this myself, so I > >> don't know how to go about it. > > It's not

subclassing a module: misleading(?) error message

2007-01-04 Thread Erik Johnson
I ran into a problem I didn't understand at first. I got part of it figured out. Let me first demonstrate the original problem: > cat Super.py class Super(object): def __init__(self): self._class = 'Super' def hello(self): print "%s says 'Hello'" % self._class > cat Sub.py

Re: Draw rectangle on a Window DC

2007-01-04 Thread paul
Raymond schrieb: > Hi: > > I want to Draw rectangle on Dc when gived a position. Can you teach me? Let > me view your code? Well, you haven't given us much background but I'd suggest if your boss asks you to draw a rectangle on your corporate domain controller and the position allows this, you bet

bug in copy.deepcopy or in getattr or in my understanding?

2007-01-04 Thread Emin
Dear experts, I got some unexpected behavior in getattr and copy.deepcopy (see transcript below). I'm not sure if this is actually a bug in copy.deepcopy or if I'm doing something too magical with getattr. Comments would be appreciated. Thanks, -Emin # Transcript follows ###

Re: A python library to convert RTF into PDF ?

2007-01-04 Thread leonel . gayard
> Why not use OO.org to convert DOC to PDF? It does so natively, IIRC. I can't insert variables if the template is a DOC file. This is why we are using RTF. Felipe Almeida Lessa wrote: > On 3 Jan 2007 10:52:02 -0800, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > I have tried to > > convert

Re: Why does Python never add itself to the Windows path?

2007-01-04 Thread robert
Ben Sizer wrote: > robert wrote: >> Ben Sizer wrote: >>> My opinion is that this is not as big a problem as some may feel that >>> it is. Unlike Unix systems, the PATH variable is rarely used. >> It is a big problem. >> >> It is not less than the majority of Python users (at least those who do >>

py2exe setup strange error

2007-01-04 Thread Croteam
Hello, I was trying to install my script (.py) to (.exe) and when I run setup script with cmd I get the error: python mysetup.py py2exe error: COREDLL.dll: No such file or directory Thanks!!! -- http://mail.python.org/mailman/listinfo/python-list

Re: Set type?

2007-01-04 Thread Klaas
Fredrik Lundh wrote: > > if type(var) is types.SetType: > >blah > > > > but that is not available in types module. I am using 2.4 > > # set or subclass of set > if isinstance(var, set): > ... or if isinstance(var, (set, frozenset)): ... -Mike -- http://mail.python.o

Re: Using External Libraries with python?

2007-01-04 Thread Fredrik Lundh
Ognjen Bezanov wrote: > I have some external C libraries I would like to use with python. > > I have been searching on the internet and found many such > modules/bindings for libraries (e.g. Py-Lame) but have not yet > come across any information of how to actually go about creating such > bindin

Re: Set type?

2007-01-04 Thread Fredrik Lundh
_ wrote: > How do you check to see if a variable is a set? I would like to use > > if type(var) is types.SetType: >blah > > but that is not available in types module. I am using 2.4 # set or subclass of set if isinstance(var, set): ... # exact match if type(v

Re: Set type?

2007-01-04 Thread Robert Kern
_ wrote: > How do you check to see if a variable is a set? I would like to use > > if type(var) is types.SetType: >blah > > but that is not available in types module. I am using 2.4 In [1627]: type(set()) is set Out[1627]: True -- Robert Kern "I have come to believe that the whole world

Re: Set type?

2007-01-04 Thread belinda thom
I've seen people do that using an exception, e.g. try: foo except : #variable foo not defined On Jan 4, 2007, at 10:48 AM, _ wrote: > How do you check to see if a variable is a set? I would like to use > > if type(var) is types.SetType: >blah > > but that is not available in types mo

Re: what is this?

2007-01-04 Thread Eric Price
>From: Paul Watson <[EMAIL PROTECTED]> >Probably most helpful to you is: > >http://developer.mozilla.org/es4/proposals/slice_syntax.html Oh, the step. Okay, thanks ;) Eric _ Communicate instantly! Use your Hotmail address to sign in

Set type?

2007-01-04 Thread _
How do you check to see if a variable is a set? I would like to use if type(var) is types.SetType: blah but that is not available in types module. I am using 2.4 -- http://mail.python.org/mailman/listinfo/python-list

Re: Using External Libraries with python?

2007-01-04 Thread Chris Mellon
On 1/4/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Ognjen Bezanov schrieb: > > I have some external C libraries I would like to use with python. > > > > I have been searching on the internet and found many such > > modules/bindings for libraries (e.g. Py-Lame) but have not yet > > come acros

Re: what is this?

2007-01-04 Thread Paul Watson
Paul Watson wrote: > Eric Price wrote: >> Hello; >> I'm studying some code examples from the python cookbook site. I came >> across this: >> >> def colsplit(l, cols): >>rows = len(l) / cols >>if len(l) % cols: >>rows += 1 >>m = [] >>for i in range(rows): >>m.append(

Re: what is this?

2007-01-04 Thread Paul Watson
Eric Price wrote: > Hello; > I'm studying some code examples from the python cookbook site. I came > across this: > > def colsplit(l, cols): >rows = len(l) / cols >if len(l) % cols: >rows += 1 >m = [] >for i in range(rows): >m.append(l[i::rows]) >return m > >

Re: When argparse will be in the python standard installation

2007-01-04 Thread Steven Bethard
Martin v. Löwis wrote: > Steven Bethard schrieb: >> If someone has an idea how to include argparse features into optparse, >> I'm certainly all for it. But I tried and failed to do this myself, so I >> don't know how to go about it. > > It's not necessary that the implementation is retained, only

Re: Sorting on multiple values, some ascending, some descending

2007-01-04 Thread Neil Cerutti
On 2007-01-04, Peter Otten <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: >> Another trick is to factor the key application out of the >> sort. This may be a good idea if when you want to minimize the >> number of times your key function is called. >> >> The idea is to mangle the list temporaril

Re: where to ask questions related to comtypes?

2007-01-04 Thread wcc
Thank you Thomas. On Jan 3, 11:10 pm, Thomas Heller <[EMAIL PROTECTED]> wrote: > wcc schrieb: > > > Hello group, > > > Is there a separate mailing list for comtypes? Or this is the > > appropriate place to post questions related to this package(from Thomas > > Heller)?It seems the python-win32 mai

Re: question on creating class

2007-01-04 Thread wcc
Thanks for all replies. I'll just to have to figure our which suggested method I should use. To answer Jussi's question, this is why I asked the question. I have the book by Mark: Python Programming on Win32. In Charpter 12: Advanced Python and COM there is a sample code named: DynamicPolicy.py.

Re: minidom utf-8 encoding

2007-01-04 Thread fscked
Martin v. Löwis wrote: <...snip...> > I find that hard to believe. There is no code in Python that does > removal of characters, and I can't see any other reason why it gets > removed. > > OTOH, what I do get when writing to a file is a UnicodeError, when > it tries to convert the Unicode string

Why is pow a builtin, anyways?

2007-01-04 Thread Carl Banks
siggi wrote: > Now the test for module math with function pow(): > --- > >>> pow(9,9) > 387420489 > > Fine, but sqrt() fails: > --- > >>> sqrt(9) > I get this error message > > 'Traceback (most recent call last): > File "", line 1,

Re: Best way to implement a timed queue?

2007-01-04 Thread Martin v. Löwis
Thomas Ploch schrieb: > I am having troubles with implementing a timed queue. I am using the > 'Queue' module to manage several queues. But I want a timed access, i.e. > only 2 fetches per second max. I am horribly stuck on even how I > actually could write it. Has somebody done that before? And wh

Re: Sorting on multiple values, some ascending, some descending

2007-01-04 Thread Peter Otten
Neil Cerutti wrote: > Another trick is to factor the key application out of the sort. > This may be a good idea if when you want to minimize the number > of times your key function is called. > > The idea is to mangle the list temporarily so you can use an > unkeyed sort, and then unmangle the so

Re: what is this?

2007-01-04 Thread Huayang Xia
Sequence slicing [starting-at-index : but-less-than-index [ : step]]. Start defaults to 0, end to len(sequence), step to 1. So l[i::rows] means: slicing start from i, ending with len(l) and step with rows. So function colsplit(l, cols) returns a list of sequence with conversion of: Assume cols =

Re: Using External Libraries with python?

2007-01-04 Thread Martin v. Löwis
Ognjen Bezanov schrieb: > I have some external C libraries I would like to use with python. > > I have been searching on the internet and found many such > modules/bindings for libraries (e.g. Py-Lame) but have not yet > come across any information of how to actually go about creating such > bindi

Re: minidom utf-8 encoding

2007-01-04 Thread Martin v. Löwis
fscked schrieb: > Well, let me clarify. If I just print it to the screen/console it works > fine, but when I do: > > out.write( doc.toprettyxml()) > > it just removes the character that would be the "ö". > > I can post the code if anyone wants to see it, but it is fairly > straightforward. I fi

what is this?

2007-01-04 Thread Eric Price
Hello; I'm studying some code examples from the python cookbook site. I came across this: def colsplit(l, cols): rows = len(l) / cols if len(l) % cols: rows += 1 m = [] for i in range(rows): m.append(l[i::rows]) return m What I'd like to know is what is the double

Re: Best way to implement a timed queue?

2007-01-04 Thread Bjoern Schliessmann
Thomas Ploch wrote: > I am having troubles with implementing a timed queue. I am using > the 'Queue' module to manage several queues. But I want a timed > access, i.e. only 2 fetches per second max. I am horribly stuck on > even how I actually could write it. Has somebody done that before? > And w

Using External Libraries with python?

2007-01-04 Thread Ognjen Bezanov
Hello, I have some external C libraries I would like to use with python. I have been searching on the internet and found many such modules/bindings for libraries (e.g. Py-Lame) but have not yet come across any information of how to actually go about creating such bindings, so I was wondering if a

Re: minidom utf-8 encoding

2007-01-04 Thread fscked
Martin v. Löwis wrote: > fscked schrieb: > > Hi guys/gals. > > > > I am trying to write and xml file from data parsed from a csv. > > > > I can get everything to work except that I cannot get minidom to do --> > > ö which needless to say is driving me nuts. > > > > Any suggestions? > > Works fine

Re: Sorting on multiple values, some ascending, some descending

2007-01-04 Thread Neil Cerutti
On 2007-01-03, dwelden <[EMAIL PROTECTED]> wrote: > I have successfully used the sort lambda construct described in > http://mail.python.org/pipermail/python-list/2006-April/377443.html. > However, how do I take it one step further such that some > values can be sorted ascending and others descendi

Re: Python Wrapper for C# Com Object

2007-01-04 Thread bg_ie
Thomas Heller skrev: > [EMAIL PROTECTED] schrieb: > > [EMAIL PROTECTED] skrev: > > > >> Hi, > >> > >> I wish to write a Python wrapper for my C# COM object but am unsure > >> where to start. I have a dll and a tlb file, and I can use this object > >> in C via the following code - > >> > >> // Con

Re: code optimization (calc PI) / New Algorithme for PI

2007-01-04 Thread Michael M.
[EMAIL PROTECTED] wrote: >>Yes, this "gmpy" sounds good for calc things like that. >>But not available on my machine. >>ImportError: No module named gmpy > > > What type of machine? Windoof with Cygwin. > > The home page for gmpy is http://sourceforge.net/projects/gmpy/ > > I have Windows ve

Re: pow() works but sqrt() not!?

2007-01-04 Thread siggi
Thanks for that, too! Would be interesting to learn how these different algorithms influence the precision of the result!? "Boris Borcic" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > siggi wrote: >> Hi all, >> >> this is a newbie question on : >> Python 2.5 (r25:51908,

Re: code optimization (calc PI) / New Algorithme for PI

2007-01-04 Thread casevh
> Yes, this "gmpy" sounds good for calc things like that. > But not available on my machine. > ImportError: No module named gmpy What type of machine? The home page for gmpy is http://sourceforge.net/projects/gmpy/ I have Windows versions available at http://home.comcast.net/~casevh/ casevh -

Re: Best way to implement a timed queue?

2007-01-04 Thread Jan Dries
Thomas Ploch wrote: > I am having troubles with implementing a timed queue. I am using the > 'Queue' module to manage several queues. But I want a timed access, i.e. > only 2 fetches per second max. I am horribly stuck on even how I > actually could write it. Has somebody done that before? And when

Re: Packaging up a Python/Twisted Matrix application...

2007-01-04 Thread Chris Mellon
On 1/4/07, Chaz Ginger <[EMAIL PROTECTED]> wrote: > I have a rather large Python/Twisted Matrix application that will be run > on Windows, Linux and perhaps Macs. I was wondering if there are any > tools that can be used to create an installer that will bring in Python, > Twisted Matrix, my applica

Re: code optimization (calc PI) / New Algorithme for PI

2007-01-04 Thread Michael M.
Mainly, it was fload-div. Changed to int-div (python //) runs faster. Yes, this "gmpy" sounds good for calc things like that. But not available on my machine. ImportError: No module named gmpy Anyway, thanks for posting. This gmpy module can be very intersting. But right now, the focus was, if i

Re: Packaging up a Python/Twisted Matrix application...

2007-01-04 Thread Felipe Almeida Lessa
On 1/4/07, Chaz Ginger <[EMAIL PROTECTED]> wrote: > I have a rather large Python/Twisted Matrix application that will be run > on Windows, Linux and perhaps Macs. I was wondering if there are any > tools that can be used to create an installer that will bring in Python, > Twisted Matrix, my applica

Packaging up a Python/Twisted Matrix application...

2007-01-04 Thread Chaz Ginger
I have a rather large Python/Twisted Matrix application that will be run on Windows, Linux and perhaps Macs. I was wondering if there are any tools that can be used to create an installer that will bring in Python, Twisted Matrix, my application libraries and anything else I need? I have tried

connection hangs

2007-01-04 Thread jeff . dyke
I am using ftplib in some code that does exactly what you would expect. It ftp's files. Its running inside a service running on windows xp and windows 2003 servers, approximately 20 installations each installation sends between 100 and 1000 files per day. Occasionally the process will hang comple

Best way to implement a timed queue?

2007-01-04 Thread Thomas Ploch
Hello folks, I am having troubles with implementing a timed queue. I am using the 'Queue' module to manage several queues. But I want a timed access, i.e. only 2 fetches per second max. I am horribly stuck on even how I actually could write it. Has somebody done that before? And when yes, how is t

Re: pow() works but sqrt() not!?

2007-01-04 Thread Boris Borcic
siggi wrote: > Hi all, > > this is a newbie question on : > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on > win32 > PC with WinXP > > In > http://www.python.org/doc/2.3.5/lib/module-math.html > I read: > > "sqrt( x) Return the square root of x." > > Now the test f

Re: How do I add users using Python scripts on a Linux machine

2007-01-04 Thread Piet van Oostrum
> Sebastian 'lunar' Wiesner <[EMAIL PROTECTED]> (SW) wrote: >SW> I don't see a problem with SUID on scripts. If you restrict write access >SW> to the owner, modification is hardly possible. >SW> However, if you allow world-wide write access to your binaries and >SW> scripts, both can easily b

Re: Iterate through list two items at a time

2007-01-04 Thread Wade Leftwich
Peter Otten wrote: > Wade Leftwich wrote: > > > from itertools import groupby > > > > def chunk(it, n=0): > > if n == 0: > > return iter([it]) > > def groupfun((x,y)): > > return int(x/n) > > grouped = groupby(enumerate(it), groupfun) > > counted = (y for (x,y) in gr

Re: pow() works but sqrt() not!?

2007-01-04 Thread siggi
Thanks for the explanation. I am astonished what an interpreted language is able to do! "Fredrik Lundh" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > "siggi" wrote: > >> Nope, I did not! But I used sqrt(9), and not math.sqrt(9). The latter >> works >> excellent, thank you!

Re: Extending Embedded Python and execute external script

2007-01-04 Thread Fredrik Lundh
"Vertilka" <[EMAIL PROTECTED]> wrote: > I saw several functions: PyRun_AnyFileExFlags, PyRun_SimpleFileExFlags, > PyRun_FileExFlags. > > Questions: > 1) Which one should i use in order to achieve what i need ? PyRun_SimpleFile or PyRun_SimpleString should be good enough. Using SimpleString is mo

Extending Embedded Python and execute external script

2007-01-04 Thread Vertilka
What i need from my C application to do ? 1) To execute a python script from file. 2) The python script will call functions in my C application. According to the answer from Ravi Teja (topic "C app and Python"), I need to extend embedded python in my C application. I saw several functions: PyRun_

Re: Iterate through list two items at a time

2007-01-04 Thread Peter Otten
Wade Leftwich wrote: > from itertools import groupby > > def chunk(it, n=0): > if n == 0: > return iter([it]) > def groupfun((x,y)): > return int(x/n) > grouped = groupby(enumerate(it), groupfun) > counted = (y for (x,y) in grouped) > return ((z for (y,z) in x)

Re: Iterate through list two items at a time

2007-01-04 Thread Wade Leftwich
Wade Leftwich wrote: > Jeffrey Froman wrote: > > Dave Dean wrote: > > > > > I'm looking for a way to iterate through a list, two (or more) items at a > > > time. > > > > Here's a solution, from the iterools documentation. It may not be the /most/ > > beautiful, but it is short, and scales well fo

Re: code optimization (calc PI)

2007-01-04 Thread Nick Craig-Wood
mm <[EMAIL PROTECTED]> wrote: > (Yes, I konw whats an object is...) > BTW. I did a translation of a pi callculation programm in C to Python. > (Do it by your own... ;-) > Calc PI for 800 digs(?). (german: Stellen) > int a=1,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5; > for(;

Re: pow() works but sqrt() not!?

2007-01-04 Thread Fredrik Lundh
"siggi" wrote: > Nope, I did not! But I used sqrt(9), and not math.sqrt(9). The latter works > excellent, thank you! From now on, I will use "import math" and > "math.fuction()" for EVERY mathematical function, even for pow() etc. just > to be on the safe side! pow and math.pow are two slightly d

Re: question on creating class

2007-01-04 Thread Steven D'Aprano
On Wed, 03 Jan 2007 23:27:57 -0800, wcc wrote: > Hello, > > How do I create a class using a variable as the class name? Try a "class factory". def create_class(classname): class Klass(object): def __init__(self): print "Creating object of %s..." % self.__class__.__name__

Re: Convert Perl to Python

2007-01-04 Thread itoakya
pyperl - Perl for Python "This is a Python extension module that makes it possible to embed Perl interpreter(s) in any Python program. It can be used to invoke arbitrary Perl code, load any Perl modules and make calls directly into Perl functions. The Perl code invoked ca

Re: static object

2007-01-04 Thread Bruno Desthuilliers
Ben Finney a écrit : (snip) > The "Singleton" pattern does what you say here. Implementing a proper > Singleton in Python is complicated and hard to understand. Really ? Using __new__ and a class attribute, it doesn't seem so complicated - nor difficult to understand... -- http://mail.python.org

  1   2   >