Re: Abstract Methods & Abstract Class

2005-10-19 Thread Andreas Kostyrka
On Thu, Oct 20, 2005 at 12:05:05PM +0530, Iyer, Prasad C wrote: > > Do we have something like abstract methods & Abstract class. > > So that my class would just define the method. And the implementation > would be defined by somebody else. class AbstractBase: def method(self): raise

Re: Dynamic Link Library

2005-12-05 Thread Andreas Kostyrka
Am Montag, den 05.12.2005, 21:30 -0500 schrieb Ervin J. Obando: > Hi everyone, > > Apologies if my question is a bit novice-ish. I was wondering if there > was a way of creating a Dynamic Link Library with Python. Probably yes. But why would you want to do that? Actually the way would be to crea

Re: Can we pass some arguments to system("cmdline")?

2005-06-19 Thread Andreas Kostyrka
On Sun, Jun 19, 2005 at 11:12:05PM -0700, Didier C wrote: > Hi! >I was wondering if we can pass some arguments to system("cmdline")? > > E.g in Perl, we can do something like: > > $dir="/home/cypher"; > > system("ls $dir"); > > which would instruct Perl to do an "ls /home/cypher" > > But i

Re: Embedding Python - Deleting a class instance

2005-06-22 Thread Andreas Kostyrka
On Tue, Jun 21, 2005 at 12:06:47PM +, Bue Krogh Vedel-Larsen wrote: > How do I delete a class instance created using PyInstance_New? I've tried > calling Py_CLEAR on the instance, but __del__ isn't called. I've also tried > calling PyObject_Del, but this gives an access violation in > _PyObj

Re: PEP ? os.listdir enhancement

2005-06-23 Thread Andreas Kostyrka
What's wrong with (os.path.join(d, x) for x in os.listdir(d)) It's short, and easier to understand then some obscure option ;) Andreas On Thu, Jun 23, 2005 at 11:05:57AM +0200, Riccardo Galli wrote: > On Wed, 22 Jun 2005 11:27:06 -0500, Jeff Epler wrote: > > > Why not just define the function

Re: help!

2005-06-24 Thread Andreas Kostyrka
Just out of curiosity, does the filesystem support seperate a/m/c times? Andreas On Fri, Jun 24, 2005 at 02:49:01PM +0300, Eser Çetinkaya wrote: > > > In your documentation, it is written : > " > os.path.getatime(path) > Return the time of last access of path. The return value

Re: strange __call__

2005-06-29 Thread Andreas Kostyrka
Just a guess, but setting "__X__" special methods won't work in most cases because these are usually optimized when the class is created. It might work if a.__call__ did exist before (because class a: contained a __call__ definition). Andreas On Wed, Jun 29, 2005 at 09:15:45AM +0100, Michael Hof

Re: Store multiple dictionaries in a file

2005-06-30 Thread Andreas Kostyrka
How so? >>> import cPickle as cp >>> f=open("/tmp/test.pck", "wb") >>> cp.dump(dict(a=1), f) >>> cp.dump(dict(b=1), f) >>> f.close() >>> f=open("/tmp/test.pck", "rb") >>> cp.load(f) {'a': 1} >>> cp.load(f) {'b': 1} >>> cp.load(f) Traceback (most recent call last): File "", line 1, in ? EOFError

Re: Re:

2005-07-01 Thread Andreas Kostyrka
import os as realos Names are nothing magic in Python, and quite easily manipulated: import os os.write(1, "Hello World!") class os: pass o = os() import os os.write(1, "\n") So basically this kind of name clashes usually do not happen in Python. Or another usage: os = SomeObject()

Re: Re:

2005-07-01 Thread Andreas Kostyrka
Am Freitag, den 01.07.2005, 08:25 -0700 schrieb George Sakkis: > > > > Again, how? Is there a way to force that an external user of my lib can > > not use my internal data/methods/classes, unless he uses odd compiler > > hacks? > Well, one could probably argue it the other way. In Python you can a

Re: Re:

2005-07-01 Thread Andreas Kostyrka
Am Freitag, den 01.07.2005, 13:50 +0100 schrieb Tom Anderson: > On Fri, 1 Jul 2005, Adriaan Renting wrote: > > > I'm not a very experienced Python programmer yet, so I might be > > mistaken, but there are a few things that would make me prefer C++ over > > Python for large (over 500.000 LOC) pro

Re: shelve in a ZipFile?

2005-07-02 Thread Andreas Kostyrka
Am Freitag, den 01.07.2005, 10:53 -0700 schrieb Scott David Daniels: > Terry Hancock wrote: > > I only just recently had a look at the shelve module > > That would be handy if, for example, I wanted to couple > > (and compress into the bargain) by putting my two > > shelf files into a single zi

