Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread bieffe62
On 12 Gen, 00:02, Paul Rubin wrote: > Carl Banks writes: > > and where it was manipulated for that matter. > > > This criticism is completely unfair.  Instance variables have to be > > manipulated somewhere, and unless your object is immutable, that is > > going to h

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-12 Thread bieffe62
On 12 Gen, 14:45, Paul Rubin wrote: > bieff...@gmail.com writes: > > >    class Foo (DynamicAttributes, object): pass > > > You cannot do that, but you can establish a fixed set of attributes by > > defining the __slot__ class variable. > > That is not what __slot__ i

Re: Possible bug in Tkinter - Python 2.6

2009-01-15 Thread bieffe62
On 15 Gen, 11:30, "Eric Brunel" wrote: > Hi all, > > I found a behaviour that might be a bug in Tkinter for Python 2.6. Here is   > the script: > > - >  from Tkinter import * >  from tkMessageBox import * >  from tkFileDialog import * > > root = Tk() > > def ask_file():

Re: Slow Queue.queue? (was: slow network)

2009-01-15 Thread bieffe62
On 15 Gen, 10:22, Laszlo Nagy wrote: > > then the speed goes up to 64 messages/sec on windows and 500 > > messages/sec on Linux. > > Finally I could reach 1500 messages/sec without using the queue. If I > comment out one line (use the queue instead of direct write into socket) > then speed decreas

Re: Client Socket Connection to Java server