Re: No Subject

2005-07-02 Thread Andreas Kostyrka
Am Freitag, den 01.07.2005, 18:55 +0200 schrieb Harry George: > Tom Anderson <[EMAIL PROTECTED]> writes: > > > On Fri, 1 Jul 2005, Adriaan Renting wrote: > > > > > I'm not a very experienced Python programmer yet, so I might be > > > mistaken, but there are a few things that would make me prefer

Re: Re:

2005-07-02 Thread Andreas Kostyrka
Am Samstag, den 02.07.2005, 15:11 +0100 schrieb Tom Anderson: > On Fri, 1 Jul 2005, Andreas Kostyrka wrote: > > > Am Freitag, den 01.07.2005, 08:25 -0700 schrieb George Sakkis: > > > >>> Again, how? Is there a way to force that an external user of my lib can > >

Re: Polling, Fifos, and Linux

2005-07-08 Thread Andreas Kostyrka
On Thu, Jul 07, 2005 at 10:21:19PM -0700, Jacob Page wrote: > Jeremy Moles wrote: > > This is my first time working with some of the more lower-level python > > "stuff." I was wondering if someone could tell me what I'm doing wrong > > with my simple test here? > > > > Basically, what I need is an

Re: Existance of of variable

2005-07-13 Thread Andreas Kostyrka
Am Montag, den 04.07.2005, 20:25 -0400 schrieb Roy Smith: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > Should we *really* be encouraging newbies to mess with globals() and > > locals()? Isn't that giving them the tools to shoot their foot off before > > teaching them how to put shoes on? > > W

Re: threads and sleep?

2005-07-13 Thread Andreas Kostyrka
Am Montag, den 04.07.2005, 15:36 -0400 schrieb Jeffrey Maitland: > Hello all, > Ok, first thing to consider is that time.sleep in Python does in reality (on Debian Linux, Python2.3) a select syscall with 3 NULLs to wait the time. (The "real" sleep POSIX call might have stupid interactions with si

Re: threads and sleep?

2005-07-13 Thread Andreas Kostyrka
Am Dienstag, den 05.07.2005, 08:37 -0700 schrieb Jonathan Ellis: > In many ways, Python is an incredibly bad choice for deeply > multithreaded applications. One big problem is the global interpreter > lock; no matter how many CPUs you have, only one will run python code > at a time. (Many people

Re: threads and sleep?

2005-07-13 Thread Andreas Kostyrka
Am Donnerstag, den 07.07.2005, 22:56 + schrieb Grant Edwards: > Oh. I assumed that CPython used Posix threads on Posix It does. > platforms. At least in my experience under Linux, libpthread > always creates an extra "manager" thread. Though in our case It probably does. But it will probabl

Re: threads and sleep?

2005-07-13 Thread Andreas Kostyrka
Am Mittwoch, den 06.07.2005, 04:00 + schrieb Dennis Lee Bieber: > {I'm going to louse up the message tracking here by pasting part of > your > follow-up into one response} > > 2> Upon further thought, that just can't be the case. There has > 2> to be multiple instances of the intepreter becau

Re: threads and sleep?

2005-07-13 Thread Andreas Kostyrka
Am Mittwoch, den 06.07.2005, 14:38 + schrieb Grant Edwards: > > Unfortunately that means you've got to debug a number cruncher > that's written in C. If one is careful, one can use Pyrex :) Andreas signature.asc Description: Dies ist ein digital signierter Nachrichtenteil -- http://mail.p

Re: threads and sleep?

2005-07-13 Thread Andreas Kostyrka
Am Mittwoch, den 06.07.2005, 12:27 -0700 schrieb Jonathan Ellis: > Your sarcasm is cute, I suppose, but think about it for a minute. If > the opposite of what I assert is true, why would even the mainstream > press be running articles along the lines of "multicore CPUs mean > programming will get

Re: httplib/HTTPS Post Problem

2005-07-15 Thread Andreas Kostyrka
Am Montag, den 11.07.2005, 06:29 -0700 schrieb [EMAIL PROTECTED]: > Hi, > > Sorry to post what might seem like a trivial problem here, but its > driving me mad! > > I have a simple https client that uses httplib to post data to a web > server. > > When I post over http & https using curl the dat

Re: python certification

2005-07-20 Thread Andreas Kostyrka
On Wed, Jul 20, 2005 at 04:22:10PM +0200, Fabien wrote: > > Python is not about certificates or diplomas, so do not spend any > > money on it (the other guy was only joking). > > Even if Python is not about certificates, I think it's not the case for > some company. And when you say to a company t

Re: time.time() under load between two machines

2005-07-22 Thread Andreas Kostyrka
I've just noticed that you didn't mention any details like OS, versions, network infrastructure. You do not mention either how large the difference is. Andreas -- http://mail.python.org/mailman/listinfo/python-list

Re: return None

2005-07-22 Thread Andreas Kostyrka
On Fri, Jul 22, 2005 at 07:40:00PM +0200, Ximo wrote: > Can I do a function which don't return anything? > > The question is that, if I do a function that have a return or without > return, it returns always "None", but i want that it doesnt return me > nothing Define nothing :) None is the repr

Re: Parsing a log file

2005-08-14 Thread Andreas Kostyrka
Am Samstag, den 13.08.2005, 14:01 -0700 schrieb CG: Well, you have described your problem nicely. One thing that's missing is how to deal with incorrect input. (For example missing connect or disconnect messages). Furthermore, you can now: a) try to find somebody who writes it for you. How you mo

Re: Parsing a log file

2005-08-14 Thread Andreas Kostyrka
Completly untested: #!/usr/bin/env python import sys, datetime user = sys.argv[1] starttime = None for l in sys.stdin: flds = l.strip().split() datestr, timestr, prog, op, to, sname = flds month, day, year = [int(x) for x in datestr.split("-", 2)] hour, min, sec, ms = [int(x) fo

Re: Parsing a log file

2005-08-14 Thread Andreas Kostyrka
Completly untested: #!/usr/bin/env python import sys, datetime user = sys.argv[1] starttime = None for l in sys.stdin: flds = l.strip().split() datestr, timestr, prog, op, to, sname = flds month, day, year = [int(x) for x in datestr.split("-", 2)] hour, min, sec, ms = [int(x) fo

Re: The ONLY thing that prevents me from using Python

2005-08-24 Thread Andreas Kostyrka
On Wed, Aug 24, 2005 at 09:49:01AM +0100, Richie Hindle wrote: > > [Chris] > > Not to be a shill, but I'd be interested in testimonials on > > http://linode.org/ > > I wonder if virtualization is the next killer app. > > Certainly blows the WTF my ISP? question away... > > I can't speak for lino

Re: Lossless Number Conversion

2005-08-29 Thread Andreas Kostyrka
Am Sonntag, den 28.08.2005, 21:36 + schrieb Chris Spencer: > Is there any library for Python that implements a kind of universal > number object. Something that, if you divide two integers, generates a > ratio instead of a float, or if you take the square root of a negative, > generates a co

Re: Performance (pystone) of python 2.4 lower then python 2.3 ???

2004-12-17 Thread Andreas Kostyrka
Ok, here are my results, all python Versions supplied by Debian: [EMAIL PROTECTED]:~> python1.5 /usr/lib/python1.5/test/pystone.py Pystone(1.1) time for 1 passes = 1.33 This machine benchmarks at 7518.8 pystones/second [EMAIL PROTECTED]:~> python2.2 /usr/lib/python1.5/test/pystone.py Pystone(1

Re: python speed

2005-12-28 Thread Andreas Kostyrka
Am Mittwoch, den 30.11.2005, 08:15 -0700 schrieb Steven Bethard: > David Rasmussen wrote: > > Harald Armin Massa wrote: > > > >> Dr. Armin Rigo has some mathematical proof, that High Level Languages > >> like esp. Python are able to be faster than low level code like > >> Fortran, C or assembly. >

Re: pdb.py - why is this debugger different from all other debuggers?

2006-01-15 Thread Andreas Kostyrka
Am Donnerstag, den 05.01.2006, 15:03 -0800 schrieb [EMAIL PROTECTED]: I know this sounds like brutal, but I've been developing Python code for a decade now, and I've almost never used pdb.py. OTOH I also use gdb only for "bt" from a core file. Sorry to sound harsh, I do not consider manually step

Re: pdb.py - why is this debugger different from all other debuggers?

2006-01-15 Thread Andreas Kostyrka
Am Donnerstag, den 05.01.2006, 21:34 -0800 schrieb [EMAIL PROTECTED]: > [EMAIL PROTECTED] wrote: > > Mike> I don't use pdb a lot either - and I write a *lot* of Python. > > > > Ditto. I frequently just insert prints or enable cgitb. Sometimes I enable > > line tracing for a specific function and

Re: Software licenses and releasing Python programs for review

2005-06-02 Thread Andreas Kostyrka
On Thu, Jun 02, 2005 at 01:57:25AM -0700, Robert Kern wrote: > And for thoroughness, allow me to add "even if they have no intention or > desire to profit monetarily." I can't explain exactly why this is the > case, but it seems to be true in the overwhelming majority of cases. > Academic projec

Re: Software licenses and releasing Python programs for review

2005-06-02 Thread Andreas Kostyrka
Am Donnerstag, den 02.06.2005, 17:52 + schrieb Karl A. Krueger: > Andreas Kostyrka <[EMAIL PROTECTED]> wrote: > > *) GPL is not acceptable for "library" stuff, because as a software > > developer I'm sometimes forced to do "closed" stuff. > &

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread Andreas Kostyrka
On Sat, Jun 04, 2005 at 11:49:28PM -0700, Robert Kern wrote: > Well, the FSF at least thinks that internal use within an organization > does not constitute distribution. Well, the problem are contractors. It's very important (for example in Germany) for a number of legal reasons that contractors a

Re: Software licenses and releasing Python programs for review

2005-06-06 Thread Andreas Kostyrka
On Mon, Jun 06, 2005 at 06:08:36PM -, max wrote: > I guess my argument is that with multiple contributors, the gpl, in > comparison to say, a BSD style license, grants power to the code. If 3 > people work on a gpl project, they must agree to any changes. If 3 > people work on a BSD style pr

Re: multiple inheritance

2005-06-09 Thread Andreas Kostyrka
I'm sure it's documented somewhere, but here we go :) The correct usage is super(MyClass, self) The idea is that super allows for cooperative calls. It uses MyClass to locate what class "above" to call. This way you can something like that: class A(object): def bar(self): print "A"

Re: Perl s/ To Python?

2005-06-10 Thread Andreas Kostyrka
I'd consider taking a look at the re module ;) Andreas On Fri, Jun 10, 2005 at 02:57:21PM +0100, John Abel wrote: > Does anyone know of a quick way of performing this: > > $testVar =~ s#/mail/.*$##g > > The only way I can think of doing it, is: > > mailPos = testVar.find( "mail" ) > remainder

Re: What is different with Python ?

2005-06-13 Thread Andreas Kostyrka
On Mon, Jun 13, 2005 at 06:13:13AM +, Andrea Griffini wrote: > >Andrea Griffini <[EMAIL PROTECTED]> writes: > >So you're arguing that a CS major should start by learning electronics > >fundamentals, how gates work, and how to design hardware(*)? Because > >that's what the concrete level *really

Re: What is different with Python ?

2005-06-14 Thread Andreas Kostyrka
On Tue, Jun 14, 2005 at 12:02:29AM +, Andrea Griffini wrote: > However I do not think that going this low (that's is still > IMO just a bit below assembler and still quite higher than > HW design) is very common for programmers. Well, at least one University (Technical University Vienna) does i

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread Andreas Kostyrka
Well, It means that eval(repr(x)) == x if at all possible. Basically: repr('abc') -> 'abc' str('abc') -> abc You'll notice that 'abc' is a valid python expression for the string, while abc is not a valid string expression. Andreas On Wed, Jun 15, 2005 at 02:46:04PM +0200, Jan Danielsson wrote: >

Re: pyrex problem

2005-06-17 Thread Andreas Kostyrka
On Fri, Jun 17, 2005 at 01:03:14AM -0700, [EMAIL PROTECTED] wrote: > hi everyone > i'm newbie > > i try to compile the pyrex module: > def controlla(char *test): You cannot have a C datatype in a Python like that. Much better to use def controlla(test): Andreas -- http://mail.python.org/mailman/

Re: Python is slow

2008-12-12 Thread Andreas Kostyrka
On Fri, Dec 12, 2008 at 06:17:43AM -0800, sturlamolden wrote: > None of those projects addresses inefficacies in the CPython > interpreter, except for psyco - which died of an overdose PyPy. Bullshit. All that discussion about performance forgets that performance is a function of the whole system

Re: execution time

2008-12-14 Thread Andreas Kostyrka
On Sun, Dec 14, 2008 at 05:03:38PM +0100, David Hláčik wrote: > Hi guys, > > #! /usr/bin/python > > import random > import bucket2 > > data = [ random.randint(1,25) for i in range(5)] > print "random data : %s" % data > print "result: %s" %bucket2.sort(data) > > How to write a test script which

Re: Python is slow

2008-12-14 Thread Andreas Kostyrka
Am Sun, 14 Dec 2008 20:38:58 -0800 (PST) schrieb cm_gui : > > hahaha, do you know how much money they are spending on hardware to > make > youtube.com fast??? yeah, as they do for basically all big sites, no matter what language is used for implementation. Next is the fact that it's rather simp