2009-01-16 Thread bieffe62
On 16 Gen, 08:10, TechieInsights wrote: > I am having problems with a socket connection to a Java server.  In > java I just open the socket, pass the length and then pass the bits > across the socket. > > I created a socket object: > > import socket > > class MySocket: >         def __init__(self,

Re: thread. question

2009-02-09 Thread bieffe62
On Feb 9, 2:47 pm, Tim Wintle wrote: > Hi, > This is my first post here - google hasn't helped much but sorry if this > has been asked before. > > I've been wondering about some of the technicalities of locks in python > (2.4 and 2.5 mainly). > > I'm using the "old" thread module as (1) I prefer t

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-16 Thread bieffe62
On 16 Feb, 14:47, Mamahita Sela wrote: > Dear All, > > I have read several howtos for threading in PyGTK. I have tried some but with > no luck. > > What i want is: i can keep typing in gtk.TextView while periodically doing > ping some hosts. > > I think, the thread part is working since i can pi

Re: Get file name from file handle

2009-02-17 Thread bieffe62
On Feb 17, 9:21 am, loial wrote: > Is there anyway, having been passed a file handle, to get the > filename? > > I am assuming not, but thought I would ask If by file handle you mean the object returned by 'file' and 'open' functions, it has a name attribute. If by file handle you mean the file d

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-18 Thread bieffe62
On 17 Feb, 02:53, Mamahita Sela wrote: > Dear FB, > > > As you have been already told, join() blocks until the > > thread is > > terminated. and you should avoid that. > > A simple fix could by add a timeout to t.join, doing > > something like : > >         t.join(JOIN_TIMEOUT); > >         if not

Re: Instance attributes vs method arguments

2008-11-25 Thread bieffe62
On 25 Nov, 08:27, John O'Hagan <[EMAIL PROTECTED]> wrote: > Is it better to do this: > > class Class_a(): >         def __init__(self, args): >                 self.a = args.a         >                 self.b = args.b >                 self.c = args.c >                 self.d = args.d >         def

Re: Confused about class relationships

2008-11-27 Thread bieffe62
On 27 Nov, 06:20, John O'Hagan <[EMAIL PROTECTED]> wrote: > Apologies if this is a D.Q., I'm still learning to use classes, and this > little problem has proved too specific to find in the tutorials. > > I have two classes with a relationship that I find confusing. > > One is called Engine, and it

Re: Managing timing in Python calls

2008-12-15 Thread bieffe62
On 15 Dic, 16:21, Ross wrote: > I'm porting some ugly javascript managed stuff to have an equivalent > behaviour in a standalone app. It uses events that arrive from a server, > and various small images.  In this standalone version, the data is local > in a file and the images in a local directory

Re: How to represent a sequence of raw bytes

2008-12-22 Thread bieffe62
On 22 Dic, 03:23, "Steven Woody" wrote: > Hi, > > What's the right type to represent a sequence of raw bytes.  In C, we usually > do > > 1.  char buf[200]  or > 2.  char buf[] = {0x11, 0x22, 0x33, ... } > > What's the equivalent representation for above in Python? > > Thanks. > > - > narke Usual

Re: If an OS was to be written in Python, how'w it look?

2008-10-06 Thread bieffe62
On 6 Ott, 06:16, process <[EMAIL PROTECTED]> wrote: > If an OS was to be written in Python and the hardware optimized for > it, what changes would be made to the hardware to accomodate Python > strenghs and weaknesses? > > Some tagged architecture like in Lisp > machines?http://en.wikipedia.org/wi

Re: how to start thread by group?

2008-10-06 Thread bieffe62
On 6 Ott, 15:24, oyster <[EMAIL PROTECTED]> wrote: > my code is not right, can sb give me a hand? thanx > > for example, I have 1000 urls to be downloaded, but only 5 thread at one time > def threadTask(ulr): >   download(url) > > threadsAll=[] > for url in all_url: >      task=threading.Thread(tar

Re: Cookielib in Jython

2008-10-06 Thread bieffe62
On 6 Ott, 13:19, Felipe De Bene <[EMAIL PROTECTED]> wrote: > Hi There, > I'm trying to run an App I wrote in Python 2.5.2 in Jython 2.2.1 and > everything works fine except when I try to import the Standard > CPython's cookielib. I know this may sound stupid, I could use an > advice here on what's

Re: HARD REAL TIME PYTHON

2008-10-07 Thread bieffe62
On 7 Ott, 01:25, "Blubaugh, David A." <[EMAIL PROTECTED]> wrote: > To All, > > I have done some additional research into the possibility of utilizing > Python for hard real time development.  I have seen on various websites > where this has been discussed before on the internet.  However, I was > w

Re: equivalent of py2exe in other os

2008-10-07 Thread bieffe62
On 7 Ott, 11:32, Astan Chee <[EMAIL PROTECTED]> wrote: > Hi, > I was just wondering if there is a equivalent of py2exe on linux > (centOS) and mac (OS X). I have a python script that uses wx and I dont > want to install wx on linux/mac machines. What are my choices? > Thanks > Astan > > -- > "Formu

Re: how to start thread by group?

2008-10-08 Thread bieffe62
On 7 Ott, 06:37, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 06 Oct 2008 11:24:51 -0300, <[EMAIL PROTECTED]> escribió: > > > On 6 Ott, 15:24, oyster <[EMAIL PROTECTED]> wrote: > >> my code is not right, can sb give me a hand? thanx > > >> for example, I have 1000 urls to be downloaded,

Re: Inefficient summing

2008-10-09 Thread bieffe62
On 8 Ott, 22:23, beginner <[EMAIL PROTECTED]> wrote: > Hi All, > > I have a list of records like below: > > rec=[{"F1":1, "F2":2}, {"F1":3, "F2":4} ] > > Now I want to write code to find out the ratio of the sums of the two > fields. > > One thing I can do is: > > sum(r["F1"] for r in rec)/sum(r["F

Re: Clever way of sorting strings containing integers?

2008-10-09 Thread bieffe62
On 9 Ott, 09:41, Holger <[EMAIL PROTECTED]> wrote: > I tried to do this elegantly, but did not come up with a good solution > > Sort strings like > foo1bar2 > foo10bar10 > foo2bar3 > foo10bar2 > > So that they come out: > foo1bar2 > foo2bar3 > foo10bar2 > foo10bar10 > > I.e. isolate integer parts a

Re: NameError question - def(self, master) - master not in namespace within class?

2008-10-09 Thread bieffe62
On 9 Ott, 17:43, harijay <[EMAIL PROTECTED]> wrote: > Hi I am new to writing module and object oriented python code. I am > trying to understand namespaces and classes in python. > > I have the following test case given in three files runner , master > and child. I am getting an error within child

Re: Python memory usage

2008-10-29 Thread bieffe62
On 21 Ott, 17:19, Rolf Wester <[EMAIL PROTECTED]> wrote: > Hi, > > I have the problem that with long running Python scripts (many loops) > memory consumption increases until the script crashes. I used the > following small script to understand what might happen: > > import gc > > print len(gc.get_o

Re: how to use logging module to log an object like print()

2008-10-29 Thread bieffe62
On 29 Ott, 12:24, Steve Holden <[EMAIL PROTECTED]> wrote: > Diez B. Roggisch wrote: > > davy zhang schrieb: > >> mport logging > >> import pickle > > >> # create logger > >> logger = logging.getLogger("simple_example") > >> logger.setLevel(logging.DEBUG) > >> # create console handler and set level

Re: Problem with writing fast UDP server

2008-11-20 Thread bieffe62
On 20 Nov, 16:03, Krzysztof Retel <[EMAIL PROTECTED]> wrote: > Hi guys, > > I am struggling writing fast UDP server. It has to handle around 1 > UDP packets per second. I started building that with non blocking > socket and threads. Unfortunately my approach does not work at all. > I wrote a si

Re: A tale of two execs

2009-02-23 Thread bieffe62
On Feb 23, 5:53 pm, aha wrote: > Hello All, >   I am working on a project where I need to support versions of Python > as old as 2.3. Previously, we distributed Python with our product, but > this seemed a bit silly so we are no longer doing this.  The problem > that I am faced with is that we hav

Re: A tale of two execs

2009-02-23 Thread bieffe62
On Feb 23, 6:06 pm, bieff...@gmail.com wrote: > On Feb 23, 5:53 pm, aha wrote: > > > > > > > Hello All, > >   I am working on a project where I need to support versions of Python > > as old as 2.3. Previously, we distributed Python with our product, but > > this seemed a bit silly so we are no lon

Re: don't understand behaviour of recursive structure

2009-03-14 Thread bieffe62
On 14 Mar, 17:31, Dan Davison wrote: > I'm new to python. Could someone please explain the following behaviour > of a recursive data structure? > > def new_node(id='', daughters=[]): >     return dict(id=id, daughters=daughters) > Most probably, here is the problem : try this instead: def new_no

Re: Strange crash issue on Windows w/ PyGTK, Cairo...

2009-03-18 Thread bieffe62
On Mar 18, 6:20 am, CJ Kucera wrote: > Hello list! > > I'm having a strange issue, and I'm not entirely certain yet where > the actual problem is (ie, Python, PyGTK, or gtk+), but I figure I'll > start here.  Bear with me, this'll probably be a long explanation... > > I've been building an app whi

Re: How to do this in Python?

2009-03-18 Thread bieffe62
On Mar 18, 2:00 am, Jim Garrison wrote: >  I don't want "for line in f:" because binary > files don't necessarily have lines and I'm bulk processing > files potentially 100MB and larger.  Reading them one line > at a time would be highly inefficient. > > Thanks- Hide quoted text - > > - Show quot

Re: Strange crash issue on Windows w/ PyGTK, Cairo...

2009-03-18 Thread bieffe62
On Mar 18, 2:33 pm, CJ Kucera wrote: > bieff...@gmail.com wrote: > > It looks like some of the C extension you are using is causing a > > segfault or similar in python > > interpreter (or it could be a bug in the interpreter itself, but it is > > a lot less likely). > > Okay...  I assume by "C ext

Re: How to do this in Python? - A "gotcha"

2009-03-19 Thread bieffe62
On Mar 18, 6:06 pm, Jim Garrison wrote: > S Arrowsmith wrote: > > Jim Garrison   wrote: > >> It's a shame the iter(o,sentinel) builtin does the > >> comparison itself, instead of being defined as iter(callable,callable) > >> where the second argument implements the termination test and returns a >

Re: multiprocessing and Tk GUI program (won't work under Linux)

2009-03-20 Thread bieffe62
On Mar 20, 4:36 am, akineko wrote: > Hello everyone, > > I have started using multiprocessing module, which is now available > with Python 2.6. > It definitely opens up new possibilities. > > Now, I developed a small GUI package, which is to be used from other > programs. > It uses multiprocessing

Re: Need guidelines to show results of a process

2009-03-20 Thread bieffe62
On Mar 20, 1:00 am, Vizcayno wrote: > Hi: > I wrote a Python program which, during execution, shows me messages on > console indicating at every moment the time and steps being performed > so I can have a 'log online' and guess remaining time for termination, > I used many 'print' instructions to

Re: Re. suid/sudo in python

2009-03-30 Thread bieffe62
On Mar 30, 1:16 pm, Rustom Mody wrote: > Ben Finney wrote > > > The key thing to realise is that, having relinquished privilege, the same > > process can't get it back again as easily. So if you need to > > do some tasks as a privileged user, do those *very* early and then drop the > > privilege

Re: Which is more Pythonic? (was: Detecting Binary content in files)

2009-04-01 Thread bieffe62
On Apr 1, 5:10 pm, John Posner wrote: > Dennis Lee Bieber presented a code snippet with two consecutive statements > that made me think, "I'd code this differently". So just for fun ... is > Dennis's original statement or my "_alt" statement more idiomatically > Pythonic? Are there even more Pytho

Re: Killing threads

2009-04-06 Thread bieffe62
On Apr 5, 9:48 pm, Dennis Lee Bieber wrote: > On Sun, 05 Apr 2009 12:54:45 +0200, Francesco Bochicchio > declaimed the following in > gmane.comp.python.general: > > > If yor threads are not set as 'deamons' using Thread.setDaemon method, > > then your main program at its termination should call T

Re: Killing threads

2009-04-06 Thread bieffe62
On 6 Apr, 05:25, ericwoodwo...@gmail.com wrote: > On Apr 5, 11:07 pm, Dennis Lee Bieber wrote: > > > > > > > On Sun, 5 Apr 2009 17:27:15 -0700 (PDT), imageguy > > declaimed the following in > > gmane.comp.python.general: > > > > In threading.Event python 2.5 docs say; > > > "This is one of the si

Re: segmentation fault while using ctypes

2009-04-14 Thread bieffe62
On Apr 15, 12:39 am, sanket wrote: > Hello All, > > I am dealing with this weird bug. > I have a function in C and I have written python bindings for it using > ctypes. > > I can call this function for couple of times and then suddenly it > gives me seg fault. > But I can call same function from a

Re: Python mail truncate problem

2009-05-18 Thread bieffe62
On 18 Mag, 05:51, David wrote: > Hi, > > I am writing Python script to process e-mails in a user's mail > account. What I want to do is to update that e-mail's Status to 'R' > after processing it, however, the following script truncates old e- > mails even though it updates that e-mail's Status co